Retrieve values configuration settings MediaWiki

2019-09-03 16:34发布

问题:

How can I retrieve the values of (all) MediaWiki configuration settings and show them in a wikipage for testing? A bit like phpinfo.

回答1:

Manual:GetConfiguration.php:

echo `php maintenance/getConfiguration.php --format vardump`;

Options:

Script specific parameters:
    --format: json, php, serialize, vardump
    --iregex: same as --regex but case insensitive
    --regex: regex to filter variables with
    --settings: Space-separated list of wg* variables


回答2:

You could use a method from this question to fetch all variables from DefaultSettings.php, and then loop through them to print out their results.

Maybe something like this:

global $IP;
$defaultSettingsFile = file_get_contents($IP . 'DeafultSettings.php'); 
preg_match_all('/\$[A-Za-z0-9-_]+/', $defaultSettingsFile, $param);
foreach( $param as $p ){
  echo "$p:  ${$p}\n";
}


标签: mediawiki