From 57cca2333955c06189cf88e3f170297770347f6b Mon Sep 17 00:00:00 2001 From: "ctrlaltca@gmail.com" <> Date: Tue, 20 Sep 2011 14:41:32 +0000 Subject: small fix to previous commit --- framework/Web/UI/TClientScriptManager.php | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'framework/Web/UI/TClientScriptManager.php') diff --git a/framework/Web/UI/TClientScriptManager.php b/framework/Web/UI/TClientScriptManager.php index 0a673b5b..5ab0c428 100644 --- a/framework/Web/UI/TClientScriptManager.php +++ b/framework/Web/UI/TClientScriptManager.php @@ -220,14 +220,31 @@ class TClientScriptManager extends TApplicationComponent $packages=array_keys($this->_registeredPradoScripts); $base = Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::SCRIPT_PATH; list($path,$baseUrl)=$this->getPackagePathUrl($base); + $isDebug=$this->getApplication()->getMode()===TApplicationMode::Debug; foreach ($packages as $p) { foreach (self::$_pradoScripts[$p] as $dep) { foreach (self::$_pradoPackages[$dep] as $script) { - if (!in_array($url=$baseUrl.'/'.$script,$scripts)) - $scripts[]=$url; + if($isDebug) + { + if (!in_array($url=$baseUrl.'/'.$script,$scripts)) + $scripts[]=$url; + } else { + if (!in_array($url=$baseUrl.'/min/'.$script,$scripts)) + { + if(!is_file($filePath=$path.'/min/'.$script)) + { + $dirPath=dirname($filePath); + if(!is_dir($dirPath)) + mkdir($dirPath, PRADO_CHMOD, true); + file_put_contents($filePath, TJavaScript::JSMin(file_get_contents($base.'/'.$script))); + chmod($filePath, PRADO_CHMOD); + } + $scripts[]=$url; + } + } } } } -- cgit v1.2.3