r108886 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108885‎ | r108886 | r108887 >
Date:00:50, 14 January 2012
Author:aaron
Status:ok
Tags:filebackend 
Comment:
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.
Modified paths:
  • /trunk/phase3/includes/filerepo/FileRepo.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/FileRepo.php
@@ -1083,18 +1083,14 @@
10841084 }
10851085 $this->initDeletedDir( $archiveDir );
10861086
1087 - if ( $backend->fileExists( array( 'src' => $archivePath ) ) ) {
1088 - $operations[] = array(
1089 - 'op' => 'delete',
1090 - 'src' => $srcPath
1091 - );
1092 - } else {
1093 - $operations[] = array(
1094 - 'op' => 'move',
1095 - 'src' => $srcPath,
1096 - 'dst' => $archivePath
1097 - );
1098 - }
 1087+ $operations[] = array(
 1088+ 'op' => 'move',
 1089+ 'src' => $srcPath,
 1090+ 'dst' => $archivePath,
 1091+ // We may have 2+ identical files being deleted,
 1092+ // all of which will map to the same destination file
 1093+ 'overwriteSame' => true
 1094+ );
10991095 }
11001096
11011097 // Move the files by execute the operations for each pair.

Status & tagging log