r4741 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r4740‎ | r4741 | r4742 >
Date:06:11, 14 August 2004
Author:timstarling
Status:old
Tags:
Comment:
Added siteFromDB(), used in commandLine.inc
Modified paths:
  • /branches/REL1_3/phase3/includes/SiteConfiguration.php (modified) (history)

Diff [purge]

Index: branches/REL1_3/phase3/includes/SiteConfiguration.php
@@ -59,6 +59,20 @@
6060 $this->extractGlobal( $varName, $wiki, $suffix, $params );
6161 }
6262 }
 63+
 64+ # Work out the site and language name from a database name
 65+ function siteFromDB( $db ) {
 66+ $site = NULL;
 67+ $lang = NULL;
 68+ foreach ( $this->suffixes as $suffix ) {
 69+ if ( substr( $db, -strlen( $suffix ) ) == $suffix ) {
 70+ $site = $suffix == 'wiki' ? 'wikipedia' : $suffix;
 71+ $lang = substr( $db, 0, strlen( $db ) - strlen( $suffix ) );
 72+ break;
 73+ }
 74+ }
 75+ return array( $site, $lang );
 76+ }
6377 }
6478
6579

Status & tagging log