diff options
author | Aaron Schulz <aaron@users.mediawiki.org> | 2012-03-09 01:18:32 +0000 |
---|---|---|
committer | Reedy <reedy@wikimedia.org> | 2012-03-22 22:10:20 +0000 |
commit | 6838e394fe6789c8d72c1fd582c545f2e3d85cc3 (patch) | |
tree | ca4b749efe904acc5f813da76d35b9fc60ef7d05 | |
parent | 11ea9d2a3a00e128075229634db2c2ab3525afb6 (diff) | |
download | mediawikicore-6838e394fe6789c8d72c1fd582c545f2e3d85cc3.tar.gz mediawikicore-6838e394fe6789c8d72c1fd582c545f2e3d85cc3.zip |
Disable file locking for thumbnail purging just as it already is with creation/updates (for performance).
Notes
Notes:
http://mediawiki.org/wiki/Special:Code/MediaWiki/113441
-rw-r--r-- | includes/filerepo/FileRepo.php | 7 | ||||
-rw-r--r-- | includes/filerepo/file/ForeignAPIFile.php | 2 | ||||
-rw-r--r-- | includes/filerepo/file/LocalFile.php | 2 |
3 files changed, 8 insertions, 3 deletions
diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php index 1ccbd46c2664..8d4f2bd98cfa 100644 --- a/includes/filerepo/FileRepo.php +++ b/includes/filerepo/FileRepo.php @@ -733,9 +733,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 ) { @@ -765,6 +767,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 ) { diff --git a/includes/filerepo/file/ForeignAPIFile.php b/includes/filerepo/file/ForeignAPIFile.php index af45e2d8c6d8..681544fda45e 100644 --- a/includes/filerepo/file/ForeignAPIFile.php +++ b/includes/filerepo/file/ForeignAPIFile.php @@ -245,7 +245,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 ) ); } diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index e6684df0cf33..0f8b47546d75 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -763,7 +763,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 ) ); } |