diff options
author | ASchulz <aschulz@wikimedia.org> | 2013-03-20 16:25:05 -0700 |
---|---|---|
committer | Aaron Schulz <aschulz@wikimedia.org> | 2013-03-25 17:06:30 -0700 |
commit | c328cf6401ce100bb1ceb0c0257cd0334c281961 (patch) | |
tree | b30cac01bb064f76f21aab28a23b1707da229e68 /includes/filebackend/FSFileBackend.php | |
parent | 0f3d17edd4ef967930b31149123fabaef8276b59 (diff) | |
download | mediawikicore-c328cf6401ce100bb1ceb0c0257cd0334c281961.tar.gz mediawikicore-c328cf6401ce100bb1ceb0c0257cd0334c281961.zip |
[FileBackend] Cleanup behavior for coping/moving a file over itself.
* Previously, for doQuickOperations(), the default move function
would just delete the file if it was moved over itself. In fact,
the php-cloudfiles bindings have this same bug in its move function.
* For both copy and move, when the source and destination are the
same path, make sure that the headers get updated as specified.
This only applies for the 'overwrite' case (not 'overwriteSame').
* Fixed bad status for doQuickOperations() when copying a file over
itself using FSFileBackend.
* Clarified the documentation for 'overwriteSame' option.
* Renamed destSameAsSource to overwriteSameCase in FileOp for clarity.
Change-Id: I3f609d9413795c654de27958b1e807b1fc785f31
Diffstat (limited to 'includes/filebackend/FSFileBackend.php')
-rw-r--r-- | includes/filebackend/FSFileBackend.php | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/includes/filebackend/FSFileBackend.php b/includes/filebackend/FSFileBackend.php index c976998929b6..92fee8350bf4 100644 --- a/includes/filebackend/FSFileBackend.php +++ b/includes/filebackend/FSFileBackend.php @@ -319,7 +319,7 @@ class FSFileBackend extends FileBackendStore { $status->value = new FSFileOpHandle( $this, $params, 'Copy', $cmd, $dest ); } else { // immediate write $this->trapWarnings(); - $ok = copy( $source, $dest ); + $ok = ( $source === $dest ) ? true : copy( $source, $dest ); $this->untrapWarnings(); // In some cases (at least over NFS), copy() returns true when it fails if ( !$ok || ( filesize( $source ) !== filesize( $dest ) ) ) { @@ -383,7 +383,7 @@ class FSFileBackend extends FileBackendStore { $status->value = new FSFileOpHandle( $this, $params, 'Move', $cmd ); } else { // immediate write $this->trapWarnings(); - $ok = rename( $source, $dest ); + $ok = ( $source === $dest ) ? true : rename( $source, $dest ); $this->untrapWarnings(); clearstatcache(); // file no longer at source if ( !$ok ) { |