From a7abf71351e6b86012e370738754e5fa30a8936a Mon Sep 17 00:00:00 2001 From: Alexey Kachayev Date: Thu, 4 Feb 2010 19:17:03 +0000 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=B8=D1=81=D1=82=D0=B5=D0=BC=D0=B0=20?= =?UTF-8?q?=D0=B1=D0=BB=D0=BE=D0=BA=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=BF=D0=BE=D0=B2=D1=82=D0=BE=D1=80=D0=BD=D0=BE?= =?UTF-8?q?=D0=B9=20=D0=B8=D0=BD=D0=B8=D1=86=D0=B8=D0=B0=D0=BB=D0=B8=D0=B7?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D0=B8=20=D0=BC=D0=BE=D0=B4=D1=83=D0=BB=D0=B5?= =?UTF-8?q?=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- engine/classes/Engine.class.php | 3 ++- engine/classes/Module.class.php | 18 ++++++++++++++++++ engine/modules/viewer/Viewer.class.php | 15 ++------------- 3 files changed, 22 insertions(+), 14 deletions(-) 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'); } /**