WordPress.org

Make WordPress Core

Ticket #12150: rename-2.patch

File rename-2.patch, 682 bytes (added by reaperhulk, 4 years ago)

svn diff version

  • class-wp-filesystem-direct.php

     
    205205        } 
    206206 
    207207        function move($source, $destination, $overwrite = false) { 
    208                 //Possible to use rename()? 
     208                if ( ! $overwrite && $this->exists($destination) ) 
     209                        return false; 
     210 
     211                //try using rename first.  if that fails (for example, source is read only) try copy 
     212                if (@rename($source, $destination)) 
     213                        return true; 
     214 
    209215                if ( $this->copy($source, $destination, $overwrite) && $this->exists($destination) ) { 
    210216                        $this->delete($source); 
    211217                        return true;