case 'statistics' :
$this->appendStatistics($p);
break;
+ case 'usergroups' :
+ $this->appendUserGroups($p);
+ break;
}
}
}
protected function appendGeneralInfo($property) {
- global $wgSitename, $wgVersion, $wgCapitalLinks, $wgRightsCode, $wgRightsText, $wgLanguageCode, $IP, $wgEnableWriteAPI;
+ global $wgSitename, $wgVersion, $wgCapitalLinks, $wgRightsCode, $wgRightsText, $wgLanguageCode, $IP, $wgEnableWriteAPI, $wgLang;
$data = array ();
$mainPage = Title :: newFromText(wfMsgForContent('mainpage'));
if ( $svn ) $data['rev'] = $svn;
$data['case'] = $wgCapitalLinks ? 'first-letter' : 'case-sensitive'; // 'case-insensitive' option is reserved for future
+
if (isset($wgRightsCode))
$data['rightscode'] = $wgRightsCode;
$data['rights'] = $wgRightsText;
$data['lang'] = $wgLanguageCode;
+ $data['fallback8bitEncoding'] = $wgLang->fallback8bitEncoding();
if ( $wgEnableWriteAPI )
$data['writeapi'] = '';
}
protected function appendDbReplLagInfo($property, $includeAll) {
- global $wgLoadBalancer, $wgShowHostnames;
+ global $wgShowHostnames;
$data = array();
if ($includeAll) {
if (!$wgShowHostnames)
$this->dieUsage('Cannot view all servers info unless $wgShowHostnames is true', 'includeAllDenied');
-
- global $wgDBservers;
- $lags = $wgLoadBalancer->getLagTimes();
+
+ $lb = wfGetLB();
+ $lags = $lb->getLagTimes();
foreach( $lags as $i => $lag ) {
$data[] = array (
- 'host' => $wgDBservers[$i]['host'],
+ 'host' => $lb->getServerName( $i ),
'lag' => $lag);
}
} else {
- list( $host, $lag ) = $wgLoadBalancer->getMaxLag();
+ list( $host, $lag ) = wfGetLB()->getMaxLag();
$data[] = array (
'host' => $wgShowHostnames ? $host : '',
'lag' => $lag);
$data['jobs'] = intval(SiteStats::jobs());
$this->getResult()->addValue('query', $property, $data);
}
-
+
+ protected function appendUserGroups($property) {
+ global $wgGroupPermissions;
+
+ $data = array ();
+ foreach ($wgGroupPermissions as $group => $permissions) {
+ $arr = array ('name' => $group, 'rights' => array_keys($permissions, true));
+ $this->getResult()->setIndexedTagName($arr['rights'], 'permission');
+ $data[] = $arr;
+ }
+
+ $this->getResult()->setIndexedTagName($data, 'group');
+ $this->getResult()->addValue('query', $property, $data);
+ }
+
public function getAllowedParams() {
return array (
'interwikimap',
'dbrepllag',
'statistics',
+ 'usergroups',
)),
'filteriw' => array (
' "statistics" - Returns site statistics',
' "interwikimap" - Returns interwiki map (optionally filtered)',
' "dbrepllag" - Returns database server with the highest replication lag',
+ ' "usergroups" - Returns user groups and the associated permissions',
),
'filteriw' => 'Return only local or only nonlocal entries of the interwiki map',
'showalldb' => 'List all database servers, not just the one lagging the most',