* fix bugs for upgrade.
This commit is contained in:
@@ -44,7 +44,7 @@ class admin extends control
|
||||
*/
|
||||
public function ignore()
|
||||
{
|
||||
$this->loadModel('setting')->setItem('system', 'common', 'global', 'community', 'na');
|
||||
$this->loadModel('setting')->setItemGE32('system', 'common', 'global', 'community', 'na');
|
||||
die(js::locate(inlink('index'), 'parent'));
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ class admin extends control
|
||||
$response = $this->admin->registerByAPI();
|
||||
if($response == 'success')
|
||||
{
|
||||
$this->loadModel('setting')->setItem('system', 'common', 'global', 'community', $this->post->account);
|
||||
$this->loadModel('setting')->setItemGE32('system', 'common', 'global', 'community', $this->post->account);
|
||||
echo js::alert($this->lang->admin->register->success);
|
||||
die(js::locate(inlink('index'), 'parent'));
|
||||
}
|
||||
@@ -85,7 +85,7 @@ class admin extends control
|
||||
$response = $this->admin->bindByAPI();
|
||||
if($response == 'success')
|
||||
{
|
||||
$this->loadModel('setting')->setItem('system', 'common', 'global', 'community', $this->post->account);
|
||||
$this->loadModel('setting')->setItemGE32('system', 'common', 'global', 'community', $this->post->account);
|
||||
echo js::alert($this->lang->admin->bind->success);
|
||||
die(js::locate(inlink('index'), 'parent'));
|
||||
}
|
||||
|
||||
@@ -69,7 +69,8 @@ class settingModel extends model
|
||||
*/
|
||||
public function updateVersion($version)
|
||||
{
|
||||
$this->setItem('system', 'common', 'global', 'version', $version, 0);
|
||||
if($version >= 3.2) $this->setItemGE32('system', 'common', 'global', 'version', $version, 0);
|
||||
else $this->setItemLT32('system', 'global', 'version', $version, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,7 +104,7 @@ class settingModel extends model
|
||||
$sn == '13593e340ee2bdffed640d0c4eed8bec')
|
||||
{
|
||||
$sn = $this->computeSN();
|
||||
$this->setItem('system', 'common', 'global', 'sn', $sn, 0);
|
||||
$this->setItemGE32('system', 'common', 'global', 'sn', $sn, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +143,7 @@ class settingModel extends model
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function setItem($owner, $module, $section, $key, $value = '', $company = 'current')
|
||||
public function setItemGE32($owner, $module, $section, $key, $value = '', $company = 'current')
|
||||
{
|
||||
$item->company = $company === 'current' ? $this->app->company->id : $company;
|
||||
$item->owner = $owner;
|
||||
@@ -154,6 +155,29 @@ class settingModel extends model
|
||||
$this->dao->replace(TABLE_CONFIG)->data($item)->exec($autoCompany = false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set value of an item.
|
||||
*
|
||||
* @param string $owner
|
||||
* @param string $module
|
||||
* @param string $section
|
||||
* @param string $key
|
||||
* @param string $value
|
||||
* @param string|int $company
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function setItemLT32($owner, $section, $key, $value = '', $company = 'current')
|
||||
{
|
||||
$item->company = $company === 'current' ? $this->app->company->id : $company;
|
||||
$item->owner = $owner;
|
||||
$item->section = $section;
|
||||
$item->key = $key;
|
||||
$item->value = $value;
|
||||
|
||||
$this->dao->replace(TABLE_CONFIG)->data($item)->exec($autoCompany = false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete value of item
|
||||
*
|
||||
|
||||
@@ -61,3 +61,4 @@ $lang->upgrade->fromVersions['2_4'] = '2.4';
|
||||
$lang->upgrade->fromVersions['3_0_beta1'] = '3.0 BETA1';
|
||||
$lang->upgrade->fromVersions['3_0_beta2'] = '3.0 BETA2';
|
||||
$lang->upgrade->fromVersions['3_0'] = '3.0 STABLE';
|
||||
$lang->upgrade->fromVersions['3_1'] = '3.1';
|
||||
|
||||
@@ -61,3 +61,4 @@ $lang->upgrade->fromVersions['2_4'] = '2.4';
|
||||
$lang->upgrade->fromVersions['3_0_beta1'] = '3.0 BETA1';
|
||||
$lang->upgrade->fromVersions['3_0_beta2'] = '3.0 BETA2';
|
||||
$lang->upgrade->fromVersions['3_0'] = '3.0 STABLE';
|
||||
$lang->upgrade->fromVersions['3_1'] = '3.1';
|
||||
|
||||
@@ -375,7 +375,6 @@ class upgradeModel extends model
|
||||
}
|
||||
|
||||
$this->deletePatch();
|
||||
$this->setting->setSN();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -631,6 +630,14 @@ class upgradeModel extends model
|
||||
$confirmContent .= file_get_contents($this->getUpgradeFile('3.0.beta1'));
|
||||
$confirmContent .= file_get_contents($this->getUpgradeFile('3.1'));
|
||||
}
|
||||
elseif($fromVersion == '3_0_beta2')
|
||||
{
|
||||
$confirmContent .= file_get_contents($this->getUpgradeFile('3.1'));
|
||||
}
|
||||
elseif($fromVersion == '3_0')
|
||||
{
|
||||
$confirmContent .= file_get_contents($this->getUpgradeFile('3.1'));
|
||||
}
|
||||
elseif($fromVersion == '3_1')
|
||||
{
|
||||
$confirmContent .= file_get_contents($this->getUpgradeFile('3.1'));
|
||||
@@ -916,6 +923,7 @@ class upgradeModel extends model
|
||||
*/
|
||||
public function upgradeFrom3_1To3_2()
|
||||
{
|
||||
$this->execSQL($this->getUpgradeFile('3.1'));
|
||||
if(!$this->isError()) $this->setting->updateVersion('3.2');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user