Merge "Add cache versioning to InfoAction."
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 5 Sep 2013 22:15:07 +0000 (22:15 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 5 Sep 2013 22:15:07 +0000 (22:15 +0000)
1  2 
includes/actions/InfoAction.php

@@@ -198,12 -194,13 +200,14 @@@ class InfoAction extends FormlessActio
                $title = $this->getTitle();
                $id = $title->getArticleID();
  
 -              $memcKey = wfMemcKey( 'infoaction', sha1( $title->getPrefixedText() ), $this->page->getLatest() );
 +              $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 );
                }