X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FSiteConfiguration.php;h=7af80dcfd6e3746042c537c19f5a1b87e42a0f69;hb=65f12f7190442dcea96eb8d642ebbf8c39df1427;hp=1eaedc2e6e554406ba72541d38a5ed5b035e4c9a;hpb=56d45558b102349f3480a46819669407aa3be2d6;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/SiteConfiguration.php b/includes/SiteConfiguration.php index 1eaedc2e6e..7af80dcfd6 100644 --- a/includes/SiteConfiguration.php +++ b/includes/SiteConfiguration.php @@ -483,13 +483,13 @@ class SiteConfiguration { /** * Work out the site and language name from a database name - * @param string $db + * @param string $wiki Wiki ID * * @return array */ - public function siteFromDB( $db ) { + public function siteFromDB( $wiki ) { // Allow override - $def = $this->getWikiParams( $db ); + $def = $this->getWikiParams( $wiki ); if ( !is_null( $def['suffix'] ) && !is_null( $def['lang'] ) ) { return [ $def['suffix'], $def['lang'] ]; } @@ -499,15 +499,16 @@ class SiteConfiguration { foreach ( $this->suffixes as $altSite => $suffix ) { if ( $suffix === '' ) { $site = ''; - $lang = $db; + $lang = $wiki; break; - } elseif ( substr( $db, -strlen( $suffix ) ) == $suffix ) { + } elseif ( substr( $wiki, -strlen( $suffix ) ) == $suffix ) { $site = is_numeric( $altSite ) ? $suffix : $altSite; - $lang = substr( $db, 0, strlen( $db ) - strlen( $suffix ) ); + $lang = substr( $wiki, 0, strlen( $wiki ) - strlen( $suffix ) ); break; } } $lang = str_replace( '_', '-', $lang ); + return [ $site, $lang ]; } @@ -527,7 +528,7 @@ class SiteConfiguration { $multi = is_array( $settings ); $settings = (array)$settings; - if ( $wiki === wfWikiID() ) { // $wiki is this wiki + if ( WikiMap::isCurrentWikiId( $wiki ) ) { // $wiki is this wiki $res = []; foreach ( $settings as $name ) { if ( !preg_match( '/^wg[A-Z]/', $name ) ) {