From a142a2e6813d52d999d91cec5fcf743310e5046f Mon Sep 17 00:00:00 2001
From: xue <>
Date: Thu, 1 Dec 2005 18:51:14 +0000
Subject:

---
 framework/Web/TAssetManager.php | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/framework/Web/TAssetManager.php b/framework/Web/TAssetManager.php
index 4dfcdf5b..3e7df967 100644
--- a/framework/Web/TAssetManager.php
+++ b/framework/Web/TAssetManager.php
@@ -67,6 +67,10 @@ class TAssetManager extends TComponent implements IModule
 	 * @var TApplication application instance
 	 */
 	private $_application;
+	/**
+	 * @var array published assets
+	 */
+	private $_published=array();
 
 	/**
 	 * Initializes the module.
@@ -158,7 +162,9 @@ class TAssetManager extends TComponent implements IModule
 	 */
 	public function publishFilePath($path,$checkTimestamp=false)
 	{
-		if(($fullpath=realpath($path))===false)
+		if(isset($this->_published[$path]))
+			return $this->_published[$path];
+		else if(($fullpath=realpath($path))===false)
 			return '';
 		else if(is_file($fullpath))
 		{
@@ -171,14 +177,16 @@ class TAssetManager extends TComponent implements IModule
 				if(!is_file($file) || @filemtime($file)<@filemtime($fullpath))
 					@copy($fullpath,$file);
 			}
-			return $this->_baseUrl.'/'.$dir.'/'.basename($fullpath);
+			$this->_published[$path]=$this->_baseUrl.'/'.$dir.'/'.basename($fullpath);
+			return $this->_published[$path];
 		}
 		else
 		{
 			$dir=md5($fullpath);
 			if(!is_dir($this->_basePath.'/'.$dir) || $checkTimestamp || $this->_application->getMode()!=='Performance')
 				$this->copyDirectory($fullpath,$this->_basePath.'/'.$dir);
-			return $this->_baseUrl.'/'.$dir;
+			$this->_published[$path]=$this->_baseUrl.'/'.$dir;
+			return $this->_published[$path];
 		}
 	}
 
-- 
cgit v1.2.3