r84997 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84996‎ | r84997 | r84998 >
Date:04:21, 30 March 2011
Author:nikola
Status:ok
Tags:
Comment:
Use load balancer to read from foreign DB (hopefully), another minor fix
Modified paths:
  • /trunk/extensions/Interlanguage/Interlanguage.php (modified) (history)
  • /trunk/extensions/Interlanguage/InterlanguageExtension.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Interlanguage/InterlanguageExtension.php
@@ -1,10 +1,10 @@
22 <?php
33 /**
4 - * MediaWiki Interlanguage extension v1.4
 4+ * MediaWiki Interlanguage extension
55 * InterlanguageExtension class
66 *
77 * Copyright © 2008-2011 Nikola Smolenski <smolensk@eunet.rs> and others
8 - * @version 1.4
 8+ * @version 1.5
99 *
1010 * This program is free software; you can redistribute it and/or modify
1111 * it under the terms of the GNU General Public License as published by
@@ -90,15 +90,7 @@
9191 global $wgInterlanguageExtensionDB;
9292
9393 if( !$this->foreignDbr ) {
94 - $foreignDbrClass = 'Database' . ucfirst( $wgInterlanguageExtensionDB['dbType'] );
95 - $this->foreignDbr = new $foreignDbrClass(
96 - $wgInterlanguageExtensionDB['dbServer'],
97 - $wgInterlanguageExtensionDB['dbUser'],
98 - $wgInterlanguageExtensionDB['dbPassword'],
99 - $wgInterlanguageExtensionDB['dbName'],
100 - $wgInterlanguageExtensionDB['dbFlags'],
101 - $wgInterlanguageExtensionDB['tablePrefix']
102 - );
 94+ $this->foreignDbr = wfGetDB( DB_SLAVE, array(), $wgInterlanguageExtensionDB );
10395 }
10496
10597 list( $dbKey, $namespace ) = $this->getKeyNS( $param );
@@ -162,6 +154,8 @@
163155 function processLinks( $a, $param ) {
164156 global $wgInterlanguageExtensionInterwiki;
165157
 158+ // Be sure to set $res to bool false in case of failure
 159+ $res = false;
166160 if(isset($a['query']['pages']) && is_array($a['query']['pages'])) {
167161 $a = array_shift($a['query']['pages']);
168162 if( isset( $a['missing'] ) ) {
@@ -175,9 +169,6 @@
176170 $a = $a['langlinks'];
177171 if( is_array( $a ) ) {
178172 $res = true;
179 - } else {
180 - // Be sure to set $res to bool false in case of failure
181 - $res = false;
182173 }
183174 } else {
184175 // There are no links in the central wiki article, so we display nothing
Index: trunk/extensions/Interlanguage/Interlanguage.php
@@ -1,9 +1,9 @@
22 <?php
33 /**
4 - * MediaWiki Interlanguage extension v1.4
 4+ * MediaWiki Interlanguage extension
55 *
66 * Copyright © 2008-2011 Nikola Smolenski <smolensk@eunet.rs> and others
7 - * @version 1.4
 7+ * @version 1.5
88 *
99 * This program is free software; you can redistribute it and/or modify
1010 * it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@
3535 'name' => 'Interlanguage',
3636 'author' => 'Nikola Smolenski',
3737 'url' => 'http://www.mediawiki.org/wiki/Extension:Interlanguage',
38 - 'version' => '1.4',
 38+ 'version' => '1.5',
3939 'descriptionmsg' => 'interlanguage-desc',
4040 );
4141 $wgExtensionMessagesFiles['Interlanguage'] = dirname(__FILE__) . '/Interlanguage.i18n.php';

Status & tagging log