diff --git a/application/Espo/Core/Console/Commands/Upgrade.php b/application/Espo/Core/Console/Commands/Upgrade.php index 876506ce89..7990fc57ec 100644 --- a/application/Espo/Core/Console/Commands/Upgrade.php +++ b/application/Espo/Core/Console/Commands/Upgrade.php @@ -154,8 +154,7 @@ class Upgrade implements Command fwrite(\STDOUT, "\n"); - $app = new \Espo\Core\Application(); - $currentVerison = $app->getContainer()->get('config')->get('version'); + $currentVerison = $this->getCurrentVersion(); fwrite(\STDOUT, "Upgrade is complete. Current version is {$currentVerison}.\n"); @@ -225,8 +224,7 @@ class Upgrade implements Command return; } - $app = new \Espo\Core\Application(); - $currentVerison = $app->getContainer()->get('config')->get('version'); + $currentVerison = $this->getCurrentVersion(); fwrite(\STDOUT, "Upgrade is complete. Current version is {$currentVerison}.\n"); @@ -420,4 +418,15 @@ class Upgrade implements Command return true; } + + protected function getCurrentVersion() + { + $configData = include "data/config.php"; + + if (!$configData) { + return null; + } + + return $configData['version'] ?? null; + } }