* (bug 10181) Support the XCache object caching mechanism [patch from Kurt Radwanski]
[lhc/web/wiklou.git] / includes / api / ApiQuerySiteinfo.php
index d78ca86..2931535 100644 (file)
@@ -1,12 +1,11 @@
 <?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
@@ -29,22 +28,27 @@ if (!defined('MEDIAWIKI')) {
        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();
@@ -52,7 +56,10 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                                        $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' :
@@ -65,19 +72,19 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                                                );
                                                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 (
@@ -90,7 +97,7 @@ class ApiQuerySiteinfo extends ApiQueryBase {
 
        protected function getParamDescription() {
                return array (
-                       'siprop' => array (
+                       'prop' => array (
                                'Which sysinfo properties to get:',
                                ' "general"    - Overall system information',
                                ' "namespaces" - List of registered namespaces (localized)'
@@ -110,4 +117,4 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                return __CLASS__ . ': $Id$';
        }
 }
-?>
\ No newline at end of file
+?>