From 7eb174f7bd071769ed0122aabc8550e8bd777fd7 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Sat, 14 Aug 2004 06:03:10 +0000 Subject: [PATCH] Added siteFromDB(), used in commandLine.inc --- includes/SiteConfiguration.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/includes/SiteConfiguration.php b/includes/SiteConfiguration.php index 84c7671dec..211e0a4c19 100644 --- a/includes/SiteConfiguration.php +++ b/includes/SiteConfiguration.php @@ -59,6 +59,20 @@ class SiteConfiguration { $this->extractGlobal( $varName, $wiki, $suffix, $params ); } } + + # Work out the site and language name from a database name + function siteFromDB( $db ) { + $site = NULL; + $lang = NULL; + foreach ( $this->suffixes as $suffix ) { + if ( substr( $db, -strlen( $suffix ) ) == $suffix ) { + $site = $suffix == 'wiki' ? 'wikipedia' : $suffix; + $lang = substr( $db, 0, strlen( $db ) - strlen( $suffix ) ); + break; + } + } + return array( $site, $lang ); + } } -- 2.20.1