Use rename() if possible in WP_Filesystem_Direct::move(). Props reaperhulk. Fixes #12150
git-svn-id: http://svn.automattic.com/wordpress/trunk@13001 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
830e5e5316
commit
de63fc36f8
|
@ -196,11 +196,18 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
|||
function copy($source, $destination, $overwrite = false) {
|
||||
if ( ! $overwrite && $this->exists($destination) )
|
||||
return false;
|
||||
|
||||
return copy($source, $destination);
|
||||
}
|
||||
|
||||
function move($source, $destination, $overwrite = false) {
|
||||
//Possible to use rename()?
|
||||
if ( ! $overwrite && $this->exists($destination) )
|
||||
return false;
|
||||
|
||||
// try using rename first. if that fails (for example, source is read only) try copy
|
||||
if ( @rename($source, $destination) )
|
||||
return true;
|
||||
|
||||
if ( $this->copy($source, $destination, $overwrite) && $this->exists($destination) ) {
|
||||
$this->delete($source);
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue