Index: branches/REL1_3/phase3/includes/SiteConfiguration.php |
— | — | @@ -59,6 +59,20 @@ |
60 | 60 | $this->extractGlobal( $varName, $wiki, $suffix, $params ); |
61 | 61 | } |
62 | 62 | } |
| 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 | + } |
63 | 77 | } |
64 | 78 | |
65 | 79 | |