diff --git a/engine/classes/Engine.class.php b/engine/classes/Engine.class.php index 9c0a3537..b8a4daf4 100644 --- a/engine/classes/Engine.class.php +++ b/engine/classes/Engine.class.php @@ -190,8 +190,9 @@ class Engine extends Object { * Создаем объект модуля */ $oModule=new $sModuleNameClass($this); - if ($bInit or $sModuleName=='Cache') { + if (($bInit or $sModuleName=='Cache') and !$oModule->isInit()) { $oModule->Init(); + $oModule->SetInit(); } $this->aModules[$sModuleName]=$oModule; $tm2=microtime(true); diff --git a/engine/classes/Module.class.php b/engine/classes/Module.class.php index 03b63e98..0321ce88 100644 --- a/engine/classes/Module.class.php +++ b/engine/classes/Module.class.php @@ -70,5 +70,23 @@ abstract class Module extends Object { public function Shutdown() { } + + /** + * Возвращает значение флага инициализации + * + * @return bool + */ + public function isInit() { + return $this->bIsInit; + } + + /** + * Помечает модуль как инициализированный + * + * @return null + */ + public function SetInit() { + $this->bIsInit=true; + } } ?> \ No newline at end of file diff --git a/engine/modules/viewer/Viewer.class.php b/engine/modules/viewer/Viewer.class.php index 01217122..9f4415de 100644 --- a/engine/modules/viewer/Viewer.class.php +++ b/engine/modules/viewer/Viewer.class.php @@ -164,14 +164,7 @@ class LsViewer extends Module { * Инициализация модуля * */ - public function Init() { - /** - * Проверяем, не была ли уже проведена инициализация - */ - if($this->bIsInit) { - return ; - } - + public function Init() { $this->Hook_Run('viewer_init_start'); /** * Заголовок HTML страницы @@ -208,11 +201,7 @@ class LsViewer extends Module { * Получаем настройки JS, CSS файлов */ $this->InitFileParams(); - $this->sCacheDir = Config::Get('path.smarty.cache'); - /** - * Устанавливаем флаг инициализации - */ - $this->bIsInit=true; + $this->sCacheDir = Config::Get('path.smarty.cache'); } /**