diff options
author | ctrlaltca@gmail.com <> | 2011-09-20 14:41:32 +0000 |
---|---|---|
committer | ctrlaltca@gmail.com <> | 2011-09-20 14:41:32 +0000 |
commit | 57cca2333955c06189cf88e3f170297770347f6b (patch) | |
tree | 3a3cdaf8a452ca5f1deb69085c738bd0817db0ad | |
parent | 8dcab11beafb1a04b514a3beacc6113f29450d3c (diff) |
small fix to previous commit
-rw-r--r-- | framework/Web/UI/TClientScriptManager.php | 21 |
1 files changed, 19 insertions, 2 deletions
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; + } + } } } } |