Disable file locking for thumbnail purging just as it already is with creation/update...
authorAaron Schulz <aaron@users.mediawiki.org>
Fri, 9 Mar 2012 01:18:32 +0000 (01:18 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Fri, 9 Mar 2012 01:18:32 +0000 (01:18 +0000)
includes/filerepo/FileRepo.php
includes/filerepo/file/ForeignAPIFile.php
includes/filerepo/file/LocalFile.php

index 516b448..0dd5466 100644 (file)
@@ -735,9 +735,11 @@ class FileRepo {
         * It will try to delete each file, but ignores any errors that may occur.
         *
         * @param $pairs array List of files to delete
+        * @param $flags Integer: bitwise combination of the following flags:
+        *     self::SKIP_LOCKING      Skip any file locking when doing the deletions
         * @return void
         */
-       public function cleanupBatch( $files ) {
+       public function cleanupBatch( $files, $flags = 0 ) {
                $operations = array();
                $sourceFSFilesToDelete = array(); // cleanup for disk source files
                foreach ( $files as $file ) {
@@ -767,6 +769,9 @@ class FileRepo {
                }
                // Actually delete files from storage...
                $opts = array( 'force' => true );
+               if ( $flags & self::SKIP_LOCKING ) {
+                       $opts['nonLocking'] = true;
+               }
                $this->backend->doOperations( $operations, $opts );
                // Cleanup for disk source files...
                foreach ( $sourceFSFilesToDelete as $file ) {
index e1350ae..16828fa 100644 (file)
@@ -247,7 +247,7 @@ class ForeignAPIFile extends File {
                }
 
                # Delete the thumbnails
-               $this->repo->cleanupBatch( $purgeList );
+               $this->repo->cleanupBatch( $purgeList, FileRepo::SKIP_LOCKING );
                # Clear out the thumbnail directory if empty
                $this->repo->getBackend()->clean( array( 'dir' => $dir ) );
        }
index f37e4cc..f1a2974 100644 (file)
@@ -770,7 +770,7 @@ class LocalFile extends File {
                }
 
                # Delete the thumbnails
-               $this->repo->cleanupBatch( $purgeList );
+               $this->repo->cleanupBatch( $purgeList, FileRepo::SKIP_LOCKING );
                # Clear out the thumbnail directory if empty
                $this->repo->getBackend()->clean( array( 'dir' => $dir ) );
        }