mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-17 07:10:48 +03:00
Система блокирования повторной инициализации модулей
This commit is contained in:
parent
c1053aba62
commit
a7abf71351
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -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');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue