* @file
*/
+use MediaWiki\Shell\Shell;
+
/**
* This is a class for holding configuration settings, particularly for
* multi-wiki sites.
* 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.
*/
return $default;
}
- $ret = call_user_func_array( $this->siteParamsCallback, [ $this, $wiki ] );
+ $ret = ( $this->siteParamsCallback )( $this, $wiki );
# Validate the returned value
if ( !is_array( $ret ) ) {
return $default;
} else {
$this->cfgCache[$wiki] = [];
}
- $retVal = 1;
- $cmd = wfShellWikiCmd(
+ $result = Shell::makeScriptCommand(
"$IP/maintenance/getConfiguration.php",
[
'--wiki', $wiki,
'--settings', implode( ' ', $settings ),
- '--format', 'PHP'
+ '--format', 'PHP',
]
- );
- // ulimit5.sh breaks this call
- $data = trim( wfShellExec( $cmd, $retVal, [], [ 'memory' => 0, 'filesize' => 0 ] ) );
- if ( $retVal != 0 || !strlen( $data ) ) {
- throw new MWException( "Failed to run getConfiguration.php." );
+ )
+ // limit.sh breaks this call
+ ->limits( [ 'memory' => 0, 'filesize' => 0 ] )
+ ->execute();
+
+ $data = trim( $result->getStdout() );
+ if ( $result->getExitCode() != 0 || !strlen( $data ) ) {
+ throw new MWException( "Failed to run getConfiguration.php: {$result->getStdout()}" );
}
$res = unserialize( $data );
if ( !is_array( $res ) ) {
public function loadFullData() {
if ( $this->fullLoadCallback && !$this->fullLoadDone ) {
- call_user_func( $this->fullLoadCallback, $this );
+ ( $this->fullLoadCallback )( $this );
$this->fullLoadDone = true;
}
}