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";
}