1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-17 07:10:48 +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);
if ($bInit or $sModuleName=='Cache') {
if (($bInit or $sModuleName=='Cache') and !$oModule->isInit()) {
$oModule->Init();
$oModule->SetInit();
}
$this->aModules[$sModuleName]=$oModule;
$tm2=microtime(true);

View file

@ -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;
}
}
?>

View file

@ -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');
}
/**