From: Brad Jorsch Date: Mon, 9 Dec 2013 18:08:39 +0000 (-0500) Subject: API: Add image sizes and default user prefs to meta=siteinfo X-Git-Tag: 1.31.0-rc.0~17691^2 X-Git-Url: http://git.cyclocoop.org/ecrire?a=commitdiff_plain;h=30306c37e702d4122567fd8ee584992532da9bf0;p=lhc%2Fweb%2Fwiklou.git API: Add image sizes and default user prefs to meta=siteinfo Bug: 58217 Change-Id: I33fc64681bc6924324d254b676686f3a6dee2769 --- diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index 1c188da0a9..a94f5bbf0a 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -99,6 +99,9 @@ class ApiQuerySiteinfo extends ApiQueryBase { case 'protocols': $fit = $this->appendProtocols( $p ); break; + case 'defaultoptions': + $fit = $this->appendDefaultOptions( $p ); + break; default: ApiBase::dieDebug( __METHOD__, "Unknown prop=$p" ); } @@ -239,6 +242,14 @@ class ApiQuerySiteinfo extends ApiQueryBase { $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 ); @@ -633,6 +644,10 @@ class ApiQuerySiteinfo extends ApiQueryBase { 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}>"; } @@ -687,6 +702,7 @@ class ApiQuerySiteinfo extends ApiQueryBase { 'showhooks', 'variables', 'protocols', + 'defaultoptions', ) ), 'filteriw' => array( @@ -728,6 +744,7 @@ class ApiQuerySiteinfo extends ApiQueryBase { ' 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',