Merge branch release/21.7.8 of zentao/zentaopms (#13103)
This commit is contained in:
@@ -58,7 +58,7 @@ $(function()
|
||||
|
||||
if(response.result == 'success')
|
||||
{
|
||||
loadPage(response.load);
|
||||
response.load ? loadPage(response.load) : loadCurrentPage();
|
||||
}
|
||||
else if(response.result == 'fail')
|
||||
{
|
||||
|
||||
+13
-14
@@ -202,22 +202,22 @@ class upgradeModel extends model
|
||||
$this->executedChanges = empty($this->config->upgrade->executedChanges) ? [] : json_decode($this->config->upgrade->executedChanges, true);
|
||||
|
||||
/* Execute. */
|
||||
$currentVersion = $this->config->installedVersion;
|
||||
$currentOpenVersion = $this->getOpenVersion(str_replace('.', '_', $currentVersion));
|
||||
$upgraradeVersions = $this->getVersionsToUpdate($currentOpenVersion, $this->config->edition);
|
||||
$installedVersion = $this->config->installedVersion;
|
||||
$installedOpenVersion = $this->getOpenVersion(str_replace('.', '_', $installedVersion));
|
||||
$upgraradeVersions = $this->getVersionsToUpdate($installedOpenVersion, $this->fromEdition);
|
||||
|
||||
/* Execute open edition. */
|
||||
$this->saveLogs("Execute $currentOpenVersion");
|
||||
$result = $this->execSQL($this->getUpgradeFile(str_replace('_', '.', $currentOpenVersion)));
|
||||
$this->saveLogs("Execute $installedOpenVersion");
|
||||
$result = $this->execSQL($this->getUpgradeFile(str_replace('_', '.', $installedOpenVersion)));
|
||||
if(!$result) return $this->recordExecutedChanges();
|
||||
|
||||
$result = $this->executeByConfig($currentOpenVersion);
|
||||
$result = $this->executeByConfig($installedOpenVersion);
|
||||
if(!$result) return $this->recordExecutedChanges();
|
||||
|
||||
if(isset($upgraradeVersions[$currentOpenVersion]))
|
||||
if(isset($upgraradeVersions[$installedOpenVersion]))
|
||||
{
|
||||
/* Execute charge edition. */
|
||||
foreach($upgraradeVersions[$currentOpenVersion] as $edition => $chargedVersion)
|
||||
foreach($upgraradeVersions[$installedOpenVersion] as $edition => $chargedVersion)
|
||||
{
|
||||
foreach($chargedVersion as $version)
|
||||
{
|
||||
@@ -237,13 +237,12 @@ class upgradeModel extends model
|
||||
$result = $this->executeOthers($this->fromEdition);
|
||||
if(!$result) return $this->recordExecutedChanges();
|
||||
}
|
||||
|
||||
/**
|
||||
* 升级到最终版本之前,每升级完一个版本,更新一次版本号,防止中途失败重复升级。
|
||||
* 升级到最终版本之后,则在执行完所有后续的数据处理流程后再更新版本号。
|
||||
*/
|
||||
if(version_compare($toVersion, $this->config->version, '<'))
|
||||
else
|
||||
{
|
||||
/**
|
||||
* 升级到最终版本之前,每升级完一个版本,更新一次版本号,防止中途失败重复升级。
|
||||
* 升级到最终版本之后,则在执行完所有后续的数据处理流程后再更新版本号。
|
||||
*/
|
||||
$this->loadModel('setting')->updateVersion($toVersion);
|
||||
$this->recordExecutedChanges(true);
|
||||
}
|
||||
|
||||
@@ -21,14 +21,17 @@ $completedCount = array_search($toVersion, array_keys($upgradeVersions));
|
||||
$progress = $totalVersions ? (int)($completedCount / $totalVersions * 100) : 0;
|
||||
$progressLabel = $completedCount . '/' . $totalVersions;
|
||||
|
||||
$buildVersions = function() use ($lang, $toVersion, $upgradeVersions)
|
||||
$editionNames = [];
|
||||
foreach(['open', 'biz', 'max', 'ipd'] as $edition)
|
||||
{
|
||||
$editionNames = [];
|
||||
foreach(['open', 'biz', 'max', 'ipd'] as $edition)
|
||||
{
|
||||
$editionNames[$edition] = $edition == 'open' ? $lang->pmsName : $lang->{$edition . 'Name'};
|
||||
}
|
||||
$editionNames[$edition] = $edition == 'open' ? $lang->pmsName : $lang->{$edition . 'Name'};
|
||||
}
|
||||
|
||||
$toVersionEdition = is_numeric($toVersion[0]) ? 'open' : substr($toVersion, 0, 3);
|
||||
$toVersionName = $editionNames[$toVersionEdition] . str_ireplace($toVersionEdition, '', $toVersion);
|
||||
|
||||
$buildVersions = function() use ($toVersion, $upgradeVersions, $editionNames)
|
||||
{
|
||||
$versionIndex = 0;
|
||||
$toVersionIndex = array_search($toVersion, array_keys($upgradeVersions)) ?: 0;
|
||||
|
||||
@@ -161,7 +164,7 @@ div
|
||||
span
|
||||
(
|
||||
setClass('text-lg font-medium'),
|
||||
sprintf($lang->upgrade->changeTips, $editionName . str_ireplace($config->edition, '', $upgradeVersions[$toVersion]))
|
||||
sprintf($lang->upgrade->changeTips, $toVersionName)
|
||||
),
|
||||
span
|
||||
(
|
||||
|
||||
+15
-42
@@ -29,57 +29,30 @@ class upgradeZen extends upgrade
|
||||
$upgradeVersions = [];
|
||||
$currentEdition = $this->config->edition;
|
||||
$fromEdition = $this->upgrade->getEditionByVersion($fromVersion);
|
||||
$fromOpenVersion = $this->upgrade->getOpenVersion($fromVersion);
|
||||
$versions = $this->upgrade->getVersionsToUpdate($fromOpenVersion, $fromEdition);
|
||||
|
||||
if($currentEdition == $fromEdition)
|
||||
$mapped = false; // 标记是否匹配到付费版本
|
||||
foreach($versions as $openVersion => $chargedVersions)
|
||||
{
|
||||
/**
|
||||
* 版本一致,从来源版本开始升级。比如:
|
||||
* 开源版21.7.5升级到开源版21.7.8,升级版本列表为开源版21.7.6、开源版21.7.7和开源版21.7.8。
|
||||
* IPD版4.4升级到IPD版4.7,升级版本列表为IPD版4.5、IPD版4.6和IPD版4.7。
|
||||
*/
|
||||
foreach($this->lang->upgrade->fromVersions as $version => $label)
|
||||
{
|
||||
if($currentEdition == 'open' && !is_numeric($version[0])) continue;
|
||||
if($currentEdition != 'open' && strpos($version, $currentEdition) === false) continue;
|
||||
if(version_compare($fromVersion, $version, '>=')) continue;
|
||||
if(version_compare($fromVersion, $openVersion, '>=')) continue;
|
||||
|
||||
$upgradeVersions[$version] = $label;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$openVersion = $this->upgrade->getOpenVersion($fromVersion);
|
||||
$versionsMap = $this->config->upgrade->{$currentEdition . 'Version'};
|
||||
$mappedVersion = array_search($openVersion, $versionsMap);
|
||||
if($mappedVersion)
|
||||
if($currentEdition == 'open')
|
||||
{
|
||||
/**
|
||||
* 匹配到对应版本,从对应版本开始升级。
|
||||
*/
|
||||
foreach($this->lang->upgrade->fromVersions as $version => $label)
|
||||
{
|
||||
if($currentEdition == 'open' && !is_numeric($version[0])) continue;
|
||||
if($currentEdition != 'open' && strpos($version, $currentEdition) === false) continue;
|
||||
if(version_compare($mappedVersion, $version, '>')) continue;
|
||||
|
||||
$upgradeVersions[$version] = $label;
|
||||
}
|
||||
$upgradeVersions[$openVersion] = $this->lang->upgrade->fromVersions[$openVersion];
|
||||
}
|
||||
else
|
||||
{
|
||||
$toVersion = reset($versionsMap);
|
||||
if($fromEdition != 'open') $toVersion = array_search($toVersion, $this->config->upgrade->{$fromEdition . 'Version'});
|
||||
foreach($this->lang->upgrade->fromVersions as $version => $label)
|
||||
$mappedVersion = array_search($openVersion, $this->config->upgrade->{$currentEdition . 'Version'});
|
||||
if($mappedVersion)
|
||||
{
|
||||
if($fromEdition == 'open' && !is_numeric($version[0])) continue;
|
||||
if($fromEdition != 'open' && strpos($version, $fromEdition) === false) continue;
|
||||
if(version_compare($fromVersion, $version, '>=')) continue;
|
||||
if(version_compare($toVersion, $version, '<=')) break;
|
||||
|
||||
$upgradeVersions[$version] = $label;
|
||||
$mapped = true;
|
||||
$upgradeVersions[$mappedVersion] = $this->lang->upgrade->fromVersions[$mappedVersion];
|
||||
}
|
||||
elseif(!$mapped)
|
||||
{
|
||||
$upgradeVersions[$openVersion] = $this->lang->upgrade->fromVersions[$openVersion];
|
||||
}
|
||||
|
||||
foreach(array_keys($versionsMap) as $version) $upgradeVersions[$version] = $this->lang->upgrade->fromVersions[$version];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user