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