[pLog-svn] r5209 - plog/branches/lifetype-1.2/class/file

Mark Wu markplace at gmail.com
Wed Mar 28 10:24:41 EDT 2007


Mmm ... I use pseduo code to explain.

The original logical:

==============
If $file isDir then
	deleteDir()

deleteFile($file)
==============

It will cause the $file delete two times. And PHP will show permission
denied in second deletetion.

So, we need to change it to

==============
If $file isDir then
	deleteDir()
else
	deleteFile($file)
==============

To avoid this problem.

Mark

> -----Original Message-----
> From: plog-svn-bounces at devel.lifetype.net 
> [mailto:plog-svn-bounces at devel.lifetype.net] On Behalf Of 
> Oscar Renalias
> Sent: Wednesday, March 28, 2007 10:15 PM
> To: plog-svn at devel.lifetype.net
> Subject: Re: [pLog-svn] r5209 - plog/branches/lifetype-1.2/class/file
> 
> What was the bug? I can't really see it in the commit...
> 
> On 28 Mar 2007, at 17:15, mark at devel.lifetype.net wrote:
> 
> > Author: mark
> > Date: 2007-03-28 10:15:40 -0400 (Wed, 28 Mar 2007) New 
> Revision: 5209
> >
> > Modified:
> >    plog/branches/lifetype-1.2/class/file/file.class.php
> > Log:
> > Fixed a bug of deleteDir()
> >
> > Modified: plog/branches/lifetype-1.2/class/file/file.class.php
> > ===================================================================
> > --- plog/branches/lifetype-1.2/class/file/file.class.php	
> 2007-03-28  
> > 10:44:26 UTC (rev 5208)
> > +++ plog/branches/lifetype-1.2/class/file/file.class.php	
> 2007-03-28  
> > 14:15:40 UTC (rev 5209)
> > @@ -272,12 +272,13 @@
> >  						
> File::deleteDir( $file, $recursive, $onlyFiles, $excludedFiles 
> > );
> >  					}
> >  				}
> > -
> > -				// check if the filename is in 
> the list of files we must not  
> > delete
> > -				if(array_search(basename( $file 
> ), $excludedFiles) === false) {
> > -				    // File::delete can remove 
> empty folders as well as files
> > -				    if( File::isReadable( $file )) {
> > -					    File::delete( $file );
> > +				else {
> > +					// check if the 
> filename is in the list of files we must not
> > delete
> > +					
> if(array_search(basename( $file ), $excludedFiles) === false) {
> > +					    // File::delete can 
> remove empty folders as well as files
> > +					    if( 
> File::isReadable( $file )) {
> > +						    
> File::delete( $file );
> > +						}
> >  					}
> >  				}
> >  			}
> >
> > _______________________________________________
> > pLog-svn mailing list
> > pLog-svn at devel.lifetype.net
> > http://limedaley.com/mailman/listinfo/plog-svn
> >
> 
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://limedaley.com/mailman/listinfo/plog-svn
> 



More information about the pLog-svn mailing list