From 7f7863a8a922a88fd19a938ee17f272de688b57d Mon Sep 17 00:00:00 2001 From: Ori Livneh Date: Mon, 8 Feb 2016 15:23:05 -0800 Subject: [PATCH] interwiki: Fix-up for I5a979f047031e Make Interwiki::getAllPrefixesCached() work when $wgInterwikiCache is set to a static array (rather than path to a CDB file). Follows I5a979f047031e. Bug: T122362 Change-Id: I003e055471747afdcc82440490456e03cc67cc1a --- includes/interwiki/Interwiki.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/includes/interwiki/Interwiki.php b/includes/interwiki/Interwiki.php index be16bcf0b5..d50e3811e5 100644 --- a/includes/interwiki/Interwiki.php +++ b/includes/interwiki/Interwiki.php @@ -281,18 +281,16 @@ class Interwiki { * @since 1.19 */ protected static function getAllPrefixesCached( $local ) { - global $wgInterwikiCache, $wgInterwikiScopes, $wgInterwikiFallbackSite; - static $db, $site; + global $wgInterwikiScopes, $wgInterwikiFallbackSite; + static $site; wfDebug( __METHOD__ . "()\n" ); $data = array(); try { - if ( !$db ) { - $db = CdbReader::open( $wgInterwikiCache ); - } /* Resolve site name */ if ( $wgInterwikiScopes >= 3 && !$site ) { - $site = $db->get( '__sites:' . wfWikiID() ); + $site = self::getCacheValue( '__sites:' . wfWikiID() ); + if ( $site == '' ) { $site = $wgInterwikiFallbackSite; } @@ -311,9 +309,9 @@ class Interwiki { $sources[] = wfWikiID(); foreach ( $sources as $source ) { - $list = $db->get( "__list:{$source}" ); + $list = self::getCacheValue( '__list:' . $source ); foreach ( explode( ' ', $list ) as $iw_prefix ) { - $row = $db->get( "{$source}:{$iw_prefix}" ); + $row = self::getCacheValue( "{$source}:{$iw_prefix}" ); if ( !$row ) { continue; } -- 2.20.1