Make WordPress Core


Ignore:
Timestamp:
02/07/2010 02:15:27 AM (15 years ago)
Author:
dd32
Message:

Use rename() if possible in WP_Filesystem_Direct::move(). Props reaperhulk. Fixes #12150

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-filesystem-direct.php

    r12998 r13001  
    197197        if ( ! $overwrite && $this->exists($destination) )
    198198            return false;
     199
    199200        return copy($source, $destination);
    200201    }
    201202
    202203    function move($source, $destination, $overwrite = false) {
    203         //Possible to use rename()?
     204        if ( ! $overwrite && $this->exists($destination) )
     205            return false;
     206
     207        // try using rename first.  if that fails (for example, source is read only) try copy
     208        if ( @rename($source, $destination) )
     209            return true;
     210
    204211        if ( $this->copy($source, $destination, $overwrite) && $this->exists($destination) ) {
    205212            $this->delete($source);
Note: See TracChangeset for help on using the changeset viewer.