1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-29 04:55:02 +03:00

Система блокирования повторной инициализации модулей

This commit is contained in:
Alexey Kachayev 2010-02-04 19:17:03 +00:00
parent c1053aba62
commit a7abf71351
3 changed files with 22 additions and 14 deletions

View file

@ -190,8 +190,9 @@ class Engine extends Object {
* Создаем объект модуля * Создаем объект модуля
*/ */
$oModule=new $sModuleNameClass($this); $oModule=new $sModuleNameClass($this);
if ($bInit or $sModuleName=='Cache') { if (($bInit or $sModuleName=='Cache') and !$oModule->isInit()) {
$oModule->Init(); $oModule->Init();
$oModule->SetInit();
} }
$this->aModules[$sModuleName]=$oModule; $this->aModules[$sModuleName]=$oModule;
$tm2=microtime(true); $tm2=microtime(true);

View file

@ -70,5 +70,23 @@ abstract class Module extends Object {
public function Shutdown() { public function Shutdown() {
} }
/**
* Возвращает значение флага инициализации
*
* @return bool
*/
public function isInit() {
return $this->bIsInit;
}
/**
* Помечает модуль как инициализированный
*
* @return null
*/
public function SetInit() {
$this->bIsInit=true;
}
} }
?> ?>

View file

@ -165,13 +165,6 @@ class LsViewer extends Module {
* *
*/ */
public function Init() { public function Init() {
/**
* Проверяем, не была ли уже проведена инициализация
*/
if($this->bIsInit) {
return ;
}
$this->Hook_Run('viewer_init_start'); $this->Hook_Run('viewer_init_start');
/** /**
* Заголовок HTML страницы * Заголовок HTML страницы
@ -209,10 +202,6 @@ class LsViewer extends Module {
*/ */
$this->InitFileParams(); $this->InitFileParams();
$this->sCacheDir = Config::Get('path.smarty.cache'); $this->sCacheDir = Config::Get('path.smarty.cache');
/**
* Устанавливаем флаг инициализации
*/
$this->bIsInit=true;
} }
/** /**