summaryrefslogtreecommitdiff
path: root/framework/Web/TAssetManager.php
diff options
context:
space:
mode:
authorxue <>2005-11-18 01:06:15 +0000
committerxue <>2005-11-18 01:06:15 +0000
commit9bbb7257d6d3da32c4fec2f575f2fd80497e47c7 (patch)
tree783e30081b6ca68ed89330344f67e8a450761a8e /framework/Web/TAssetManager.php
parentc9cbb1a2891543bff1c459af18c2c62f47a17d28 (diff)
Diffstat (limited to 'framework/Web/TAssetManager.php')
-rw-r--r--framework/Web/TAssetManager.php16
1 files changed, 10 insertions, 6 deletions
diff --git a/framework/Web/TAssetManager.php b/framework/Web/TAssetManager.php
index 4147ce2d..3b2131a5 100644
--- a/framework/Web/TAssetManager.php
+++ b/framework/Web/TAssetManager.php
@@ -56,6 +56,7 @@ class TAssetManager extends TComponent implements IModule
* @var boolean whether to use timestamp checking to ensure files are published with up-to-date versions.
*/
private $_checkTimestamp=false;
+ private $_application;
/**
* Initializes the module.
@@ -65,6 +66,7 @@ class TAssetManager extends TComponent implements IModule
*/
public function init($application,$config)
{
+ $this->_application=$application;
if($this->_basePath===null)
$this->_basePath=dirname($application->getRequest()->getPhysicalApplicationPath()).'/'.self::DEFAULT_BASEPATH;
if(!is_writable($this->_basePath) || !is_dir($this->_basePath))
@@ -167,18 +169,19 @@ class TAssetManager extends TComponent implements IModule
{
$dir=md5(dirname($fullpath));
$file=$this->_basePath.'/'.$dir.'/'.basename($fullpath);
-
- if(!is_file($file) || (($checkTimestamp || $this->_checkTimestamp) && filemtime($file)<filemtime($path)))
+ if(!is_file($file) || $checkTimestamp || $this->_application->getMode()!=='Performance')
{
- @mkdir($this->_basePath.'/'.$dir);
- @copy($fullpath,$file);
+ if(!is_dir($this->_basePath.'/'.$dir))
+ @mkdir($this->_basePath.'/'.$dir);
+ if(!is_file($file) || @filemtime($file)<@filemtime($fullpath))
+ @copy($fullpath,$file);
}
return $this->_baseUrl.'/'.$dir.'/'.basename($fullpath);
}
else
{
$dir=md5($fullpath);
- if(!is_dir($this->_basePath.'/'.$dir) || $checkTimestamp || $this->_checkTimestamp)
+ if(!is_dir($this->_basePath.'/'.$dir) || $checkTimestamp || $this->_application->getMode()!=='Performance')
$this->copyDirectory($fullpath,$this->_basePath.'/'.$dir);
return $this->_baseUrl.'/'.$dir;
}
@@ -193,7 +196,8 @@ class TAssetManager extends TComponent implements IModule
*/
protected function copyDirectory($src,$dst)
{
- @mkdir($dst);
+ if(!is_dir($dst))
+ @mkdir($dst);
$folder=@opendir($src);
while($file=@readdir($folder))
{