From 10b54c99f715457a37a7161bc6b8dc8535c5add8 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Sat, 14 Jan 2012 00:50:18 +0000 Subject: [PATCH] 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. --- includes/filerepo/FileRepo.php | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) 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. -- 2.20.1