* Retrieves a configuration setting for a given wiki.
* @param string $settingName ID of the setting name to retrieve
* @param string $wiki Wiki ID of the wiki in question.
- * @param string $suffix The suffix of the wiki in question.
+ * @param string|null $suffix The suffix of the wiki in question.
* @param array $params List of parameters. $.'key' is replaced by $value in all returned data.
* @param array $wikiTags The tags assigned to the wiki.
* @return mixed The value of the setting requested.
/**
* Gets all settings for a wiki
* @param string $wiki Wiki ID of the wiki in question.
- * @param string $suffix The suffix of the wiki in question.
+ * @param string|null $suffix The suffix of the wiki in question.
* @param array $params List of parameters. $.'key' is replaced by $value in all returned data.
* @param array $wikiTags The tags assigned to the wiki.
* @return array Array of settings requested.
* Retrieves a configuration setting for a given wiki, forced to a boolean.
* @param string $setting ID of the setting name to retrieve
* @param string $wiki Wiki ID of the wiki in question.
- * @param string $suffix The suffix of the wiki in question.
+ * @param string|null $suffix The suffix of the wiki in question.
* @param array $wikiTags The tags assigned to the wiki.
* @return bool The value of the setting requested.
*/
* Retrieves the value of a given setting, and places it in its corresponding global variable.
* @param string $setting ID of the setting name to retrieve
* @param string $wiki Wiki ID of the wiki in question.
- * @param string $suffix The suffix of the wiki in question.
+ * @param string|null $suffix The suffix of the wiki in question.
* @param array $params List of parameters. $.'key' is replaced by $value in all returned data.
* @param array $wikiTags The tags assigned to the wiki.
*/
/**
* Retrieves the values of all settings, and places them in their corresponding global variables.
* @param string $wiki Wiki ID of the wiki in question.
- * @param string $suffix The suffix of the wiki in question.
+ * @param string|null $suffix The suffix of the wiki in question.
* @param array $params List of parameters. $.'key' is replaced by $value in all returned data.
* @param array $wikiTags The tags assigned to the wiki.
*/
/**
* 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'] ];
}
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 ];
}
$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 ) ) {