Fixed behavior of Title::invalidateCache.
authorTyler Anthony Romeo <tylerromeo@gmail.com>
Thu, 18 Apr 2013 17:32:19 +0000 (17:32 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 6 May 2013 00:21:25 +0000 (00:21 +0000)
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
includes/WikiPage.php
includes/actions/InfoAction.php
includes/job/jobs/RefreshLinksJob.php

index 70e8cd4..32f585e 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 8c00e1b..76d0166 100644 (file)
@@ -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 );
        }
 
        /**#@-*/
index a8905d8..49613e7 100644 (file)
@@ -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.
         *
index 57cad87..c5f87c5 100644 (file)
@@ -60,6 +60,7 @@ class RefreshLinksJob extends Job {
                }
 
                self::runForTitleInternal( $this->title, $revision, __METHOD__ );
+               InfoAction::invalidateCache( $this->title );
 
                return true;
        }