X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Ffilerepo%2Ffile%2FLocalFile.php;h=ffadca9f20a5acd5b3ab87facbf9cabb8b1d41ef;hb=6f7ee691edafd18c0524ca1b02aa6a1b434aaba0;hp=04d7a47aac8f0c72b6e49f57b80f5390f02a2cd4;hpb=a1b3311b494e742a4db2147f63b1639a4c59a5ae;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index 04d7a47aac..ffadca9f20 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -777,9 +777,9 @@ class LocalFile extends File { } # Delete the thumbnails - $this->repo->cleanupBatch( $purgeList, FileRepo::SKIP_LOCKING ); + $this->repo->quickPurgeBatch( $purgeList ); # Clear out the thumbnail directory if empty - $this->repo->getBackend()->clean( array( 'dir' => $dir ) ); + $this->repo->cleanDir( $dir ); } /** purgeDescription inherited */ @@ -2319,7 +2319,8 @@ class LocalFileMoveBatch { 'oldimage', array( 'oi_name' => $this->newName, - 'oi_archive_name = ' . $dbw->strreplace( 'oi_archive_name', $dbw->addQuotes( $this->oldName ), $dbw->addQuotes( $this->newName ) ), + 'oi_archive_name = ' . $dbw->strreplace( 'oi_archive_name', + $dbw->addQuotes( $this->oldName ), $dbw->addQuotes( $this->newName ) ), ), array( 'oi_name' => $this->oldName ), __METHOD__ @@ -2328,7 +2329,10 @@ class LocalFileMoveBatch { $affected = $dbw->affectedRows(); $total = $this->oldCount; $status->successCount += $affected; - $status->failCount += $total - $affected; + // Bug 34934: $total is based on files that actually exist. + // There may be more DB rows than such files, in which case $affected + // can be greater than $total. We use max() to avoid negatives here. + $status->failCount += max( 0, $total - $affected ); if ( $status->failCount ) { $status->error( 'imageinvalidfilename' ); }