Put SiteList navigation ids into cache
authoraude <aude.wiki@gmail.com>
Mon, 17 Mar 2014 21:48:27 +0000 (22:48 +0100)
committerAude <aude.wiki@gmail.com>
Tue, 18 Mar 2014 15:11:41 +0000 (15:11 +0000)
These are ids used by extension(s) such as Wikibase
to add language links in the sidebar.

Bug: 62754
Change-Id: Ie21fc3ea500bd7de3c01a9d8ec05373f016f339a

includes/site/SiteList.php
tests/phpunit/includes/site/SiteListTest.php

index 1dd6b16..a7c196b 100644 (file)
@@ -297,7 +297,7 @@ class SiteList extends GenericArrayObject {
         * @var string A string uniquely identifying the version of the serialization structure,
         *             not including any sub-structures.
         */
-       const SERIAL_VERSION_ID = '2013-02-07';
+       const SERIAL_VERSION_ID = '2014-03-17';
 
        /**
         * Returns the version ID that identifies the serialization structure used by
@@ -327,6 +327,7 @@ class SiteList extends GenericArrayObject {
                        array(
                                'internalIds' => $this->byInternalId,
                                'globalIds' => $this->byGlobalId,
+                               'navigationIds' => $this->byNavigationId
                        )
                );
        }
@@ -345,6 +346,7 @@ class SiteList extends GenericArrayObject {
 
                $this->byInternalId = $serializationData['internalIds'];
                $this->byGlobalId = $serializationData['globalIds'];
+               $this->byNavigationId = $serializationData['navigationIds'];
 
                return $serializationData;
        }
index b41f647..61d0ace 100644 (file)
@@ -228,6 +228,13 @@ class SiteListTest extends MediaWikiTestCase {
                 */
                foreach ( $list as $site ) {
                        $this->assertTrue( $copy->hasInternalId( $site->getInternalId() ) );
+
+                       foreach( $site->getNavigationIds() as $navId ) {
+                               $this->assertTrue(
+                                       $copy->hasNavigationId( $navId ),
+                                       'unserialized data expects nav id ' . $navId . ' for site ' . $site->getGlobalId()
+                               );
+                       }
                }
        }
 }