From 840d142703025927bd2fc5ffd70fcf62b0dccb76 Mon Sep 17 00:00:00 2001 From: knut <> Date: Mon, 18 Jun 2007 20:25:38 +0000 Subject: fixed #654 --- HISTORY | 1 + framework/Exceptions/messages.txt | 1 + framework/Web/TAssetManager.php | 24 ++++++++++++++---------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/HISTORY b/HISTORY index 8ebd0a7f..b6784596 100644 --- a/HISTORY +++ b/HISTORY @@ -6,6 +6,7 @@ BUG: Ticket#650 - Fixed TMysqlMetaData bug about SHOW FULL TABLES (Qiang) BUG: Ticket#651 - TUserManager Roles names (from config) should be trimmed (Qiang) BUG: Ticket#652 - OFFSET must be specified together with LIMIT for TScaffoldView (Qiang) BUG: TWizard Sidebar using TDataListItemRenderer has error (Qiang) +BUG: Ticket#654 - TAssetManager::copyDirectory() do not run closedir on an invalid resource (Knut) ENH: Ticket#625 - Added @ to represent authenticated users in auth rules (Qiang) ENH: Ticket#631 - Make TQueue implement Countable as the other collection classes (Knut) ENH: Ticket#634 - Override __toString for TXmlElement and TXmlDocument (Knut) diff --git a/framework/Exceptions/messages.txt b/framework/Exceptions/messages.txt index da022afe..e2fc5dce 100644 --- a/framework/Exceptions/messages.txt +++ b/framework/Exceptions/messages.txt @@ -79,6 +79,7 @@ assetmanager_baseurl_unchangeable = TAssetManager.BaseUrl cannot be modified af assetmanager_filepath_invalid = TAssetManager is publishing an invalid file '{0}'. assetmanager_tarchecksum_invalid = TAssetManager is publishing a tar file with invalid checksum '{0}'. assetmanager_tarfile_invalid = TAssetManager is publishing an invalid tar file '{0}'. +assetmanager_source_directory_invalid = TAssetManager is copying an invalid directory '{0}'. cache_primary_duplicated = At most one primary cache module is allowed. {0} is trying to register as another primary cache. sqlitecache_extension_required = TSqliteCache requires SQLite PHP extension. diff --git a/framework/Web/TAssetManager.php b/framework/Web/TAssetManager.php index d0769a0a..c71ea449 100644 --- a/framework/Web/TAssetManager.php +++ b/framework/Web/TAssetManager.php @@ -258,20 +258,24 @@ class TAssetManager extends TModule @mkdir($dst); @chmod($dst, PRADO_CHMOD); } - $folder=@opendir($src); - while($file=@readdir($folder)) + if($folder=@opendir($src)) { - if($file==='.' || $file==='..' || $file==='.svn') - continue; - else if(is_file($src.'/'.$file)) + while($file=@readdir($folder)) { - if(@filemtime($dst.'/'.$file)<@filemtime($src.'/'.$file)) - @copy($src.'/'.$file,$dst.'/'.$file); + if($file==='.' || $file==='..' || $file==='.svn') + continue; + else if(is_file($src.'/'.$file)) + { + if(@filemtime($dst.'/'.$file)<@filemtime($src.'/'.$file)) + @copy($src.'/'.$file,$dst.'/'.$file); + } + else + $this->copyDirectory($src.'/'.$file,$dst.'/'.$file); } - else - $this->copyDirectory($src.'/'.$file,$dst.'/'.$file); + closedir($folder); + } else { + throw new TInvalidDataValueException('assetmanager_source_directory_invalid', $src); } - closedir($folder); } /** -- cgit v1.2.3