From 286abc08bd7f7f3570b173c523cc8c03d112e9ec Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 9 Mar 2012 01:18:32 +0000 Subject: [PATCH] Disable file locking for thumbnail purging just as it already is with creation/updates (for performance). --- includes/filerepo/FileRepo.php | 7 ++++++- includes/filerepo/file/ForeignAPIFile.php | 2 +- 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 516b44854b..0dd5466bc8 100644 --- a/includes/filerepo/FileRepo.php +++ b/includes/filerepo/FileRepo.php @@ -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 ) { diff --git a/includes/filerepo/file/ForeignAPIFile.php b/includes/filerepo/file/ForeignAPIFile.php index e1350ae456..16828fa650 100644 --- a/includes/filerepo/file/ForeignAPIFile.php +++ b/includes/filerepo/file/ForeignAPIFile.php @@ -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 ) ); } diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index f37e4cc825..f1a29745fe 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -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 ) ); } -- 2.20.1