[pLog-svn] File::rename

Jon Daley plogworld at jon.limedaley.com
Wed May 3 20:12:35 GMT 2006


File::rename (when fixing the php bug about renaming across partitions) 
now breaks in a different way.

function rename( $inFile, $outFile = null ){
   // In order to work around the bug in php versions older
   // than 4.3.3, where rename will not work across different
   // partitions, this will be a copy and delete of the original file

The problem is when the file is the same file!

And it is harder than checking if($inFile == $outFile)
because the path could be relative, but still point to the same
place.  I am not sure if there is a function that can compare
absolute and relative, or if there is a way to append the current
directory (and be careful to ignore directory//filename === 
directory/filename) problems.

Maybe we only do our fix if php is less 4.3.3, AND if the pathnames are 
different AND put a note somewhere that tells people to set their 
PHP_uploads directory to something different from the LifeType temp 
directory.  Hrm. I wonder if we have access to the php_upload directory 
variable - that might be an easy check if php_uploads == 
plog_config(temp_folder) don't do a rename.

Thoughts?

Original problem posted, here and submitter is on this mailing list.
http://forums.lifetype.net/viewtopic.php?t=4500



**************************************
Jon Daley
http://jon.limedaley.com/

He who hesitates is not only lost, but
several miles from the next freeway exit.
-- Nowlan's Theory


More information about the pLog-svn mailing list