Fixed behavior of Title::invalidateCache.
authorTyler Anthony Romeo <tylerromeo@gmail.com>
Mon, 6 May 2013 01:08:27 +0000 (11:08 +1000)
committerAaron Schulz <aschulz@wikimedia.org>
Tue, 21 May 2013 17:41:42 +0000 (10:41 -0700)
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
includes/WikiPage.php
includes/actions/InfoAction.php
includes/job/jobs/RefreshLinksJob.php

index 14915e5..c5f73f3 100644 (file)
@@ -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;
        }
 
        /**
index b8f4911..a3cb4b5 100644 (file)
@@ -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 );
        }
 
        /**#@-*/
index a8905d8..7cd1f72 100644 (file)
@@ -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.
         *
index 57cad87..e9f017b 100644 (file)
@@ -96,6 +96,9 @@ class RefreshLinksJob extends Job {
 
                $updates = $content->getSecondaryDataUpdates( $title, null, false, $parserOutput );
                DataUpdate::runUpdates( $updates );
+
+               InfoAction::invalidateCache( $title );
+
                wfProfileOut( $fname );
        }
 }