[pLog-svn] r495 - plog/trunk/class/file

oscar at devel.plogworld.net oscar at devel.plogworld.net
Tue Dec 14 17:33:55 GMT 2004


Author: oscar
Date: 2004-12-14 17:33:54 +0000 (Tue, 14 Dec 2004)
New Revision: 495

Modified:
   plog/trunk/class/file/file.class.php
Log:
improved the File::delete and File::deleteDir so that they do not throw warnings when the file does not exist or it is not readable


Modified: plog/trunk/class/file/file.class.php
===================================================================
--- plog/trunk/class/file/file.class.php	2004-12-14 14:54:31 UTC (rev 494)
+++ plog/trunk/class/file/file.class.php	2004-12-14 17:33:54 UTC (rev 495)
@@ -199,6 +199,12 @@
 		 function deleteDir( $dirName, $recursive = false )
 		 {
 			 $log =& LoggerManager::getLogger( "File::createDir" );		 
+
+			// if the directory can't be read, then quit with an error
+			if( !File::isReadable( $dirName ) || !File::exists( $dirName )) {
+				$log->debug("file not readable, exiting...");			
+				return false;
+			}
 		 
 			// if it's not a file, let's get out of here and transfer flow
 			// to the right place...
@@ -207,12 +213,6 @@
 				return File::delete( $dirName );
 			}
 				
-			// if the directory can't be read, then quit with an error
-			if( !File::isReadable( $dirName )) {
-				$log->debug("file not readable, exiting...");			
-				return false;
-			}
-			
 			// Glob::myGlob is easier to use than Glob::glob, specially when we're
 			// relying on the native version... This improved version will automatically
 			// ignore things like "." and ".." for us, making it much easier!




More information about the pLog-svn mailing list