From 4f02f5fbb7928aff11397b8c55295088b663ddb5 Mon Sep 17 00:00:00 2001 From: aude Date: Mon, 17 Mar 2014 22:48:27 +0100 Subject: [PATCH] Put SiteList navigation ids into cache 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 | 4 +++- tests/phpunit/includes/site/SiteListTest.php | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/includes/site/SiteList.php b/includes/site/SiteList.php index 1dd6b1630c..a7c196b45b 100644 --- a/includes/site/SiteList.php +++ b/includes/site/SiteList.php @@ -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; } diff --git a/tests/phpunit/includes/site/SiteListTest.php b/tests/phpunit/includes/site/SiteListTest.php index b41f647e90..61d0ace0d7 100644 --- a/tests/phpunit/includes/site/SiteListTest.php +++ b/tests/phpunit/includes/site/SiteListTest.php @@ -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() + ); + } } } } -- 2.20.1