From: Ori Livneh Date: Mon, 8 Feb 2016 23:23:05 +0000 (-0800) Subject: interwiki: Fix-up for I5a979f047031e X-Git-Tag: 1.31.0-rc.0~8040^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/pie.php?a=commitdiff_plain;h=7f7863a8a922a88fd19a938ee17f272de688b57d;p=lhc%2Fweb%2Fwiklou.git 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 --- 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; }