Parent5446 has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/54207


Change subject: Add cache versioning to InfoAction.
......................................................................

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
---
M includes/actions/InfoAction.php
1 file changed, 5 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/07/54207/1

diff --git a/includes/actions/InfoAction.php b/includes/actions/InfoAction.php
index 1e312d7..95f08ac 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.
         *
@@ -178,9 +180,11 @@
 
                $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 );
                }

-- 
To view, visit https://gerrit.wikimedia.org/r/54207
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7fe4da351506d8b98490e9fbbeb51c2c081fc2a8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Parent5446 <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to