[pLog-svn] File::rename

paul at westbrooks.org paul at westbrooks.org
Wed May 3 20:49:03 GMT 2006


Hello,
   Another option is to use stat() to get the inode of the file and devic
number.

--Paul

> For relative paths, realpath() might help:
> http://fi2.php.net/manual/en/function.realpath.php.
>
> It's quite a complex issue, but checking for the version number and
> acting accordingly probably is the most sensible approach. The upload
> folder can be fetched via ini_get, for configuration key
> upload_tmp_dir
> (http://fi2.php.net/manual/en/ini.core.php#ini.upload-tmp-dir)
>
> oscar
>
> On 5/3/06, Jon Daley <plogworld at jon.limedaley.com> wrote:
>> 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
>> _______________________________________________
>> pLog-svn mailing list
>> pLog-svn at devel.lifetype.net
>> http://devel.lifetype.net/mailman/listinfo/plog-svn
>>
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://devel.lifetype.net/mailman/listinfo/plog-svn
>
>



More information about the pLog-svn mailing list