https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113441

Revision: 113441
Author:   aaron
Date:     2012-03-09 01:18:32 +0000 (Fri, 09 Mar 2012)
Log Message:
-----------
Disable file locking for thumbnail purging just as it already is with 
creation/updates (for performance).

Modified Paths:
--------------
    trunk/phase3/includes/filerepo/FileRepo.php
    trunk/phase3/includes/filerepo/file/ForeignAPIFile.php
    trunk/phase3/includes/filerepo/file/LocalFile.php

Modified: trunk/phase3/includes/filerepo/FileRepo.php
===================================================================
--- trunk/phase3/includes/filerepo/FileRepo.php 2012-03-09 01:14:41 UTC (rev 
113440)
+++ trunk/phase3/includes/filerepo/FileRepo.php 2012-03-09 01:18:32 UTC (rev 
113441)
@@ -735,9 +735,11 @@
         * 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 @@
                }
                // 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 ) {

Modified: trunk/phase3/includes/filerepo/file/ForeignAPIFile.php
===================================================================
--- trunk/phase3/includes/filerepo/file/ForeignAPIFile.php      2012-03-09 
01:14:41 UTC (rev 113440)
+++ trunk/phase3/includes/filerepo/file/ForeignAPIFile.php      2012-03-09 
01:18:32 UTC (rev 113441)
@@ -247,7 +247,7 @@
                }
 
                # 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 ) );
        }

Modified: trunk/phase3/includes/filerepo/file/LocalFile.php
===================================================================
--- trunk/phase3/includes/filerepo/file/LocalFile.php   2012-03-09 01:14:41 UTC 
(rev 113440)
+++ trunk/phase3/includes/filerepo/file/LocalFile.php   2012-03-09 01:18:32 UTC 
(rev 113441)
@@ -770,7 +770,7 @@
                }
 
                # 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 ) );
        }


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to