From d898a5fa8610e47f9b760886077393978a6666a5 Mon Sep 17 00:00:00 2001 From: Robin Pepermans Date: Thu, 21 Jul 2011 22:19:23 +0000 Subject: [PATCH] Fixes for r92538 & r92528: * use default null for $local * use foreach for database result --- includes/interwiki/Interwiki.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/includes/interwiki/Interwiki.php b/includes/interwiki/Interwiki.php index 6b2dbbb9df..880f79a289 100644 --- a/includes/interwiki/Interwiki.php +++ b/includes/interwiki/Interwiki.php @@ -201,7 +201,7 @@ class Interwiki { /** * Fetch all interwiki prefixes from interwiki cache * - * @param $local If set, limits output to local/non-local interwikis + * @param $local If not null, limits output to local/non-local interwikis * @return Array List of prefixes * @since 1.19 */ @@ -245,7 +245,7 @@ class Interwiki { list( $iw_local, $iw_url ) = explode( ' ', $row ); - if ( isset( $local ) && $local != $iw_local ) { + if ( $local !== null && $local != $iw_local ) { continue; } @@ -265,7 +265,7 @@ class Interwiki { /** * Fetch all interwiki prefixes from DB * - * @param $local If set, limits output to local/non-local interwikis + * @param $local If not null, limits output to local/non-local interwikis * @return Array List of prefixes * @since 1.19 */ @@ -274,7 +274,7 @@ class Interwiki { $where = array(); - if ( isset( $local ) ) { + if ( $local !== null ) { if ( $local == 1 ) { $where['iw_local'] = 1; } elseif ( $local == 0 ) { @@ -282,10 +282,15 @@ class Interwiki { } } - return $db->select( 'interwiki', + $res = $db->select( 'interwiki', array( 'iw_prefix', 'iw_url', 'iw_api', 'iw_wikiid', 'iw_local', 'iw_trans' ), $where, __METHOD__, array( 'ORDER BY' => 'iw_prefix' ) ); + $retval = array(); + foreach ( $res as $row ) { + $retval[] = (array)$row; + } + return $retval; } /** @@ -295,7 +300,7 @@ class Interwiki { * @return Array List of prefixes * @since 1.19 */ - public static function getAllPrefixes( $local ) { + public static function getAllPrefixes( $local = null ) { global $wgInterwikiCache; if ( $wgInterwikiCache ) { -- 2.20.1