Merge "Add cache versioning to InfoAction."
[lhc/web/wiklou.git] / includes / actions / InfoAction.php
index 2c0a875..7fc9033 100644 (file)
@@ -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.
         *
@@ -201,9 +203,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 );
                }