From: Sam Reed Date: Fri, 29 Apr 2011 23:02:10 +0000 (+0000) Subject: * (bug 27179) API: List of extension tags X-Git-Tag: 1.31.0-rc.0~30501 X-Git-Url: http://git.cyclocoop.org/data/%24oldEdit?a=commitdiff_plain;h=8c30f284a779a8c7f88b7a85218c335c700f7842;p=lhc%2Fweb%2Fwiklou.git * (bug 27179) API: List of extension tags * Get a list of function hooks through meta=siteinfo --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 7d4be66ba4..4fda976d44 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -364,6 +364,8 @@ PHP if you have not done so prior to upgrading MediaWiki. * (bug 27344) add drprefix param to list=deletedrevs. * (bug 28560) list=deletedrevs should die, if combination of param is invalid. * (bug 28238) paraminfo: output both limits for multi param +* (bug 27179) API: List of extension tags through meta=siteinfo +* Get a list of function hooks through meta=siteinfo === Languages updated in 1.18 === diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index 5c7175c78f..13550d6c27 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -88,6 +88,12 @@ class ApiQuerySiteinfo extends ApiQueryBase { case 'skins': $fit = $this->appendSkins( $p ); break; + case 'extensiontags': + $fit = $this->appendExtensionTags( $p ); + break; + case 'functionhooks': + $fit = $this->appendFunctionHooks( $p ); + break; default: ApiBase::dieDebug( __METHOD__, "Unknown prop=$p" ); } @@ -433,7 +439,6 @@ class ApiQuerySiteinfo extends ApiQueryBase { return $this->getResult()->addValue( 'query', $property, $data ); } - protected function appendRightsInfo( $property ) { global $wgRightsPage, $wgRightsUrl, $wgRightsText; $title = Title::newFromText( $wgRightsPage ); @@ -473,6 +478,26 @@ class ApiQuerySiteinfo extends ApiQueryBase { return $this->getResult()->addValue( 'query', $property, $data ); } + public function appendExtensionTags( $property ) { + global $wgParser; + $wgParser->firstCallInit(); + $tags = array_map( array( $this, 'formatParserTags'), $wgParser->getTags() ); + $this->getResult()->setIndexedTagName( $tags, 't' ); + return $this->getResult()->addValue( 'query', $property, $tags ); + } + + public function appendFunctionHooks( $property ) { + global $wgParser; + $wgParser->firstCallInit(); + $hooks = $wgParser->getFunctionHooks(); + $this->getResult()->setIndexedTagName( $hooks, 'h' ); + return $this->getResult()->addValue( 'query', $property, $hooks ); + } + + private function formatParserTags( $item ) { + return "<{$item}>"; + } + public function getCacheMode( $params ) { return 'public'; } @@ -497,6 +522,8 @@ class ApiQuerySiteinfo extends ApiQueryBase { 'rightsinfo', 'languages', 'skins', + 'extensiontags', + 'functionhooks', ) ), 'filteriw' => array( @@ -528,6 +555,8 @@ class ApiQuerySiteinfo extends ApiQueryBase { ' rightsinfo - Returns wiki rights (license) information if available', ' languages - Returns a list of languages MediaWiki supports', ' skins - Returns a list of all enabled skins', + ' extensiontags - Returns a list of parser extension tags', + ' functionhooks - Returns a list of parser function hooks', ), 'filteriw' => 'Return only local or only nonlocal entries of the interwiki map', 'showalldb' => 'List all database servers, not just the one lagging the most',