r84398 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84397‎ | r84398 | r84399 >
Date:16:56, 20 March 2011
Author:reedy
Status:ok
Tags:
Comment:
Followup r84396 per CR

Don't reinvent the wheel
Modified paths:
  • /trunk/extensions/SiteMatrix/SiteMatrix_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SiteMatrix/SiteMatrix_body.php
@@ -250,19 +250,13 @@
251251 * @return void
252252 */
253253 public static function APIQuerySiteInfoGeneralInfo( $module, $results ) {
254 - global $wgDBname, $wgLanguageCode;
 254+ global $wgDBname, $wgConf;
255255
256256 $matrix = new SiteMatrix();
257257
258 - $db = $wgDBname;
259 - $lang = '';
260 - //Strip language from DB name, if existent it should be at the start
261 - if ( strpos( $wgDBname, $wgLanguageCode ) === 0 ) {
262 - $db = str_replace( $wgLanguageCode, '', $wgDBname );
263 - $lang = $wgLanguageCode;
264 - }
 258+ list( $site, $lang ) = $wgConf->siteFromDB( $wgDBname );
265259
266 - if ( $matrix->isClosed( $lang, $db ) ) {
 260+ if ( $matrix->isClosed( $lang, $site ) ) {
267261 $results['closed'] = '';
268262 }
269263

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r84396Fixup strpos logic, and swap setting of $lang (noticed it's wrong)...reedy16:47, 20 March 2011

Status & tagging log