From fedb594f14e08d6c16a84f145dcd02454d3899c3 Mon Sep 17 00:00:00 2001 From: Tyler Anthony Romeo Date: Sun, 17 Mar 2013 00:39:40 -0400 Subject: [PATCH] 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 --- includes/actions/InfoAction.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 ); } -- 2.20.1