case 'protocols':
$fit = $this->appendProtocols( $p );
break;
+ case 'defaultoptions':
+ $fit = $this->appendDefaultOptions( $p );
+ break;
default:
ApiBase::dieDebug( __METHOD__, "Unknown prop=$p" );
}
if ( $wgContLang->hasVariants() ) {
$variants = array();
foreach ( $wgContLang->getVariants() as $code ) {
- $variants[] = array( 'code' => $code );
+ $variants[] = array(
+ 'code' => $code,
+ 'name' => $wgContLang->getVariantname( $code ),
+ );
}
$data['variants'] = $variants;
$this->getResult()->setIndexedTagName( $data['variants'], 'lang' );
$data['maxuploadsize'] = UploadBase::getMaxUploadSize();
+ $data['thumblimits'] = $GLOBALS['wgThumbLimits'];
+ $this->getResult()->setIndexedTagName( $data['thumblimits'], 'limit' );
+ $data['imagelimits'] = array();
+ $this->getResult()->setIndexedTagName( $data['imagelimits'], 'limit' );
+ foreach ( $GLOBALS['wgImageLimits'] as $k => $limit ) {
+ $data['imagelimits'][$k] = array( 'width' => $limit[0], 'height' => $limit[1] );
+ }
+
wfRunHooks( 'APIQuerySiteInfoGeneralInfo', array( $this, &$data ) );
return $this->getResult()->addValue( 'query', $property, $data );
) {
$ret['version'] = 'r' . $m[1];
}
+ if ( isset( $ext['path'] ) ) {
+ $extensionPath = dirname( $ext['path'] );
+ $gitInfo = new GitInfo( $extensionPath );
+ $vcsVersion = $gitInfo->getHeadSHA1();
+ if ( $vcsVersion !== false ) {
+ $ret['vcs-system'] = 'git';
+ $ret['vcs-version'] = $vcsVersion;
+ $ret['vcs-url'] = $gitInfo->getHeadViewUrl();
+ $ret['vcs-date'] = wfTimestamp( TS_ISO_8601, $gitInfo->getHeadCommitDate() );
+ } else {
+ $svnInfo = SpecialVersion::getSvnInfo( $extensionPath );
+ if ( $svnInfo !== false ) {
+ $ret['vcs-system'] = 'svn';
+ $ret['vcs-version'] = $svnInfo['checkout-rev'];
+ $ret['vcs-url'] = isset( $svnInfo['viewvc-url'] ) ? $svnInfo['viewvc-url'] : '';
+ }
+ }
+ if ( SpecialVersion::getExtLicenseFileName( $extensionPath ) ) {
+ $ret['license-name'] = isset( $ext['license-name'] ) ? $ext['license-name'] : '';
+ $ret['license'] = SpecialPage::getTitleFor( 'Version', "License/{$ext['name']}" )->getLinkURL();
+ }
+ if ( SpecialVersion::getExtAuthorsFileName( $extensionPath ) ) {
+ $ret['credits'] = SpecialPage::getTitleFor( 'Version', "Credits/{$ext['name']}" )->getLinkURL();
+ }
+ }
$data[] = $ret;
}
}
return $this->getResult()->addValue( 'query', $property, $protocols );
}
+ public function appendDefaultOptions( $property ) {
+ return $this->getResult()->addValue( 'query', $property, User::getDefaultOptions() );
+ }
+
private function formatParserTags( $item ) {
return "<{$item}>";
}
'showhooks',
'variables',
'protocols',
+ 'defaultoptions',
)
),
'filteriw' => array(
' showhooks - Returns a list of all subscribed hooks (contents of $wgHooks)',
' variables - Returns a list of variable IDs',
' protocols - Returns a list of protocols that are allowed in external links.',
+ ' defaultoptions - Returns the default values for user preferences.',
),
'filteriw' => 'Return only local or only nonlocal entries of the interwiki map',
'showalldb' => 'List all database servers, not just the one lagging the most',