diff options
Diffstat (limited to 'framework/Web')
-rw-r--r-- | framework/Web/Services/TPageService.php | 40 | ||||
-rw-r--r-- | framework/Web/UI/TThemeManager.php | 17 |
2 files changed, 12 insertions, 45 deletions
diff --git a/framework/Web/Services/TPageService.php b/framework/Web/Services/TPageService.php index 6c690046..bc921c0e 100644 --- a/framework/Web/Services/TPageService.php +++ b/framework/Web/Services/TPageService.php @@ -56,10 +56,6 @@ class TPageService extends TComponent implements IService */
private $_properties;
/**
- * @var integer cache expiration
- */
- private $_cacheExpire=-1;
- /**
* @var boolean whether service is initialized
*/
private $_initialized=false;
@@ -100,7 +96,7 @@ class TPageService extends TComponent implements IService if(is_array($arr))
{
list($pageConfig,$timestamp)=$arr;
- if($this->_cacheExpire<0)
+ if($application->getMode()!=='Performance')
{
// check to see if cache is the latest
$paths=explode('.',$this->_pagePath);
@@ -126,7 +122,7 @@ class TPageService extends TComponent implements IService $pageConfig=new TPageConfiguration;
$pageConfig->loadXmlElement($config,dirname($application->getConfigurationFile()),null);
$pageConfig->loadConfigurationFiles($this->_pagePath,$basePath);
- $cache->set(self::CONFIG_CACHE_PREFIX.$this->_pagePath,array($pageConfig,time()),$this->_cacheExpire<0?0:$this->_cacheExpire);
+ $cache->set(self::CONFIG_CACHE_PREFIX.$this->_pagePath,array($pageConfig,time()));
}
}
@@ -219,38 +215,6 @@ class TPageService extends TComponent implements IService }
/**
- * @return integer the expiration time of the configuration saved in cache,
- * -1 (default) ensures the cached configuration always catches up the latest configuration files,
- * 0 means never expire,
- * a number less or equal than 60*60*24*30 means the number of seconds that the value will remain valid.
- * a number greater than 60 means a UNIX timestamp after which the value will expire.
- */
- public function getCacheExpire()
- {
- return $this->_cacheExpire;
- }
-
- /**
- * Sets the expiration time of the configuration saved in cache.
- * TPageService will try to use cache to save parsed configuration files.
- * CacheExpire is used to control the caching policy.
- * If you have changed this property, make sure to clean up cache first.
- * @param integer the expiration time of the configuration saved in cache,
- * -1 (default) ensures the cached configuration always catches up the latest configuration files,
- * 0 means never expire,
- * a number less or equal than 60*60*24*30 means the number of seconds that the value will remain valid.
- * a number greater than 60 means a UNIX timestamp after which the value will expire.
- * @throws TInvalidOperationException if the service is already initialized
- */
- public function setCacheExpire($value)
- {
- if($this->_initialized)
- throw new TInvalidOperationException('pageservice_cacheexpire_unchangeable');
- else
- $this->_cacheExpire=TPropertyValue::ensureInteger($value);
- }
-
- /**
* @return string default page path to be served if no explicit page is request
*/
public function getDefaultPage()
diff --git a/framework/Web/UI/TThemeManager.php b/framework/Web/UI/TThemeManager.php index 5f347e8f..9b407b90 100644 --- a/framework/Web/UI/TThemeManager.php +++ b/framework/Web/UI/TThemeManager.php @@ -64,17 +64,20 @@ class TThemeManager extends TComponent implements IModule {
list($theme,$timestamp)=$array;
$cacheValid=true;
- if(($dir=opendir($themePath))===false)
- throw new TIOException('thememanager_themepath_invalid',$themePath);
- while(($file=readdir($dir))!==false)
+ if($this->_application->getMode()!=='Performance')
{
- if(basename($file,'.skin')!==$file && filemtime($themePath.'/'.$file)>$timestamp)
+ if(($dir=opendir($themePath))===false)
+ throw new TIOException('thememanager_themepath_invalid',$themePath);
+ while(($file=readdir($dir))!==false)
{
- $cacheValid=false;
- break;
+ if(basename($file,'.skin')!==$file && filemtime($themePath.'/'.$file)>$timestamp)
+ {
+ $cacheValid=false;
+ break;
+ }
}
+ closedir($dir);
}
- closedir($dir);
if($cacheValid)
return $theme;
}
|