* Fix upgrade error.

This commit is contained in:
sgm0422
2022-03-10 10:20:45 +08:00
parent 1748b61779
commit bc8e061128
+5 -6
View File
@@ -34,10 +34,9 @@ class upgradeModel extends model
* @access public
* @return array
*/
public function getVersionsToUpdate($openVersion)
public function getVersionsToUpdate($openVersion, $fromEdition)
{
$versions = array();
$edition = $this->config->edition;
/* Always update open. */
foreach($this->lang->upgrade->fromVersions as $version => $versionName)
@@ -46,21 +45,21 @@ class upgradeModel extends model
if(version_compare(str_replace('_', '.', $version), str_replace('_', '.', $openVersion)) < 0) continue;
$versions[$version] = array('pro' => array(), 'biz' => array(), 'max' => array());
}
if($edition == 'open') return $versions;
if($fromEdition == 'open') return $versions;
/* Update to pro|biz|max. */
foreach($this->config->upgrade->proVersion as $pro => $open)
{
if(isset($versions[$open])) $versions[$open]['pro'][] = $pro;
}
if($edition == 'pro') return $versions;
if($fromEdition == 'pro') return $versions;
/* Update to biz|max. */
foreach($this->config->upgrade->bizVersion as $biz => $open)
{
if(isset($versions[$open])) $versions[$open]['biz'][] = $biz;
}
if($edition != 'max') return $versions;
if($fromEdition == 'biz') return $versions;
/* Update to max. */
foreach($this->config->upgrade->maxVersion as $max => $open)
@@ -90,7 +89,7 @@ class upgradeModel extends model
/* Execute. */
$fromOpenVersion = is_numeric($fromVersion[0]) ? $fromVersion : $this->config->upgrade->{$fromEdition . 'Version'}[$fromVersion];
$versions = $this->getVersionsToUpdate($fromOpenVersion);
$versions = $this->getVersionsToUpdate($fromOpenVersion, $fromEdition);
foreach($versions as $openVersion => $chargedVersions)
{
$executeXuanxuan = false;