aboutsummaryrefslogtreecommitdiffstats
path: root/includes/filerepo/file/File.php
diff options
context:
space:
mode:
authorAaron Schulz <aschulz@wikimedia.org>2019-03-14 17:23:26 -0700
committerJames D. Forrester <jforrester@wikimedia.org>2019-08-06 13:45:27 -0700
commit35da1bbd7cb8b4414c4fbcf331473f1024bc638d (patch)
treef903765d437301b1bff67ebea4fd895ce64132d9 /includes/filerepo/file/File.php
parenta6b45d2a20c9be095431ac60ba0a4f5951b5f387 (diff)
downloadmediawikicore-35da1bbd7cb8b4414c4fbcf331473f1024bc638d.tar.gz
mediawikicore-35da1bbd7cb8b4414c4fbcf331473f1024bc638d.zip
Add small HtmlCacheUpdater service class to normalize purging code
The purge() method handles purging of both file cache and CDN, using a PRESEND deferred update. This avoids code duplication and missing file cache purge calls. Also: * Migrate HTMLCacheUpdate callers to just directly using HTMLCacheUpdateJob * Add HtmlFileCacheUpdate class and defer such updates just like with CDN * Simplify HTMLCacheUpdate constructor parameters * Remove BacklinkCache::clear() calls which do nothing since the backlink query does not actually happen until the job runs Change-Id: Ic453b189a40109a73a9426538608eea87a76befa
Diffstat (limited to 'includes/filerepo/file/File.php')
-rw-r--r--includes/filerepo/file/File.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php
index ee7ee6f90dcd..eca546494255 100644
--- a/includes/filerepo/file/File.php
+++ b/includes/filerepo/file/File.php
@@ -1453,7 +1453,7 @@ abstract class File implements IDBAccessObject {
$title = $this->getTitle();
if ( $title ) {
$title->invalidateCache();
- $title->purgeSquid();
+ MediaWikiServices::getInstance()->getHtmlCacheUpdater()->purge( $title );
}
}
@@ -1469,9 +1469,12 @@ abstract class File implements IDBAccessObject {
// Purge cache of all pages using this file
$title = $this->getTitle();
if ( $title ) {
- DeferredUpdates::addUpdate(
- new HTMLCacheUpdate( $title, 'imagelinks', 'file-purge' )
+ $job = HTMLCacheUpdateJob::newForBacklinks(
+ $title,
+ 'imagelinks',
+ [ 'causeAction' => 'file-purge' ]
);
+ JobQueueGroup::singleton()->lazyPush( $job );
}
}