Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/72769


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 targetting 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 unrevdel it.

It should be noted that this extra purging was added
for bug 30192, however since then most of the places
it was needed added other calls to do the purge.

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

Try purging
[[commons:File:Bearbeitungsstand_Denkmale_Österreichs_nach_Gemeinden_Bilder.svg]]
for an example of the performance issue this aims to fix.

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


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/69/72769/1

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: newchange
Gerrit-Change-Id: Ib399132cabe79fd2b4b23bad5708bfa50b282074
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff <[email protected]>

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

Reply via email to