<?php
-
/*
* Created on Sep 25, 2006
*
* API for MediaWiki 1.8+
*
- * Copyright (C) 2006 Yuri Astrakhan <FirstnameLastname@gmail.com>
+ * Copyright (C) 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
require_once ('ApiQueryBase.php');
}
+/**
+ * A query action to return meta information about the wiki site.
+ *
+ * @addtogroup API
+ */
class ApiQuerySiteinfo extends ApiQueryBase {
public function __construct($query, $moduleName) {
- parent :: __construct($query, $moduleName);
+ parent :: __construct($query, $moduleName, 'si');
}
public function execute() {
- $siprop = null;
+ $prop = null;
extract($this->extractRequestParams());
- foreach ($siprop as $prop) {
- switch ($prop) {
+ foreach ($prop as $p) {
+ switch ($p) {
case 'general' :
- global $wgSitename, $wgVersion, $wgCapitalLinks;
+ global $wgSitename, $wgVersion, $wgCapitalLinks, $wgRightsCode, $wgRightsText;
$data = array ();
$mainPage = Title :: newFromText(wfMsgForContent('mainpage'));
$data['mainpage'] = $mainPage->getText();
$data['sitename'] = $wgSitename;
$data['generator'] = "MediaWiki $wgVersion";
$data['case'] = $wgCapitalLinks ? 'first-letter' : 'case-sensitive'; // 'case-insensitive' option is reserved for future
- $this->getResult()->addValue('query', $prop, $data);
+ if (isset($wgRightsCode))
+ $data['rightscode'] = $wgRightsCode;
+ $data['rights'] = $wgRightsText;
+ $this->getResult()->addValue('query', $p, $data);
break;
case 'namespaces' :
);
ApiResult :: setContent($data[$ns], $title);
}
- ApiResult :: setIndexedTagName($data, 'ns');
- $this->getResult()->addValue('query', $prop, $data);
+ $this->getResult()->setIndexedTagName($data, 'ns');
+ $this->getResult()->addValue('query', $p, $data);
break;
-
+
default :
- ApiBase :: dieDebug(__METHOD__, "Unknown siprop=$prop");
+ ApiBase :: dieDebug(__METHOD__, "Unknown prop=$p");
}
}
}
protected function getAllowedParams() {
return array (
- 'siprop' => array (
+ 'prop' => array (
ApiBase :: PARAM_DFLT => 'general',
ApiBase :: PARAM_ISMULTI => true,
ApiBase :: PARAM_TYPE => array (
protected function getParamDescription() {
return array (
- 'siprop' => array (
+ 'prop' => array (
'Which sysinfo properties to get:',
' "general" - Overall system information',
' "namespaces" - List of registered namespaces (localized)'
return __CLASS__ . ': $Id$';
}
}
-?>
\ No newline at end of file
+?>