+ Add helper::isCacheEnabled method.
This commit is contained in:
@@ -350,12 +350,28 @@ class helper extends baseHelper
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是内网。
|
||||
* Check is intranet.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isIntranet()
|
||||
{
|
||||
return !defined('USE_INTRANET') ? false : USE_INTRANET;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否启用缓存。
|
||||
* Check is enable cache.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isCacheEnabled()
|
||||
{
|
||||
if(isset($_GET['_nocace']) || isset($_SERVER['HTTP_X_ZT_REFRESH'])) return false;
|
||||
global $config;
|
||||
return $config->cache->enable;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -381,7 +381,7 @@ class block extends control
|
||||
$this->view->tutorialed = $this->loadModel('tutorial')->getTutorialed();
|
||||
|
||||
$cacheKey = 'welcomeBlockData';
|
||||
if($this->config->cache->enable and $this->cache->has($cacheKey))
|
||||
if(helper::isCacheEnabled() && $this->cache->has($cacheKey))
|
||||
{
|
||||
$data = $this->cache->get($cacheKey);
|
||||
}
|
||||
@@ -418,7 +418,7 @@ class block extends control
|
||||
*/
|
||||
public function contribute()
|
||||
{
|
||||
if($this->config->cache->enable && $this->cache->has('contributeBlockData'))
|
||||
if(helper::isCacheEnabled() && $this->cache->has('contributeBlockData'))
|
||||
{
|
||||
$data = $this->cache->get('contributeBlockData');
|
||||
}
|
||||
@@ -984,7 +984,7 @@ class block extends control
|
||||
}
|
||||
|
||||
$cacheKey = __FUNCTION__ . $status . $count . $excludedModel;
|
||||
if($this->config->cache->enable and $this->cache->has($cacheKey))
|
||||
if(helper::isCacheEnabled() && $this->cache->has($cacheKey))
|
||||
{
|
||||
$projects = $this->cache->get($cacheKey);
|
||||
}
|
||||
@@ -2037,7 +2037,7 @@ class block extends control
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
$pager = new pager(0, 3, 1);
|
||||
$cacheKey = __FUNCTION__;
|
||||
if($this->config->cache->enable and $this->cache->has($cacheKey))
|
||||
if(helper::isCacheEnabled() && $this->cache->has($cacheKey))
|
||||
{
|
||||
$this->app->loadLang('project');
|
||||
$projects = $this->cache->get($cacheKey);
|
||||
|
||||
@@ -166,7 +166,7 @@ class bug extends control
|
||||
|
||||
/* Get executions. */
|
||||
$cacheKey = "bugBrowse{$this->projectID}";
|
||||
if($this->config->cache->enable && $this->cache->has($cacheKey))
|
||||
if(helper::isCacheEnabled() && $this->cache->has($cacheKey))
|
||||
{
|
||||
$executions = $this->cache->get($cacheKey);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user