Set installing flag

This commit is contained in:
Clemente Raposo 2021-09-27 19:20:15 +01:00
parent efdc1af8c4
commit dcd4bc2546
4 changed files with 27 additions and 1 deletions

View file

@ -27,6 +27,7 @@
namespace App\Engine\LegacyHandler; namespace App\Engine\LegacyHandler;
use App\Install\Service\InstallationUtilsTrait;
use BeanFactory; use BeanFactory;
use ControllerFactory; use ControllerFactory;
use RuntimeException; use RuntimeException;
@ -41,6 +42,8 @@ use User;
*/ */
abstract class LegacyHandler abstract class LegacyHandler
{ {
use InstallationUtilsTrait;
protected const MSG_LEGACY_BOOTSTRAP_FAILED = 'Running legacy entry point failed'; protected const MSG_LEGACY_BOOTSTRAP_FAILED = 'Running legacy entry point failed';
/** /**
@ -134,6 +137,11 @@ abstract class LegacyHandler
define('sugarEntry', true); define('sugarEntry', true);
} }
if (!$this->isAppInstalled($this->legacyDir)) {
global $installing;
$installing = true;
}
// Load in legacy // Load in legacy
/* @noinspection PhpIncludeInspection */ /* @noinspection PhpIncludeInspection */
require_once 'include/MVC/preDispatch.php'; require_once 'include/MVC/preDispatch.php';

View file

@ -105,6 +105,9 @@ class InstallHandler extends LegacyHandler
{ {
$this->switchSession($this->legacySessionName); $this->switchSession($this->legacySessionName);
chdir($this->legacyDir); chdir($this->legacyDir);
global $installing;
$installing = true;
} }
/** /**

View file

@ -126,6 +126,9 @@ class InstallActionHandler implements ProcessHandlerInterface
{ {
$options = $process->getOptions(); $options = $process->getOptions();
global $installing;
$installing = true;
$result = $this->runSteps($this->getContext($options['payload'] ?? [])); $result = $this->runSteps($this->getContext($options['payload'] ?? []));
$this->setProcessData($process, $result); $this->setProcessData($process, $result);

View file

@ -113,6 +113,10 @@ class AppStringsHandler extends LegacyHandler
return null; return null;
} }
if (!$this->isInstalled()) {
return $this->getInstallAppStrings($language);
}
$this->init(); $this->init();
$enabledLanguages = get_languages(); $enabledLanguages = get_languages();
@ -157,6 +161,7 @@ class AppStringsHandler extends LegacyHandler
$this->installHandler->initLegacy(); $this->installHandler->initLegacy();
/* @noinspection PhpIncludeInspection */
require_once 'include/utils.php'; require_once 'include/utils.php';
$appStringsArray = load_install_language($language) ?? []; $appStringsArray = load_install_language($language) ?? [];
@ -192,7 +197,6 @@ class AppStringsHandler extends LegacyHandler
$moduleLanguage = return_module_language($language, $module, true); $moduleLanguage = return_module_language($language, $module, true);
foreach ($languageKeys as $key) { foreach ($languageKeys as $key) {
if (isset($moduleLanguage[$key])) { if (isset($moduleLanguage[$key])) {
$appStringsArray[$key] = $moduleLanguage[$key]; $appStringsArray[$key] = $moduleLanguage[$key];
} }
@ -217,4 +221,12 @@ class AppStringsHandler extends LegacyHandler
return $appStringsArray; return $appStringsArray;
} }
/**
* @return bool
*/
protected function isInstalled(): bool
{
return $this->installHandler->isAppInstalled($this->legacyDir);
}
} }