From 22eb569fb4f6d96d4a190604daeba738d9ed4eca Mon Sep 17 00:00:00 2001 From: Tyler Anthony Romeo Date: Mon, 6 May 2013 11:08:27 +1000 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: Ic12c66446c0d71f567dceb5d4630382ff41ad8bf --- includes/Title.php | 12 +----------- includes/WikiPage.php | 3 +++ includes/actions/InfoAction.php | 16 ++++++++++++++++ includes/job/jobs/RefreshLinksJob.php | 3 +++ 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/includes/Title.php b/includes/Title.php index 14915e58ed..c5f73f370c 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 b8f4911a6f..a3cb4b5474 100644 --- a/includes/WikiPage.php +++ b/includes/WikiPage.php @@ -2443,6 +2443,7 @@ class WikiPage implements Page, IDBAccessObject { } $this->mTitle->flushRestrictions(); + InfoAction::invalidateCache( $this->mTitle ); if ( $logAction == 'unprotect' ) { $logParams = array(); @@ -2913,6 +2914,7 @@ class WikiPage implements Page, IDBAccessObject { // File cache HTMLFileCache::clearFileCache( $title ); + InfoAction::invalidateCache( $title ); // Messages if ( $title->getNamespace() == NS_MEDIAWIKI ) { @@ -2955,6 +2957,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..7cd1f72ee6 100644 --- a/includes/actions/InfoAction.php +++ b/includes/actions/InfoAction.php @@ -55,6 +55,22 @@ 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 ) { + global $wgMemc; + // Clear page info. + $revision = WikiPage::factory( $title )->getRevision(); + if ( $revision !== null ) { + $memcKey = wfMemcKey( 'infoaction', $title->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..e9f017be97 100644 --- a/includes/job/jobs/RefreshLinksJob.php +++ b/includes/job/jobs/RefreshLinksJob.php @@ -96,6 +96,9 @@ class RefreshLinksJob extends Job { $updates = $content->getSecondaryDataUpdates( $title, null, false, $parserOutput ); DataUpdate::runUpdates( $updates ); + + InfoAction::invalidateCache( $title ); + wfProfileOut( $fname ); } } -- 2.20.1