From: Robin Pepermans Date: Thu, 21 Jul 2011 22:19:23 +0000 (+0000) Subject: Fixes for r92538 & r92528: X-Git-Tag: 1.31.0-rc.0~28692 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=d898a5fa8610e47f9b760886077393978a6666a5;p=lhc%2Fweb%2Fwiklou.git Fixes for r92538 & r92528: * use default null for $local * use foreach for database result --- 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 ) {