* @file
*/
-if ( !defined( 'MEDIAWIKI' ) ) {
- // Eclipse helper - will be ignored in production
- require_once( 'ApiQueryBase.php' );
-}
-
/**
* A query action to return meta information about the wiki site.
*
$data = array();
$mainPage = Title::newMainPage();
$data['mainpage'] = $mainPage->getPrefixedText();
- $data['base'] = wfExpandUrl( $mainPage->getFullUrl() );
+ $data['base'] = wfExpandUrl( $mainPage->getFullUrl(), PROTO_CURRENT );
$data['sitename'] = $GLOBALS['wgSitename'];
$data['generator'] = "MediaWiki {$GLOBALS['wgVersion']}";
$data['phpversion'] = phpversion();
$data['dbtype'] = $GLOBALS['wgDBtype'];
$data['dbversion'] = $this->getDB()->getServerVersion();
- $svn = SpecialVersion::getSvnRevision( $GLOBALS['IP'] );
- if ( $svn ) {
- $data['rev'] = $svn;
+ $git = SpecialVersion::getGitHeadSha1( $GLOBALS['IP'] );
+ if ( $git ) {
+ $data['git-hash'] = $git;
+ } else {
+ $svn = SpecialVersion::getSvnRevision( $GLOBALS['IP'] );
+ if ( $svn ) {
+ $data['rev'] = $svn;
+ }
}
// 'case-insensitive' option is reserved for future
$data['rights'] = $GLOBALS['wgRightsText'];
$data['lang'] = $GLOBALS['wgLanguageCode'];
- $fallbackLang = $wgContLang->getFallbackLanguageCode();
- $fallbackLangArray = array();
- while( $fallbackLang ) {
- $fallbackLangArray[] = array( 'code' => $fallbackLang );
- $fallbackLang = Language::getFallbackFor( $fallbackLang );
+ $fallbacks = array();
+ foreach( $wgContLang->getFallbackLanguages() as $code ) {
+ $fallbacks[] = array( 'code' => $code );
}
- $data['fallback'] = $fallbackLangArray;
+ $data['fallback'] = $fallbacks;
$this->getResult()->setIndexedTagName( $data['fallback'], 'lang' );
+ if( $wgContLang->hasVariants() ) {
+ $variants = array();
+ foreach( $wgContLang->getVariants() as $code ) {
+ $variants[] = array( 'code' => $code );
+ }
+ $data['variants'] = $variants;
+ $this->getResult()->setIndexedTagName( $data['variants'], 'lang' );
+ }
+
if ( $wgContLang->isRTL() ) {
$data['rtl'] = '';
}
$data['misermode'] = '';
}
+ $data['maxuploadsize'] = UploadBase::getMaxUploadSize();
+
wfRunHooks( 'APIQuerySiteInfoGeneralInfo', array( $this, &$data ) );
return $this->getResult()->addValue( 'query', $property, $data );
if ( MWNamespace::isContent( $ns ) ) {
$data[$ns]['content'] = '';
}
+
+ if ( MWNamespace::isNonincludable( $ns ) ) {
+ $data[$ns]['nonincludable'] = '';
+ }
}
$this->getResult()->setIndexedTagName( $data, 'ns' );
}
$params = $this->extractRequestParams();
- $langCode = isset( $params['inlanguagecode '] ) ? $params['inlanguagecode '] : '';
-
- if( $langCode ) {
- $langNames = Language::getTranslatedLanguageNames( $langCode );
- } else {
- $langNames = Language::getLanguageNames();
- }
+ $langCode = isset( $params['inlanguagecode'] ) ? $params['inlanguagecode'] : '';
+ $langNames = Language::fetchLanguageNames( $langCode );
$getPrefixes = Interwiki::getAllPrefixes( $local );
$data = array();
if ( isset( $langNames[$prefix] ) ) {
$val['language'] = $langNames[$prefix];
}
- $val['url'] = wfExpandUrl( $row['iw_url'] );
+ $val['url'] = wfExpandUrl( $row['iw_url'], PROTO_CURRENT );
if( isset( $row['iw_wikiid'] ) ) {
$val['wikiid'] = $row['iw_wikiid'];
}
protected function appendRightsInfo( $property ) {
global $wgRightsPage, $wgRightsUrl, $wgRightsText;
$title = Title::newFromText( $wgRightsPage );
- $url = $title ? wfExpandUrl( $title->getFullURL() ) : $wgRightsUrl;
+ $url = $title ? wfExpandUrl( $title->getFullURL(), PROTO_CURRENT ) : $wgRightsUrl;
$text = $wgRightsText;
if ( !$text && $title ) {
$text = $title->getPrefixedText();
public function appendLanguages( $property ) {
$params = $this->extractRequestParams();
- $langCode = isset( $params['inlanguagecode '] ) ? $params['inlanguagecode '] : '';
-
- if( $langCode ) {
- $langNames = Language::getTranslatedLanguageNames( $langCode );
- } else {
- $langNames = Language::getLanguageNames();
- }
+ $langCode = isset( $params['inlanguagecode'] ) ? $params['inlanguagecode'] : '';
+ $langNames = Language::fetchLanguageNames( $langCode );
$data = array();
),
'showalldb' => false,
'numberingroup' => false,
- 'inlanguagecode ' => null,
+ 'inlanguagecode' => null,
);
}
'filteriw' => 'Return only local or only nonlocal entries of the interwiki map',
'showalldb' => 'List all database servers, not just the one lagging the most',
'numberingroup' => 'Lists the number of users in user groups',
- 'inlanguagecode ' => 'Language code for localised language names (best effort, use CLDR extension)',
+ 'inlanguagecode' => 'Language code for localised language names (best effort, use CLDR extension)',
);
}
}
public function getHelpUrls() {
- return 'http://www.mediawiki.org/wiki/API:Meta#siteinfo_.2F_si';
+ return 'https://www.mediawiki.org/wiki/API:Meta#siteinfo_.2F_si';
}
public function getVersion() {