jenkins-bot has submitted this change and it was merged.

Change subject: Don't purge thumbs for old versions of an image during 
?action=purge
......................................................................


Don't purge thumbs for old versions of an image during ?action=purge

This tends to become extremely expensive as the number of
oldversions of a file increase. It is also not generally
needed since ?action=purge is usually targeting the
current version (additionally old versions of the file
have fixed urls, so they're less likely to get out
of sync). If an old version does need to be purged, one
can revdel and un-revdel it.

It should be noted that this extra purging was added
for bug 30192. However, since that bug was fixed,
most of the places requiring purging of old thumbnails
have now done it directly instead of by relying on
$file->purgeCache. The exception being revision
deletion, which still assumes $file->purgeCache clears
the thumbnails of old versions of the file.

There's no real bug for this, but I kind of hijacked
bug 49362

Change-Id: Ib399132cabe79fd2b4b23bad5708bfa50b282074
---
M includes/filerepo/file/LocalFile.php
M includes/revisiondelete/RevisionDelete.php
2 files changed, 13 insertions(+), 7 deletions(-)

Approvals:
  Aaron Schulz: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/filerepo/file/LocalFile.php 
b/includes/filerepo/file/LocalFile.php
index 3be66d3..6e0769e 100644
--- a/includes/filerepo/file/LocalFile.php
+++ b/includes/filerepo/file/LocalFile.php
@@ -798,7 +798,9 @@
        }
 
        /**
-        * Purge the shared history (OldLocalFile) cache
+        * Purge the shared history (OldLocalFile) cache.
+        *
+        * @note This used to purge old thumbnails as well.
         */
        function purgeHistory() {
                global $wgMemc;
@@ -806,20 +808,20 @@
                $hashedName = md5( $this->getName() );
                $oldKey = $this->repo->getSharedCacheKey( 'oldfile', 
$hashedName );
 
-               // Must purge thumbnails for old versions too! bug 30192
-               foreach ( $this->getHistory() as $oldFile ) {
-                       $oldFile->purgeThumbnails();
-               }
-
                if ( $oldKey ) {
                        $wgMemc->delete( $oldKey );
                }
        }
 
        /**
-        * Delete all previously generated thumbnails, refresh metadata in 
memcached and purge the squid
+        * Delete all previously generated thumbnails, refresh metadata in 
memcached and purge the squid.
+        *
+        * @param Array $options An array potentially with the key 
forThumbRefresh.
+        *
+        * @note This used to purge old thumbnails by default as well, but 
doesn't anymore.
         */
        function purgeCache( $options = array() ) {
+               wfProfileIn( __METHOD__ );
                // Refresh metadata cache
                $this->purgeMetadataCache();
 
@@ -828,6 +830,7 @@
 
                // Purge squid cache for this file
                SquidUpdate::purge( array( $this->getURL() ) );
+               wfProfileOut( __METHOD__ );
        }
 
        /**
diff --git a/includes/revisiondelete/RevisionDelete.php 
b/includes/revisiondelete/RevisionDelete.php
index ac72276..135e31f 100644
--- a/includes/revisiondelete/RevisionDelete.php
+++ b/includes/revisiondelete/RevisionDelete.php
@@ -501,6 +501,9 @@
                $file = wfLocalFile( $this->title );
                $file->purgeCache();
                $file->purgeDescription();
+               foreach ( $this->ids as $timestamp ) {
+                       $file->purgeOldThumbnails( $timestamp . '!' . 
$this->title->getDBkey() );
+               }
                return Status::newGood();
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/72769
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib399132cabe79fd2b4b23bad5708bfa50b282074
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Brian Wolff <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to