* Add codes to control if it can be upgraded automatically or has a valid safe file.
This commit is contained in:
@@ -3149,6 +3149,28 @@ class baseRouter
|
||||
return strtolower(getenv('IS_CONTAINER')) == 'true';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check app if it can be upgraded automatically.
|
||||
*
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function canAutoUpgrade()
|
||||
{
|
||||
return strtolower(getenv('ZT_AUTO_UPGRADE')) == 'true';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check app if it need check safe file.
|
||||
*
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function hasValidSafeFile()
|
||||
{
|
||||
return strtolower(getenv('ZT_CHECK_SAFE_FILE')) == 'true';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get main file and ext files.
|
||||
*
|
||||
|
||||
@@ -2474,6 +2474,8 @@ EOF;
|
||||
{
|
||||
if($this->app->isContainer()) return false;
|
||||
|
||||
if($this->app->hasValidSafeFile()) return false;
|
||||
|
||||
if($this->app->getModuleName() == 'upgrade' and $this->session->upgrading) return false;
|
||||
|
||||
$statusFile = $this->app->getAppRoot() . 'www' . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'ok.txt';
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ $config->installedVersion = $common->loadModel('setting')->getVersion();
|
||||
if(!$app->session->upgrading && ($config->version[0] == $config->installedVersion[0] or (is_numeric($config->version[0]) and is_numeric($config->installedVersion[0]))) and version_compare($config->version, $config->installedVersion) <= 0) die(header('location: index.php'));
|
||||
|
||||
/* If run in container, upgrade automatically. */
|
||||
if($app->isContainer())
|
||||
if($app->isContainer() || $app->canAutoUpgrade())
|
||||
{
|
||||
$upgradeModel = $common->loadModel('upgrade');
|
||||
$alterSQL = $upgradeModel->checkConsistency();
|
||||
|
||||
Reference in New Issue
Block a user