From 3b4c514efa08b0a68885b1a920e48f670cd06e15 Mon Sep 17 00:00:00 2001 From: Tyler Anthony Romeo Date: Thu, 18 Apr 2013 17:32:19 +0000 Subject: [PATCH] Fixed behavior of Title::invalidateCache. Removed actions that should not be in Title::invalidateCache, specifically the clearing of the InfoAction cache, and added those actions to their appropriate locations. Added a new method InfoAction::invalidateCache that clears the cache for a given title. Bug: 46816 Change-Id: I38ac616d2e99fb339aca33425745368ba85b6350 --- includes/Title.php | 12 +----------- includes/WikiPage.php | 3 +++ includes/actions/InfoAction.php | 15 +++++++++++++++ includes/job/jobs/RefreshLinksJob.php | 1 + 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/includes/Title.php b/includes/Title.php index 70e8cd442f..32f585ea35 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -4504,18 +4504,8 @@ class Title { $method ); } ); - HTMLFileCache::clearFileCache( $this ); - // Clear page info. - $revision = WikiPage::factory( $this )->getRevision(); - if ( $revision !== null ) { - $memcKey = wfMemcKey( 'infoaction', $this->getPrefixedText(), $revision->getId() ); - $success = $wgMemc->delete( $memcKey ); - } else { - $success = true; - } - - return $success; + return true; } /** diff --git a/includes/WikiPage.php b/includes/WikiPage.php index 8c00e1b526..76d0166798 100644 --- a/includes/WikiPage.php +++ b/includes/WikiPage.php @@ -2437,6 +2437,7 @@ class WikiPage implements Page, IDBAccessObject { } $this->mTitle->flushRestrictions(); + InfoAction::invalidateCache( $this->mTitle ); if ( $logAction == 'unprotect' ) { $logParams = array(); @@ -2907,6 +2908,7 @@ class WikiPage implements Page, IDBAccessObject { // File cache HTMLFileCache::clearFileCache( $title ); + InfoAction::invalidateCache( $title ); // Messages if ( $title->getNamespace() == NS_MEDIAWIKI ) { @@ -2949,6 +2951,7 @@ class WikiPage implements Page, IDBAccessObject { // Clear file cache for this page only HTMLFileCache::clearFileCache( $title ); + InfoAction::invalidateCache( $title ); } /**#@-*/ diff --git a/includes/actions/InfoAction.php b/includes/actions/InfoAction.php index a8905d82fa..49613e74a8 100644 --- a/includes/actions/InfoAction.php +++ b/includes/actions/InfoAction.php @@ -55,6 +55,21 @@ class InfoAction extends FormlessAction { return false; } + /** + * Clear the info cache for a given Title. + * + * @since 1.22 + * @param Title $title Title to clear cache for + */ + public static function invalidateCache( Title $title ) { + // Clear page info. + $revision = WikiPage::factory( $title )->getRevision(); + if ( $revision !== null ) { + $memcKey = wfMemcKey( 'infoaction', $this->getPrefixedText(), $revision->getId() ); + $wgMemc->delete( $memcKey ); + } + } + /** * Shows page information on GET request. * diff --git a/includes/job/jobs/RefreshLinksJob.php b/includes/job/jobs/RefreshLinksJob.php index 57cad874ff..c5f87c57ac 100644 --- a/includes/job/jobs/RefreshLinksJob.php +++ b/includes/job/jobs/RefreshLinksJob.php @@ -60,6 +60,7 @@ class RefreshLinksJob extends Job { } self::runForTitleInternal( $this->title, $revision, __METHOD__ ); + InfoAction::invalidateCache( $this->title ); return true; } -- 2.20.1