Merge branch 'sgm_upgrade' into 'master'

* Fix upgrade bug.

See merge request easycorp/zentaopms!2227
This commit is contained in:
朱金勇
2022-03-14 03:32:07 +00:00
2 changed files with 9 additions and 8 deletions
+2 -2
View File
@@ -78,8 +78,8 @@ class settingModel extends model
$item->key = $key;
$item->value = $value;
/* The setting of system.common has no vision. */
if($owner != 'system' or $module != 'common') $item->vision = $vision;
/* If in upgrade, skip vision. */
if(!defined('IN_UPGRADE')) $item->vision = $vision;
$this->dao->replace(TABLE_CONFIG)->data($item)->exec();
}
+7 -6
View File
@@ -1144,14 +1144,15 @@ class upgradeModel extends model
{
if(empty($version)) $version = $this->config->installedVersion;
$editions = array('p' => 'proVersion', 'b' => 'bizVersion', 'm' => 'maxVersion');
$version = str_replace('.', '_', $version);
$fromEdition = is_numeric($version[0]) ? 'open' : $editions[$version[0]];
$openVersion = is_numeric($version[0]) ? $version : $this->config->upgrade->{$fromEdition}[$version];
$openVersion = str_replace('_', '.', $openVersion);
$editions = array('p' => 'proVersion', 'b' => 'bizVersion', 'm' => 'maxVersion');
$version = str_replace('.', '_', $version);
$fromEdition = is_numeric($version[0]) ? 'open' : $editions[$version[0]];
$openVersion = is_numeric($version[0]) ? $version : $this->config->upgrade->{$fromEdition}[$version];
$openVersion = str_replace('_', '.', $openVersion);
$checkVersion = version_compare($openVersion, '16.5', '<') ? str_replace('_', '.', $version) : $openVersion;
$alterSQL = '';
$standardSQL = $this->app->getAppRoot() . 'db' . DS . 'standard' . DS . 'zentao' . $openVersion . '.sql';
$standardSQL = $this->app->getAppRoot() . 'db' . DS . 'standard' . DS . 'zentao' . $checkVersion . '.sql';
if(!file_exists($standardSQL)) return $alterSQL;
$lines = file($standardSQL);