r113441 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113440‎ | r113441 | r113442 >
Date:01:18, 9 March 2012
Author:aaron
Status:ok
Tags:
Comment:
Disable file locking for thumbnail purging just as it already is with creation/updates (for performance).
Modified paths:
  • /trunk/phase3/includes/filerepo/FileRepo.php (modified) (history)
  • /trunk/phase3/includes/filerepo/file/ForeignAPIFile.php (modified) (history)
  • /trunk/phase3/includes/filerepo/file/LocalFile.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/file/LocalFile.php
@@ -770,7 +770,7 @@
771771 }
772772
773773 # Delete the thumbnails
774 - $this->repo->cleanupBatch( $purgeList );
 774+ $this->repo->cleanupBatch( $purgeList, FileRepo::SKIP_LOCKING );
775775 # Clear out the thumbnail directory if empty
776776 $this->repo->getBackend()->clean( array( 'dir' => $dir ) );
777777 }
Index: trunk/phase3/includes/filerepo/file/ForeignAPIFile.php
@@ -247,7 +247,7 @@
248248 }
249249
250250 # Delete the thumbnails
251 - $this->repo->cleanupBatch( $purgeList );
 251+ $this->repo->cleanupBatch( $purgeList, FileRepo::SKIP_LOCKING );
252252 # Clear out the thumbnail directory if empty
253253 $this->repo->getBackend()->clean( array( 'dir' => $dir ) );
254254 }
Index: trunk/phase3/includes/filerepo/FileRepo.php
@@ -735,9 +735,11 @@
736736 * It will try to delete each file, but ignores any errors that may occur.
737737 *
738738 * @param $pairs array List of files to delete
 739+ * @param $flags Integer: bitwise combination of the following flags:
 740+ * self::SKIP_LOCKING Skip any file locking when doing the deletions
739741 * @return void
740742 */
741 - public function cleanupBatch( $files ) {
 743+ public function cleanupBatch( $files, $flags = 0 ) {
742744 $operations = array();
743745 $sourceFSFilesToDelete = array(); // cleanup for disk source files
744746 foreach ( $files as $file ) {
@@ -767,6 +769,9 @@
768770 }
769771 // Actually delete files from storage...
770772 $opts = array( 'force' => true );
 773+ if ( $flags & self::SKIP_LOCKING ) {
 774+ $opts['nonLocking'] = true;
 775+ }
771776 $this->backend->doOperations( $operations, $opts );
772777 // Cleanup for disk source files...
773778 foreach ( $sourceFSFilesToDelete as $file ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r113443MFT r113441aaron01:24, 9 March 2012
r114374MFT r113412, r113441, r113601, r113617, r113782reedy16:57, 21 March 2012

Status & tagging log