Brian Wolff has uploaded a new change for review.

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


Change subject: Backport purge upstream caches when deleting file assets.
......................................................................

Backport purge upstream caches when deleting file assets.

Bug: 51064
Change-Id: Ibf57e8f32d7dd04b8508a69706be5a40b49e5abd
---
M RELEASE-NOTES-1.20
M includes/filerepo/file/LocalFile.php
M includes/revisiondelete/RevisionDelete.php
3 files changed, 33 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/15/80515/1

diff --git a/RELEASE-NOTES-1.20 b/RELEASE-NOTES-1.20
index d4f399a..f74a03e 100644
--- a/RELEASE-NOTES-1.20
+++ b/RELEASE-NOTES-1.20
@@ -3,6 +3,12 @@
 Security reminder: MediaWiki does not require PHP's register_globals
 setting since version 1.2.0. If you have it on, turn it '''off''' if you can.
 
+== MediaWiki 1.20.7 ==
+
+This is not yet a release!
+
+=== Changes since 1.20.6 ===
+* (bug 51064) Purge upstream caches when deleting file assets.
 
 == MediaWiki 1.20.6 ==
 
diff --git a/includes/filerepo/file/LocalFile.php 
b/includes/filerepo/file/LocalFile.php
index 695c4e9..3d06322 100644
--- a/includes/filerepo/file/LocalFile.php
+++ b/includes/filerepo/file/LocalFile.php
@@ -1356,6 +1356,7 @@
         * @return FileRepoStatus object.
         */
        function delete( $reason, $suppress = false ) {
+               global $wgUseSquid;
                if ( $this->getRepo()->getReadOnlyReason() !== false ) {
                        return $this->readOnlyFatalStatus();
                }
@@ -1378,6 +1379,15 @@
                        $this->purgeOldThumbnails( $archiveName );
                }
 
+               if ( $wgUseSquid ) {
+                       // Purge the squid
+                       $purgeUrls = array();
+                       foreach ($archiveNames as $archiveName ) {
+                               $purgeUrls[] = $this->getArchiveUrl( 
$archiveName );
+                       }
+                       SquidUpdate::purge( $purgeUrls );
+               }
+
                return $status;
        }
 
@@ -1396,6 +1406,7 @@
         * @return FileRepoStatus object.
         */
        function deleteOld( $archiveName, $reason, $suppress = false ) {
+               global $wgUseSquid;
                if ( $this->getRepo()->getReadOnlyReason() !== false ) {
                        return $this->readOnlyFatalStatus();
                }
@@ -1413,6 +1424,11 @@
                        $this->purgeHistory();
                }
 
+               if ( $wgUseSquid ) {
+                       // Purge the squid
+                       SquidUpdate::purge( array( $this->getArchiveUrl( 
$archiveName ) ) );
+               }
+
                return $status;
        }
 
diff --git a/includes/revisiondelete/RevisionDelete.php 
b/includes/revisiondelete/RevisionDelete.php
index 6ceadff..cb89ac8 100644
--- a/includes/revisiondelete/RevisionDelete.php
+++ b/includes/revisiondelete/RevisionDelete.php
@@ -498,9 +498,20 @@
        }
 
        public function doPostCommitUpdates() {
+               global $wgUseSquid;
                $file = wfLocalFile( $this->title );
                $file->purgeCache();
                $file->purgeDescription();
+               $purgeUrls = array();
+               foreach ( $this->ids as $timestamp ) {
+                       $archiveName = $timestamp . '!' . 
$this->title->getDBkey();
+                       $file->purgeOldThumbnails( $archiveName );
+                       $purgeUrls[] = $file->getArchiveUrl( $archiveName );
+               }
+               if ( $wgUseSquid ) {
+                       // purge full images from cache
+                       SquidUpdate::purge( $purgeUrls );
+               }
                return Status::newGood();
        }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibf57e8f32d7dd04b8508a69706be5a40b49e5abd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: REL1_20
Gerrit-Owner: Brian Wolff <[email protected]>

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

Reply via email to