Opened 3 years ago

Closed 3 years ago

#12150 closed enhancement (fixed)

Improved move method for WP_Filesystem_Direct

Reported by: reaperhulk Owned by: dd32
Priority: normal Milestone: 3.0
Component: Filesystem Version:
Severity: normal Keywords: has-patch
Cc:

Description

WP_Filesystem_Direct currently uses the copy method to accomplish a move. Ideally it should attempt to use rename() first, then fall back to copy to preserve previous behavior. This handles the failure mode of the source being read only, so the copy succeeds to the new location and then the delete fails silently).

A preliminary patch is attached.

Attachments (2)

rename.patch (275 bytes) - added by reaperhulk 3 years ago.
rename-2.patch (682 bytes) - added by reaperhulk 3 years ago.
svn diff version

Download all attachments as: .zip

Change History (7)

  • Keywords has-patch added
  • Keywords needs-patch added; has-patch removed
  • Milestone changed from Unassigned to 3.0

Patch looks strange. I can't tell which file it's modifying and where.

Try using 'svn diff'.

svn diff version

  • Keywords has-patch added; needs-patch removed

My mistake, I was using just straight diff for it. New patch attached.

comment:4   dd323 years ago

Looks sane enough to me.

Pretty sure copy() needs to be used by the copy method as well.

comment:5   dd323 years ago

  • Resolution set to fixed
  • Status changed from new to closed

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

Note: See TracTickets for help on using tickets.