2006-09-26 01:44:13 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Created on Sep 25, 2006
|
|
|
|
|
*
|
|
|
|
|
* API for MediaWiki 1.8+
|
|
|
|
|
*
|
2007-05-20 23:31:44 +00:00
|
|
|
* Copyright (C) 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
|
2006-09-26 01:44:13 +00:00
|
|
|
*
|
|
|
|
|
* 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
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
|
*/
|
|
|
|
|
|
2008-07-04 09:21:11 +00:00
|
|
|
if( !defined('MEDIAWIKI') ) {
|
2006-09-26 01:44:13 +00:00
|
|
|
// Eclipse helper - will be ignored in production
|
2008-07-04 09:21:11 +00:00
|
|
|
require_once( 'ApiQueryBase.php' );
|
2006-09-26 01:44:13 +00:00
|
|
|
}
|
|
|
|
|
|
2007-04-20 08:55:14 +00:00
|
|
|
/**
|
2007-05-20 23:31:44 +00:00
|
|
|
* A query action to return meta information about the wiki site.
|
2008-04-14 07:45:50 +00:00
|
|
|
*
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
* @ingroup API
|
2007-04-20 08:55:14 +00:00
|
|
|
*/
|
2006-09-26 01:44:13 +00:00
|
|
|
class ApiQuerySiteinfo extends ApiQueryBase {
|
|
|
|
|
|
2008-07-04 09:21:11 +00:00
|
|
|
public function __construct( $query, $moduleName ) {
|
|
|
|
|
parent :: __construct( $query, $moduleName, 'si' );
|
2006-09-26 01:44:13 +00:00
|
|
|
}
|
|
|
|
|
|
2006-09-27 05:13:48 +00:00
|
|
|
public function execute() {
|
2007-06-14 05:18:58 +00:00
|
|
|
$params = $this->extractRequestParams();
|
2008-07-04 09:21:11 +00:00
|
|
|
foreach( $params['prop'] as $p )
|
2008-06-21 15:13:26 +00:00
|
|
|
{
|
2008-07-04 09:21:11 +00:00
|
|
|
switch ( $p )
|
2008-06-21 15:13:26 +00:00
|
|
|
{
|
2008-07-04 09:21:11 +00:00
|
|
|
case 'general':
|
|
|
|
|
$this->appendGeneralInfo( $p );
|
2006-09-26 01:44:13 +00:00
|
|
|
break;
|
2008-07-04 09:21:11 +00:00
|
|
|
case 'namespaces':
|
|
|
|
|
$this->appendNamespaces( $p );
|
2007-06-14 05:18:58 +00:00
|
|
|
break;
|
2008-07-04 09:21:11 +00:00
|
|
|
case 'namespacealiases':
|
|
|
|
|
$this->appendNamespaceAliases( $p );
|
2008-02-03 19:29:59 +00:00
|
|
|
break;
|
2008-07-04 09:21:11 +00:00
|
|
|
case 'specialpagealiases':
|
|
|
|
|
$this->appendSpecialPageAliases( $p );
|
2008-03-28 12:47:21 +00:00
|
|
|
break;
|
2008-10-26 13:57:19 +00:00
|
|
|
case 'magicwords':
|
|
|
|
|
$this->appendMagicWords( $p );
|
|
|
|
|
break;
|
2008-07-04 09:21:11 +00:00
|
|
|
case 'interwikimap':
|
|
|
|
|
$filteriw = isset( $params['filteriw'] ) ? $params['filteriw'] : false;
|
|
|
|
|
$this->appendInterwikiMap( $p, $filteriw );
|
2006-09-26 01:44:13 +00:00
|
|
|
break;
|
2008-07-04 09:21:11 +00:00
|
|
|
case 'dbrepllag':
|
|
|
|
|
$this->appendDbReplLagInfo( $p, $params['showalldb'] );
|
2007-07-07 04:53:07 +00:00
|
|
|
break;
|
2008-07-04 09:21:11 +00:00
|
|
|
case 'statistics':
|
|
|
|
|
$this->appendStatistics( $p );
|
2007-08-09 12:39:41 +00:00
|
|
|
break;
|
2008-07-04 09:21:11 +00:00
|
|
|
case 'usergroups':
|
|
|
|
|
$this->appendUserGroups( $p );
|
2008-04-03 14:33:36 +00:00
|
|
|
break;
|
2008-12-14 22:06:32 +00:00
|
|
|
case 'extensions':
|
|
|
|
|
$this->appendExtensions( $p );
|
|
|
|
|
break;
|
2008-06-21 15:13:26 +00:00
|
|
|
default :
|
2008-07-04 09:21:11 +00:00
|
|
|
ApiBase :: dieDebug( __METHOD__, "Unknown prop=$p" );
|
2006-09-26 01:44:13 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-07-04 09:21:11 +00:00
|
|
|
protected function appendGeneralInfo( $property ) {
|
|
|
|
|
global $wgSitename, $wgVersion, $wgCapitalLinks, $wgRightsCode, $wgRightsText, $wgContLang;
|
|
|
|
|
global $wgLanguageCode, $IP, $wgEnableWriteAPI, $wgLang, $wgLocaltimezone, $wgLocalTZoffset;
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-06-21 15:13:26 +00:00
|
|
|
$data = array();
|
2007-06-14 05:18:58 +00:00
|
|
|
$mainPage = Title :: newFromText(wfMsgForContent('mainpage'));
|
2008-02-24 18:36:16 +00:00
|
|
|
$data['mainpage'] = $mainPage->getPrefixedText();
|
2007-06-14 05:18:58 +00:00
|
|
|
$data['base'] = $mainPage->getFullUrl();
|
|
|
|
|
$data['sitename'] = $wgSitename;
|
|
|
|
|
$data['generator'] = "MediaWiki $wgVersion";
|
2007-10-06 02:30:00 +00:00
|
|
|
|
2008-07-04 09:21:11 +00:00
|
|
|
$svn = SpecialVersion::getSvnRevision( $IP );
|
|
|
|
|
if( $svn )
|
2008-06-21 15:13:26 +00:00
|
|
|
$data['rev'] = $svn;
|
2007-10-06 02:30:00 +00:00
|
|
|
|
2007-06-14 05:18:58 +00:00
|
|
|
$data['case'] = $wgCapitalLinks ? 'first-letter' : 'case-sensitive'; // 'case-insensitive' option is reserved for future
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-07-04 09:21:11 +00:00
|
|
|
if( isset( $wgRightsCode ) )
|
2007-06-14 05:18:58 +00:00
|
|
|
$data['rightscode'] = $wgRightsCode;
|
|
|
|
|
$data['rights'] = $wgRightsText;
|
2007-06-29 21:44:15 +00:00
|
|
|
$data['lang'] = $wgLanguageCode;
|
2008-07-04 09:21:11 +00:00
|
|
|
if( $wgContLang->isRTL() )
|
|
|
|
|
$data['rtl'] = '';
|
2008-03-28 13:12:47 +00:00
|
|
|
$data['fallback8bitEncoding'] = $wgLang->fallback8bitEncoding();
|
2008-06-21 15:13:26 +00:00
|
|
|
|
2008-07-04 09:21:11 +00:00
|
|
|
if( wfReadOnly() )
|
2008-06-21 15:13:26 +00:00
|
|
|
$data['readonly'] = '';
|
2008-07-04 09:21:11 +00:00
|
|
|
if( $wgEnableWriteAPI )
|
2008-03-04 17:29:05 +00:00
|
|
|
$data['writeapi'] = '';
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-07-04 09:21:11 +00:00
|
|
|
$tz = $wgLocaltimezone;
|
|
|
|
|
$offset = $wgLocalTZoffset;
|
|
|
|
|
if( is_null( $tz ) ) {
|
|
|
|
|
$tz = 'UTC';
|
|
|
|
|
$offset = 0;
|
|
|
|
|
} elseif( is_null( $offset ) ) {
|
|
|
|
|
$offset = 0;
|
|
|
|
|
}
|
|
|
|
|
$data['timezone'] = $tz;
|
|
|
|
|
$data['timeoffset'] = $offset;
|
|
|
|
|
|
2008-10-30 14:43:41 +00:00
|
|
|
$this->getResult()->addValue( 'query', $property, $data );
|
2007-06-14 05:18:58 +00:00
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-07-04 09:21:11 +00:00
|
|
|
protected function appendNamespaces( $property ) {
|
2008-12-16 23:57:21 +00:00
|
|
|
global $wgContLang;
|
2008-06-21 15:13:26 +00:00
|
|
|
$data = array();
|
2008-07-04 09:21:11 +00:00
|
|
|
foreach( $wgContLang->getFormattedNamespaces() as $ns => $title )
|
2008-06-21 15:13:26 +00:00
|
|
|
{
|
2008-07-04 09:21:11 +00:00
|
|
|
$data[$ns] = array(
|
2007-06-14 05:18:58 +00:00
|
|
|
'id' => $ns
|
|
|
|
|
);
|
2008-07-04 09:21:11 +00:00
|
|
|
ApiResult :: setContent( $data[$ns], $title );
|
2008-12-16 23:57:21 +00:00
|
|
|
$canonical = MWNamespace::getCanonicalName( $ns );
|
2008-12-16 17:19:05 +00:00
|
|
|
|
|
|
|
|
if( MWNamespace::hasSubpages( $ns ) )
|
2008-02-25 22:11:56 +00:00
|
|
|
$data[$ns]['subpages'] = '';
|
2008-12-16 17:19:05 +00:00
|
|
|
|
|
|
|
|
if( $canonical )
|
2008-12-18 15:00:07 +00:00
|
|
|
$data[$ns]['canonical'] = strtr($canonical, '_', ' ');
|
2007-06-14 05:18:58 +00:00
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-07-04 09:21:11 +00:00
|
|
|
$this->getResult()->setIndexedTagName( $data, 'ns' );
|
2008-10-30 14:43:41 +00:00
|
|
|
$this->getResult()->addValue( 'query', $property, $data );
|
2007-06-14 05:18:58 +00:00
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-07-04 09:21:11 +00:00
|
|
|
protected function appendNamespaceAliases( $property ) {
|
2008-02-03 19:29:59 +00:00
|
|
|
global $wgNamespaceAliases;
|
2008-06-21 15:13:26 +00:00
|
|
|
$data = array();
|
2008-07-04 09:21:11 +00:00
|
|
|
foreach( $wgNamespaceAliases as $title => $ns ) {
|
|
|
|
|
$item = array(
|
2008-02-03 19:29:59 +00:00
|
|
|
'id' => $ns
|
|
|
|
|
);
|
2008-07-04 09:21:11 +00:00
|
|
|
ApiResult :: setContent( $item, strtr( $title, '_', ' ' ) );
|
2008-02-03 19:29:59 +00:00
|
|
|
$data[] = $item;
|
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-07-04 09:21:11 +00:00
|
|
|
$this->getResult()->setIndexedTagName( $data, 'ns' );
|
2008-10-30 14:43:41 +00:00
|
|
|
$this->getResult()->addValue( 'query', $property, $data );
|
2008-02-03 19:29:59 +00:00
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-07-04 09:21:11 +00:00
|
|
|
protected function appendSpecialPageAliases( $property ) {
|
2008-03-28 12:47:21 +00:00
|
|
|
global $wgLang;
|
|
|
|
|
$data = array();
|
2008-07-04 09:21:11 +00:00
|
|
|
foreach( $wgLang->getSpecialPageAliases() as $specialpage => $aliases )
|
2008-03-28 12:47:21 +00:00
|
|
|
{
|
2008-07-04 09:21:11 +00:00
|
|
|
$arr = array( 'realname' => $specialpage, 'aliases' => $aliases );
|
|
|
|
|
$this->getResult()->setIndexedTagName( $arr['aliases'], 'alias' );
|
2008-03-28 12:47:21 +00:00
|
|
|
$data[] = $arr;
|
|
|
|
|
}
|
2008-07-04 09:21:11 +00:00
|
|
|
$this->getResult()->setIndexedTagName( $data, 'specialpage' );
|
2008-10-30 14:43:41 +00:00
|
|
|
$this->getResult()->addValue( 'query', $property, $data );
|
2008-03-28 12:47:21 +00:00
|
|
|
}
|
2008-10-26 13:57:19 +00:00
|
|
|
|
|
|
|
|
protected function appendMagicWords( $property ) {
|
|
|
|
|
global $wgContLang;
|
|
|
|
|
$data = array();
|
|
|
|
|
foreach($wgContLang->getMagicWords() as $magicword => $aliases)
|
|
|
|
|
{
|
|
|
|
|
$caseSensitive = array_shift($aliases);
|
|
|
|
|
$arr = array('name' => $magicword, 'aliases' => $aliases);
|
|
|
|
|
if($caseSensitive)
|
|
|
|
|
$arr['case-sensitive'] = '';
|
|
|
|
|
$this->getResult()->setIndexedTagName($arr['aliases'], 'alias');
|
|
|
|
|
$data[] = $arr;
|
|
|
|
|
}
|
|
|
|
|
$this->getResult()->setIndexedTagName($data, 'magicword');
|
2008-10-30 14:43:41 +00:00
|
|
|
$this->getResult()->addValue('query', $property, $data);
|
2008-10-26 13:57:19 +00:00
|
|
|
}
|
2008-03-28 12:47:21 +00:00
|
|
|
|
2008-07-04 09:21:11 +00:00
|
|
|
protected function appendInterwikiMap( $property, $filter ) {
|
2007-07-31 17:53:37 +00:00
|
|
|
$this->resetQueryParams();
|
2008-07-04 09:21:11 +00:00
|
|
|
$this->addTables( 'interwiki' );
|
|
|
|
|
$this->addFields( array( 'iw_prefix', 'iw_local', 'iw_url' ) );
|
2007-06-14 05:18:58 +00:00
|
|
|
|
2008-07-04 09:21:11 +00:00
|
|
|
if( $filter === 'local' )
|
|
|
|
|
$this->addWhere( 'iw_local = 1' );
|
|
|
|
|
elseif( $filter === '!local' )
|
|
|
|
|
$this->addWhere( 'iw_local = 0' );
|
2008-11-17 18:13:11 +00:00
|
|
|
elseif( $filter )
|
2008-07-04 09:21:11 +00:00
|
|
|
ApiBase :: dieDebug( __METHOD__, "Unknown filter=$filter" );
|
2007-06-14 05:18:58 +00:00
|
|
|
|
2008-07-04 09:21:11 +00:00
|
|
|
$this->addOption( 'ORDER BY', 'iw_prefix' );
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2007-06-14 05:18:58 +00:00
|
|
|
$db = $this->getDB();
|
2008-07-04 09:21:11 +00:00
|
|
|
$res = $this->select( __METHOD__ );
|
2007-06-14 05:18:58 +00:00
|
|
|
|
|
|
|
|
$data = array();
|
2008-05-10 10:49:26 +00:00
|
|
|
$langNames = Language::getLanguageNames();
|
2008-07-04 09:21:11 +00:00
|
|
|
while( $row = $db->fetchObject($res) )
|
2007-06-14 05:18:58 +00:00
|
|
|
{
|
2008-03-27 15:12:16 +00:00
|
|
|
$val = array();
|
2007-06-14 05:18:58 +00:00
|
|
|
$val['prefix'] = $row->iw_prefix;
|
2008-07-04 09:21:11 +00:00
|
|
|
if( $row->iw_local == '1' )
|
2007-06-14 05:18:58 +00:00
|
|
|
$val['local'] = '';
|
|
|
|
|
// $val['trans'] = intval($row->iw_trans); // should this be exposed?
|
2008-07-04 09:21:11 +00:00
|
|
|
if( isset( $langNames[$row->iw_prefix] ) )
|
2008-05-10 10:49:26 +00:00
|
|
|
$val['language'] = $langNames[$row->iw_prefix];
|
2007-06-14 05:18:58 +00:00
|
|
|
$val['url'] = $row->iw_url;
|
2008-03-27 15:12:16 +00:00
|
|
|
|
2007-06-14 05:18:58 +00:00
|
|
|
$data[] = $val;
|
|
|
|
|
}
|
2008-07-04 09:21:11 +00:00
|
|
|
$db->freeResult( $res );
|
2008-03-27 15:12:16 +00:00
|
|
|
|
2008-07-04 09:21:11 +00:00
|
|
|
$this->getResult()->setIndexedTagName( $data, 'iw' );
|
2008-10-30 14:43:41 +00:00
|
|
|
$this->getResult()->addValue( 'query', $property, $data );
|
2007-06-14 05:18:58 +00:00
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-07-04 09:21:11 +00:00
|
|
|
protected function appendDbReplLagInfo( $property, $includeAll ) {
|
2008-03-30 09:48:15 +00:00
|
|
|
global $wgShowHostnames;
|
2007-07-07 04:53:07 +00:00
|
|
|
$data = array();
|
2008-07-04 09:21:11 +00:00
|
|
|
if( $includeAll ) {
|
|
|
|
|
if ( !$wgShowHostnames )
|
2007-07-10 13:46:22 +00:00
|
|
|
$this->dieUsage('Cannot view all servers info unless $wgShowHostnames is true', 'includeAllDenied');
|
2008-04-08 20:24:31 +00:00
|
|
|
|
|
|
|
|
$lb = wfGetLB();
|
|
|
|
|
$lags = $lb->getLagTimes();
|
2007-07-07 04:53:07 +00:00
|
|
|
foreach( $lags as $i => $lag ) {
|
2008-07-04 09:21:11 +00:00
|
|
|
$data[] = array(
|
2008-04-08 20:24:31 +00:00
|
|
|
'host' => $lb->getServerName( $i ),
|
2008-07-04 09:21:11 +00:00
|
|
|
'lag' => $lag
|
|
|
|
|
);
|
2007-07-07 04:53:07 +00:00
|
|
|
}
|
|
|
|
|
} else {
|
2008-03-30 09:48:15 +00:00
|
|
|
list( $host, $lag ) = wfGetLB()->getMaxLag();
|
2008-07-04 09:21:11 +00:00
|
|
|
$data[] = array(
|
2007-07-10 13:46:22 +00:00
|
|
|
'host' => $wgShowHostnames ? $host : '',
|
2008-07-04 09:21:11 +00:00
|
|
|
'lag' => $lag
|
|
|
|
|
);
|
2008-04-14 07:45:50 +00:00
|
|
|
}
|
2007-07-07 04:53:07 +00:00
|
|
|
|
2008-10-30 14:43:41 +00:00
|
|
|
$result = $this->getResult();
|
|
|
|
|
$result->setIndexedTagName( $data, 'db' );
|
|
|
|
|
$result->addValue( 'query', $property, $data );
|
2008-04-14 07:45:50 +00:00
|
|
|
}
|
2007-06-14 05:18:58 +00:00
|
|
|
|
2008-07-04 09:21:11 +00:00
|
|
|
protected function appendStatistics( $property ) {
|
2008-06-21 15:13:26 +00:00
|
|
|
$data = array();
|
2008-07-04 09:21:11 +00:00
|
|
|
$data['pages'] = intval( SiteStats::pages() );
|
|
|
|
|
$data['articles'] = intval( SiteStats::articles() );
|
|
|
|
|
$data['views'] = intval( SiteStats::views() );
|
|
|
|
|
$data['edits'] = intval( SiteStats::edits() );
|
|
|
|
|
$data['images'] = intval( SiteStats::images() );
|
|
|
|
|
$data['users'] = intval( SiteStats::users() );
|
2008-10-22 12:16:24 +00:00
|
|
|
$data['activeusers'] = intval( SiteStats::activeUsers() );
|
2008-07-28 15:49:44 +00:00
|
|
|
$data['admins'] = intval( SiteStats::numberingroup('sysop') );
|
2008-07-04 09:21:11 +00:00
|
|
|
$data['jobs'] = intval( SiteStats::jobs() );
|
2008-10-30 14:43:41 +00:00
|
|
|
$this->getResult()->addValue( 'query', $property, $data );
|
2008-04-14 07:45:50 +00:00
|
|
|
}
|
2008-04-03 14:33:36 +00:00
|
|
|
|
2008-07-04 09:21:11 +00:00
|
|
|
protected function appendUserGroups( $property ) {
|
2008-04-03 14:33:36 +00:00
|
|
|
global $wgGroupPermissions;
|
2008-07-04 09:21:11 +00:00
|
|
|
$data = array();
|
|
|
|
|
foreach( $wgGroupPermissions as $group => $permissions ) {
|
|
|
|
|
$arr = array( 'name' => $group, 'rights' => array_keys( $permissions, true ) );
|
|
|
|
|
$this->getResult()->setIndexedTagName( $arr['rights'], 'permission' );
|
2008-04-03 14:33:36 +00:00
|
|
|
$data[] = $arr;
|
|
|
|
|
}
|
|
|
|
|
|
2008-07-04 09:21:11 +00:00
|
|
|
$this->getResult()->setIndexedTagName( $data, 'group' );
|
2008-10-30 14:43:41 +00:00
|
|
|
$this->getResult()->addValue( 'query', $property, $data );
|
2008-04-03 14:33:36 +00:00
|
|
|
}
|
|
|
|
|
|
2008-12-14 22:06:32 +00:00
|
|
|
protected function appendExtensions( $property ) {
|
|
|
|
|
global $wgExtensionCredits;
|
|
|
|
|
$data = array();
|
|
|
|
|
foreach ( $wgExtensionCredits as $type => $extensions ) {
|
|
|
|
|
foreach ( $extensions as $ext ) {
|
|
|
|
|
$ret = array();
|
|
|
|
|
$ret['type'] = $type;
|
|
|
|
|
if ( isset( $ext['name'] ) )
|
|
|
|
|
$ret['name'] = $ext['name'];
|
|
|
|
|
if ( isset( $ext['description'] ) )
|
|
|
|
|
$ret['description'] = $ext['description'];
|
|
|
|
|
if ( isset( $ext['descriptionmsg'] ) )
|
|
|
|
|
$ret['descriptionmsg'] = $ext['descriptionmsg'];
|
|
|
|
|
if ( isset( $ext['author'] ) ) {
|
|
|
|
|
$ret['author'] = is_array( $ext['author'] ) ?
|
|
|
|
|
implode( ', ', $ext['author' ] ) : $ext['author'];
|
|
|
|
|
}
|
|
|
|
|
if ( isset( $ext['version'] ) ) {
|
|
|
|
|
$ret['version'] = $ext['version'];
|
|
|
|
|
} elseif ( isset( $ext['svn-revision'] ) &&
|
|
|
|
|
preg_match( '/\$(?:Rev|LastChangedRevision|Revision): *(\d+)/',
|
|
|
|
|
$ext['svn-revision'], $m ) )
|
|
|
|
|
{
|
|
|
|
|
$ret['version'] = 'r' . $m[1];
|
|
|
|
|
}
|
|
|
|
|
$data[] = $ret;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->getResult()->setIndexedTagName( $data, 'ext' );
|
|
|
|
|
$this->getResult()->addValue( 'query', $property, $data );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2008-01-28 19:05:26 +00:00
|
|
|
public function getAllowedParams() {
|
2008-07-04 09:21:11 +00:00
|
|
|
return array(
|
|
|
|
|
'prop' => array(
|
2006-10-01 20:17:16 +00:00
|
|
|
ApiBase :: PARAM_DFLT => 'general',
|
|
|
|
|
ApiBase :: PARAM_ISMULTI => true,
|
2008-07-04 09:21:11 +00:00
|
|
|
ApiBase :: PARAM_TYPE => array(
|
2006-09-26 01:44:13 +00:00
|
|
|
'general',
|
2007-06-14 05:18:58 +00:00
|
|
|
'namespaces',
|
2008-02-03 19:29:59 +00:00
|
|
|
'namespacealiases',
|
2008-03-28 12:47:21 +00:00
|
|
|
'specialpagealiases',
|
2008-10-26 13:57:19 +00:00
|
|
|
'magicwords',
|
2007-07-07 04:53:07 +00:00
|
|
|
'interwikimap',
|
2007-07-07 04:58:52 +00:00
|
|
|
'dbrepllag',
|
2007-08-09 12:39:41 +00:00
|
|
|
'statistics',
|
2008-04-03 14:33:36 +00:00
|
|
|
'usergroups',
|
2008-12-14 22:06:32 +00:00
|
|
|
'extensions',
|
2008-07-04 09:21:11 +00:00
|
|
|
)
|
|
|
|
|
),
|
|
|
|
|
'filteriw' => array(
|
|
|
|
|
ApiBase :: PARAM_TYPE => array(
|
2007-06-14 05:18:58 +00:00
|
|
|
'local',
|
|
|
|
|
'!local',
|
2008-07-04 09:21:11 +00:00
|
|
|
)
|
|
|
|
|
),
|
2007-07-07 04:53:07 +00:00
|
|
|
'showalldb' => false,
|
2006-09-26 01:44:13 +00:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2008-01-28 19:05:26 +00:00
|
|
|
public function getParamDescription() {
|
2008-07-04 09:21:11 +00:00
|
|
|
return array(
|
|
|
|
|
'prop' => array(
|
2006-09-26 01:44:13 +00:00
|
|
|
'Which sysinfo properties to get:',
|
2007-06-14 05:18:58 +00:00
|
|
|
' "general" - Overall system information',
|
2008-12-16 19:59:37 +00:00
|
|
|
' "namespaces" - List of registered namespaces and their canonical names',
|
2008-02-03 19:29:59 +00:00
|
|
|
' "namespacealiases" - List of registered namespace aliases',
|
2008-03-28 12:47:21 +00:00
|
|
|
' "specialpagealiases" - List of special page aliases',
|
2008-10-26 13:57:19 +00:00
|
|
|
' "magicwords" - List of magic words and their aliases',
|
2007-08-28 15:37:31 +00:00
|
|
|
' "statistics" - Returns site statistics',
|
|
|
|
|
' "interwikimap" - Returns interwiki map (optionally filtered)',
|
|
|
|
|
' "dbrepllag" - Returns database server with the highest replication lag',
|
2008-04-03 14:33:36 +00:00
|
|
|
' "usergroups" - Returns user groups and the associated permissions',
|
2008-12-14 22:06:32 +00:00
|
|
|
' "extensions" - Returns extensions installed on the wiki',
|
2007-06-14 05:18:58 +00:00
|
|
|
),
|
|
|
|
|
'filteriw' => 'Return only local or only nonlocal entries of the interwiki map',
|
2007-08-28 15:37:31 +00:00
|
|
|
'showalldb' => 'List all database servers, not just the one lagging the most',
|
2006-09-26 01:44:13 +00:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2008-01-28 19:05:26 +00:00
|
|
|
public function getDescription() {
|
2006-09-26 01:44:13 +00:00
|
|
|
return 'Return general information about the site.';
|
|
|
|
|
}
|
|
|
|
|
|
2006-09-27 05:13:48 +00:00
|
|
|
protected function getExamples() {
|
2007-06-14 05:18:58 +00:00
|
|
|
return array(
|
2008-02-03 19:29:59 +00:00
|
|
|
'api.php?action=query&meta=siteinfo&siprop=general|namespaces|namespacealiases|statistics',
|
2007-06-14 05:18:58 +00:00
|
|
|
'api.php?action=query&meta=siteinfo&siprop=interwikimap&sifilteriw=local',
|
2007-07-07 04:58:52 +00:00
|
|
|
'api.php?action=query&meta=siteinfo&siprop=dbrepllag&sishowalldb',
|
2007-06-14 05:18:58 +00:00
|
|
|
);
|
2006-09-26 01:44:13 +00:00
|
|
|
}
|
2006-10-01 21:20:55 +00:00
|
|
|
|
|
|
|
|
public function getVersion() {
|
2007-12-06 18:33:18 +00:00
|
|
|
return __CLASS__ . ': $Id$';
|
2006-10-01 21:20:55 +00:00
|
|
|
}
|
2007-10-06 02:30:00 +00:00
|
|
|
}
|