From: Aaron Schulz Date: Sat, 14 Jan 2012 00:50:18 +0000 (+0000) Subject: Fixed annoying bug in FileRepo::deleteBatch() when a file is deleted that has multipl... X-Git-Tag: 1.31.0-rc.0~25280 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=10b54c99f715457a37a7161bc6b8dc8535c5add8;p=lhc%2Fweb%2Fwiklou.git Fixed annoying bug in FileRepo::deleteBatch() when a file is deleted that has multiple identical versions. The operation would fail due to the file already existing. --- diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php index cd9b2bba4c..c770811ce6 100644 --- a/includes/filerepo/FileRepo.php +++ b/includes/filerepo/FileRepo.php @@ -1083,18 +1083,14 @@ class FileRepo { } $this->initDeletedDir( $archiveDir ); - if ( $backend->fileExists( array( 'src' => $archivePath ) ) ) { - $operations[] = array( - 'op' => 'delete', - 'src' => $srcPath - ); - } else { - $operations[] = array( - 'op' => 'move', - 'src' => $srcPath, - 'dst' => $archivePath - ); - } + $operations[] = array( + 'op' => 'move', + 'src' => $srcPath, + 'dst' => $archivePath, + // We may have 2+ identical files being deleted, + // all of which will map to the same destination file + 'overwriteSame' => true + ); } // Move the files by execute the operations for each pair.