[pLog-svn] r4712 - in plog/branches/lifetype-1.2/class: action/admin file

reto at devel.lifetype.net reto at devel.lifetype.net
Sun Feb 11 09:00:59 EST 2007


Author: reto
Date: 2007-02-11 09:00:59 -0500 (Sun, 11 Feb 2007)
New Revision: 4712

Modified:
   plog/branches/lifetype-1.2/class/action/admin/admincleanupaction.class.php
   plog/branches/lifetype-1.2/class/file/file.class.php
Log:
support for directory exclusion (no the cleanup function doesn't remove .svn directories anymore, which I though is useful to keep the .htaccess versioned). maybe we should make the exclude list an admin option in 1.3...



Modified: plog/branches/lifetype-1.2/class/action/admin/admincleanupaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/admincleanupaction.class.php	2007-02-10 19:26:05 UTC (rev 4711)
+++ plog/branches/lifetype-1.2/class/action/admin/admincleanupaction.class.php	2007-02-11 14:00:59 UTC (rev 4712)
@@ -135,7 +135,7 @@
 			include_once( PLOG_CLASS_PATH."class/config/config.class.php" );
 			$config =& Config::getConfig();
 			$tmpFolder = $config->getValue( "temp_folder" );
-			$excludes = array('.htaccess');
+			$excludes = array('.htaccess', '.svn');
 			File::deleteDir( $tmpFolder, true, true, $excludes );
 			
 			$this->_message = $this->_locale->tr( "temp_folder_reset_ok" );

Modified: plog/branches/lifetype-1.2/class/file/file.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/file/file.class.php	2007-02-10 19:26:05 UTC (rev 4711)
+++ plog/branches/lifetype-1.2/class/file/file.class.php	2007-02-11 14:00:59 UTC (rev 4712)
@@ -240,7 +240,7 @@
 		  * @param onlyFiles If the recursive mode is enabled, setting this to 'true' will
 		  * force the method to only remove files but not folders. The directory will not be
 		  * removed but all the files included it in (and all subdirectories) will be.
-		  * @param excludedFiles If some files should not be removed (like .htaccess) they can be added
+		  * @param excludedFiles If some files or directories should not be removed (like .htaccess) they can be added
 		  * to this array. This operation is case sensitive!
 		  * @return True if successful or false otherwise
 		  * @static
@@ -265,7 +265,8 @@
 			$files = Glob::myGlob( $dirName, "*" );
 			foreach( $files as $file ) 
 			{
-				if( File::isDir( $file )) {
+				// check if the filename is in the list of files we must not delete
+				if( File::isDir( $file ) && array_search(basename( $file ), $excludedFiles) === false) {
 					// perform a recursive call if we were allowed to do so
 					if( $recursive ) {
 						File::deleteDir( $file, $recursive, $onlyFiles );



More information about the pLog-svn mailing list