diff --git a/application/utils.inc.php b/application/utils.inc.php index 022f863a04..eb41f22ff3 100644 --- a/application/utils.inc.php +++ b/application/utils.inc.php @@ -1319,6 +1319,16 @@ class utils return Session::Get('itop_env', ITOP_DEFAULT_ENV); } + /** + * @return string Absolute path to the folder into which the current environment has been compiled. + * The corresponding folder is created or cleaned upon code compilation + * @since 3.0.0 + */ + public static function GetCompiledEnvironmentPath(): string + { + return APPROOT . 'env-' . MetaModel::GetEnvironment() . '/'; + } + /** * @return string A path to a folder into which any module can store cache data * The corresponding folder is created or cleaned upon code compilation @@ -1327,6 +1337,7 @@ class utils { return APPROOT.'data/cache-'.MetaModel::GetEnvironment().'/'; } + /** * @return string A path to a folder into which any module can store log * @since 2.7.0 diff --git a/sources/application/WebPage/WebPage.php b/sources/application/WebPage/WebPage.php index 64f8790879..024fdbbbbe 100644 --- a/sources/application/WebPage/WebPage.php +++ b/sources/application/WebPage/WebPage.php @@ -216,7 +216,7 @@ class WebPage implements Page $this->bHasCollapsibleSection = false; $this->bPrintable = $bPrintable; // Note: JS dict. entries cannot be added to a page if current environment and config file aren't available yet. - $this->bAddJSDict = class_exists('\Dict') && file_exists(utils::GetConfigFilePath()); + $this->bAddJSDict = class_exists('\Dict') && is_dir(utils::GetCompiledEnvironmentPath()) && file_exists(utils::GetConfigFilePath()); $this->oContentLayout = new UIContentBlock(); $this->SetTemplateRelPath(static::DEFAULT_PAGE_TEMPLATE_REL_PATH);