From: Tyler Anthony Romeo Date: Sun, 17 Mar 2013 04:39:40 +0000 (-0400) Subject: Add cache versioning to InfoAction. X-Git-Tag: 1.31.0-rc.0~18801^2 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=fedb594f14e08d6c16a84f145dcd02454d3899c3;p=lhc%2Fweb%2Fwiklou.git Add cache versioning to InfoAction. To avoid PHP notices, add a cache version key to the page count cache so that it is invalidated when the InfoAction cache format is changed. Bug: 43766 Change-Id: I7fe4da351506d8b98490e9fbbeb51c2c081fc2a8 --- diff --git a/includes/actions/InfoAction.php b/includes/actions/InfoAction.php index 7cd1f72ee6..f46314a175 100644 --- a/includes/actions/InfoAction.php +++ b/includes/actions/InfoAction.php @@ -28,6 +28,8 @@ * @ingroup Actions */ class InfoAction extends FormlessAction { + const CACHE_VERSION = '2013-03-17'; + /** * Returns the name of the action this object responds to. * @@ -194,9 +196,11 @@ class InfoAction extends FormlessAction { $memcKey = wfMemcKey( 'infoaction', sha1( $title->getPrefixedText() ), $this->page->getLatest() ); $pageCounts = $wgMemc->get( $memcKey ); - if ( $pageCounts === false ) { + $version = isset( $pageCounts['cacheversion'] ) ? $pageCounts['cacheversion'] : false; + if ( $pageCounts === false || $version !== self::CACHE_VERSION ) { // Get page information that would be too "expensive" to retrieve by normal means $pageCounts = self::pageCounts( $title ); + $pageCounts['cacheversion'] = self::CACHE_VERSION; $wgMemc->set( $memcKey, $pageCounts ); }