diff --git a/core/backend/Engine/LegacyHandler/LegacyHandler.php b/core/backend/Engine/LegacyHandler/LegacyHandler.php index d5a9e6d83..2c79014db 100644 --- a/core/backend/Engine/LegacyHandler/LegacyHandler.php +++ b/core/backend/Engine/LegacyHandler/LegacyHandler.php @@ -27,6 +27,7 @@ namespace App\Engine\LegacyHandler; +use App\Install\Service\InstallationUtilsTrait; use BeanFactory; use ControllerFactory; use RuntimeException; @@ -41,6 +42,8 @@ use User; */ abstract class LegacyHandler { + use InstallationUtilsTrait; + protected const MSG_LEGACY_BOOTSTRAP_FAILED = 'Running legacy entry point failed'; /** @@ -134,6 +137,11 @@ abstract class LegacyHandler define('sugarEntry', true); } + if (!$this->isAppInstalled($this->legacyDir)) { + global $installing; + $installing = true; + } + // Load in legacy /* @noinspection PhpIncludeInspection */ require_once 'include/MVC/preDispatch.php'; diff --git a/core/backend/Install/LegacyHandler/InstallHandler.php b/core/backend/Install/LegacyHandler/InstallHandler.php index 64a1a8f20..e4f888d37 100644 --- a/core/backend/Install/LegacyHandler/InstallHandler.php +++ b/core/backend/Install/LegacyHandler/InstallHandler.php @@ -105,6 +105,9 @@ class InstallHandler extends LegacyHandler { $this->switchSession($this->legacySessionName); chdir($this->legacyDir); + + global $installing; + $installing = true; } /** diff --git a/core/backend/Install/Service/Installation/InstallActionHandler.php b/core/backend/Install/Service/Installation/InstallActionHandler.php index c86614298..aba45b772 100644 --- a/core/backend/Install/Service/Installation/InstallActionHandler.php +++ b/core/backend/Install/Service/Installation/InstallActionHandler.php @@ -126,6 +126,9 @@ class InstallActionHandler implements ProcessHandlerInterface { $options = $process->getOptions(); + global $installing; + $installing = true; + $result = $this->runSteps($this->getContext($options['payload'] ?? [])); $this->setProcessData($process, $result); diff --git a/core/backend/Languages/LegacyHandler/AppStringsHandler.php b/core/backend/Languages/LegacyHandler/AppStringsHandler.php index 0032d9e62..2a0083fdf 100644 --- a/core/backend/Languages/LegacyHandler/AppStringsHandler.php +++ b/core/backend/Languages/LegacyHandler/AppStringsHandler.php @@ -113,6 +113,10 @@ class AppStringsHandler extends LegacyHandler return null; } + if (!$this->isInstalled()) { + return $this->getInstallAppStrings($language); + } + $this->init(); $enabledLanguages = get_languages(); @@ -157,6 +161,7 @@ class AppStringsHandler extends LegacyHandler $this->installHandler->initLegacy(); + /* @noinspection PhpIncludeInspection */ require_once 'include/utils.php'; $appStringsArray = load_install_language($language) ?? []; @@ -192,7 +197,6 @@ class AppStringsHandler extends LegacyHandler $moduleLanguage = return_module_language($language, $module, true); foreach ($languageKeys as $key) { - if (isset($moduleLanguage[$key])) { $appStringsArray[$key] = $moduleLanguage[$key]; } @@ -217,4 +221,12 @@ class AppStringsHandler extends LegacyHandler return $appStringsArray; } + + /** + * @return bool + */ + protected function isInstalled(): bool + { + return $this->installHandler->isAppInstalled($this->legacyDir); + } }