mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-29 04:55:02 +03:00
Исключено использование модуля Lang в модулях автозагрузки.
This commit is contained in:
parent
617ca93e4e
commit
0aefe445e2
|
@ -57,7 +57,7 @@ class Init {
|
||||||
*/
|
*/
|
||||||
public function InitAction() {
|
public function InitAction() {
|
||||||
if (!$this->oUserCurrent and Config::Get('general.close') and Router::GetAction()!='registration' and Router::GetAction()!='login') {
|
if (!$this->oUserCurrent and Config::Get('general.close') and Router::GetAction()!='registration' and Router::GetAction()!='login') {
|
||||||
Router::Action('login');
|
Router::Action('login');
|
||||||
}
|
}
|
||||||
$this->Hook_Run('init_action');
|
$this->Hook_Run('init_action');
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,7 @@ class Engine extends Object {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected function ShutdownModules() {
|
protected function ShutdownModules() {
|
||||||
foreach ($this->aModules as $sKey => $oModule) {
|
foreach ($this->aModules as $sKey => $oModule) {
|
||||||
$oModule->Shutdown();
|
$oModule->Shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ class Engine extends Object {
|
||||||
* @return unknown
|
* @return unknown
|
||||||
*/
|
*/
|
||||||
protected function LoadModule($sModuleName,$bInit=false) {
|
protected function LoadModule($sModuleName,$bInit=false) {
|
||||||
$tm1=microtime(true);
|
$tm1=microtime(true);
|
||||||
if ($this->isFileExists(Config::Get('path.root.engine')."/modules/".strtolower($sModuleName)."/".$sModuleName.".class.php")) {
|
if ($this->isFileExists(Config::Get('path.root.engine')."/modules/".strtolower($sModuleName)."/".$sModuleName.".class.php")) {
|
||||||
require_once(Config::Get('path.root.engine')."/modules/".strtolower($sModuleName)."/".$sModuleName.".class.php");
|
require_once(Config::Get('path.root.engine')."/modules/".strtolower($sModuleName)."/".$sModuleName.".class.php");
|
||||||
} elseif ($this->isFileExists(Config::Get('path.root.server')."/classes/modules/".strtolower($sModuleName)."/".$sModuleName.".class.php")) {
|
} elseif ($this->isFileExists(Config::Get('path.root.server')."/classes/modules/".strtolower($sModuleName)."/".$sModuleName.".class.php")) {
|
||||||
|
@ -176,7 +176,7 @@ class Engine extends Object {
|
||||||
$sClassName='Hook'.$aMatch[1];
|
$sClassName='Hook'.$aMatch[1];
|
||||||
$oHook=new $sClassName;
|
$oHook=new $sClassName;
|
||||||
$oHook->RegisterHook();
|
$oHook->RegisterHook();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir($hDir);
|
closedir($hDir);
|
||||||
|
@ -230,7 +230,7 @@ class Engine extends Object {
|
||||||
}
|
}
|
||||||
$sCmd='$result=$oModule->'.$aName[1].'('.$sArgs.');';
|
$sCmd='$result=$oModule->'.$aName[1].'('.$sArgs.');';
|
||||||
$oProfiler=ProfilerSimple::getInstance();
|
$oProfiler=ProfilerSimple::getInstance();
|
||||||
$iTimeId=$oProfiler->Start('callModule',$sModuleName.'->'.$aName[1].'()');
|
$iTimeId=$oProfiler->Start('callModule',$sModuleName.'->'.$aName[1].'()');
|
||||||
eval($sCmd);
|
eval($sCmd);
|
||||||
$oProfiler->Stop($iTimeId);
|
$oProfiler->Stop($iTimeId);
|
||||||
return $result;
|
return $result;
|
||||||
|
|
26
engine/modules/cache/Cache.class.php
vendored
26
engine/modules/cache/Cache.class.php
vendored
|
@ -76,14 +76,12 @@ class LsCache extends Module {
|
||||||
$this->oBackendCache = new Dklab_Cache_Backend_Profiler($oCahe,array($this,'CalcStats'));
|
$this->oBackendCache = new Dklab_Cache_Backend_Profiler($oCahe,array($this,'CalcStats'));
|
||||||
} elseif ($this->sCacheType==SYS_CACHE_TYPE_MEMORY) {
|
} elseif ($this->sCacheType==SYS_CACHE_TYPE_MEMORY) {
|
||||||
require_once('Zend/Cache/Backend/Memcached.php');
|
require_once('Zend/Cache/Backend/Memcached.php');
|
||||||
// Рефакторинг: переход на конфигурационные массивы
|
|
||||||
// $aConfigMem=include(DIR_SERVER_ROOT."/config/config.memcache.php");
|
|
||||||
$aConfigMem=Config::Get('memcache');
|
$aConfigMem=Config::Get('memcache');
|
||||||
|
|
||||||
$oCahe = new Dklab_Cache_Backend_MemcachedMultiload($aConfigMem);
|
$oCahe = new Dklab_Cache_Backend_MemcachedMultiload($aConfigMem);
|
||||||
$this->oBackendCache = new Dklab_Cache_Backend_TagEmuWrapper(new Dklab_Cache_Backend_Profiler($oCahe,array($this,'CalcStats')));
|
$this->oBackendCache = new Dklab_Cache_Backend_TagEmuWrapper(new Dklab_Cache_Backend_Profiler($oCahe,array($this,'CalcStats')));
|
||||||
} else {
|
} else {
|
||||||
throw new Exception($this->Lang_Get('system_error_cache_type').": ".$this->sCacheType." (file, memory)");
|
throw new Exception("Wrong type of caching: ".$this->sCacheType." (file, memory)");
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Дабы не засорять место протухшим кешем, удаляем его в случайном порядке, например 1 из 50 раз
|
* Дабы не засорять место протухшим кешем, удаляем его в случайном порядке, например 1 из 50 раз
|
||||||
|
@ -91,7 +89,6 @@ class LsCache extends Module {
|
||||||
if (rand(1,50)==33) {
|
if (rand(1,50)==33) {
|
||||||
$this->Clean(Zend_Cache::CLEANING_MODE_OLD);
|
$this->Clean(Zend_Cache::CLEANING_MODE_OLD);
|
||||||
}
|
}
|
||||||
//$this->Clean();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -101,7 +98,7 @@ class LsCache extends Module {
|
||||||
* @param string $sName
|
* @param string $sName
|
||||||
* @return unknown
|
* @return unknown
|
||||||
*/
|
*/
|
||||||
public function Get($sName) {//var_dump($sName);
|
public function Get($sName) {
|
||||||
if (!$this->bUseCache) {
|
if (!$this->bUseCache) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -123,8 +120,8 @@ class LsCache extends Module {
|
||||||
/**
|
/**
|
||||||
* псевдо поддержка мульти-запросов к кешу
|
* псевдо поддержка мульти-запросов к кешу
|
||||||
*
|
*
|
||||||
* @param unknown_type $aName
|
* @param array $aName
|
||||||
* @return unknown
|
* @return bool|array
|
||||||
*/
|
*/
|
||||||
public function multiGet($aName) {
|
public function multiGet($aName) {
|
||||||
if (count($aName)==0) {
|
if (count($aName)==0) {
|
||||||
|
@ -139,17 +136,14 @@ class LsCache extends Module {
|
||||||
}
|
}
|
||||||
$data=$this->oBackendCache->load($aKeys);
|
$data=$this->oBackendCache->load($aKeys);
|
||||||
if ($data and is_array($data)) {
|
if ($data and is_array($data)) {
|
||||||
//var_dump($data);
|
|
||||||
$aData=array();
|
$aData=array();
|
||||||
foreach ($data as $key => $value) {
|
foreach ($data as $key => $value) {
|
||||||
$aData[$aKv[$key]]=$value;
|
$aData[$aKv[$key]]=$value;
|
||||||
//var_dump($key);
|
|
||||||
if ($key==0) {
|
if ($key==0) {
|
||||||
//var_dump($aName);
|
//var_dump($aName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count($aData)>0) {
|
if (count($aData)>0) {
|
||||||
//var_dump($aData);
|
|
||||||
return $aData;
|
return $aData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,10 +164,10 @@ class LsCache extends Module {
|
||||||
/**
|
/**
|
||||||
* Записать значение в кеш
|
* Записать значение в кеш
|
||||||
*
|
*
|
||||||
* @param unknown_type $data
|
* @param mixed $data
|
||||||
* @param string $sName
|
* @param string $sName
|
||||||
* @param array $aTags
|
* @param array $aTags
|
||||||
* @param int $iTimeLife
|
* @param int $iTimeLife
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function Set($data,$sName,$aTags=array(),$iTimeLife=false) {
|
public function Set($data,$sName,$aTags=array(),$iTimeLife=false) {
|
||||||
|
@ -232,13 +226,11 @@ class LsCache extends Module {
|
||||||
}
|
}
|
||||||
if ($sMethod=='Dklab_Cache_Backend_Profiler::save') {
|
if ($sMethod=='Dklab_Cache_Backend_Profiler::save') {
|
||||||
$this->aStats['count_set']++;
|
$this->aStats['count_set']++;
|
||||||
}
|
}
|
||||||
//dump($sMethod);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function GetStats() {
|
public function GetStats() {
|
||||||
return $this->aStats;
|
return $this->aStats;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
|
@ -258,7 +258,7 @@ class LsViewer extends Module {
|
||||||
if ($this->TemplateExists($sTemplate)) {
|
if ($this->TemplateExists($sTemplate)) {
|
||||||
$this->oSmarty->display($sTemplate);
|
$this->oSmarty->display($sTemplate);
|
||||||
} else {
|
} else {
|
||||||
throw new Exception($this->Lang_Get('system_error_template').': '.$sTemplate);
|
throw new Exception('Can not find the template: '.$sTemplate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -439,7 +439,7 @@ class LsViewer extends Module {
|
||||||
/**
|
/**
|
||||||
* Считаем что тип не определен
|
* Считаем что тип не определен
|
||||||
*/
|
*/
|
||||||
throw new Exception($this->Lang_Get('system_error_template_block').': '.$sName);
|
throw new Exception('Can not find the block`s template: '.$sName);
|
||||||
return 'undefined';
|
return 'undefined';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue