r87147 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87146‎ | r87147 | r87148 >
Date:23:02, 29 April 2011
Author:reedy
Status:resolved (Comments)
Tags:
Comment:
* (bug 27179) API: List of extension tags
* Get a list of function hooks through meta=siteinfo
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiQuerySiteinfo.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQuerySiteinfo.php
@@ -88,6 +88,12 @@
8989 case 'skins':
9090 $fit = $this->appendSkins( $p );
9191 break;
 92+ case 'extensiontags':
 93+ $fit = $this->appendExtensionTags( $p );
 94+ break;
 95+ case 'functionhooks':
 96+ $fit = $this->appendFunctionHooks( $p );
 97+ break;
9298 default:
9399 ApiBase::dieDebug( __METHOD__, "Unknown prop=$p" );
94100 }
@@ -433,7 +439,6 @@
434440 return $this->getResult()->addValue( 'query', $property, $data );
435441 }
436442
437 -
438443 protected function appendRightsInfo( $property ) {
439444 global $wgRightsPage, $wgRightsUrl, $wgRightsText;
440445 $title = Title::newFromText( $wgRightsPage );
@@ -473,6 +478,26 @@
474479 return $this->getResult()->addValue( 'query', $property, $data );
475480 }
476481
 482+ public function appendExtensionTags( $property ) {
 483+ global $wgParser;
 484+ $wgParser->firstCallInit();
 485+ $tags = array_map( array( $this, 'formatParserTags'), $wgParser->getTags() );
 486+ $this->getResult()->setIndexedTagName( $tags, 't' );
 487+ return $this->getResult()->addValue( 'query', $property, $tags );
 488+ }
 489+
 490+ public function appendFunctionHooks( $property ) {
 491+ global $wgParser;
 492+ $wgParser->firstCallInit();
 493+ $hooks = $wgParser->getFunctionHooks();
 494+ $this->getResult()->setIndexedTagName( $hooks, 'h' );
 495+ return $this->getResult()->addValue( 'query', $property, $hooks );
 496+ }
 497+
 498+ private function formatParserTags( $item ) {
 499+ return "<{$item}>";
 500+ }
 501+
477502 public function getCacheMode( $params ) {
478503 return 'public';
479504 }
@@ -497,6 +522,8 @@
498523 'rightsinfo',
499524 'languages',
500525 'skins',
 526+ 'extensiontags',
 527+ 'functionhooks',
501528 )
502529 ),
503530 'filteriw' => array(
@@ -528,6 +555,8 @@
529556 ' rightsinfo - Returns wiki rights (license) information if available',
530557 ' languages - Returns a list of languages MediaWiki supports',
531558 ' skins - Returns a list of all enabled skins',
 559+ ' extensiontags - Returns a list of parser extension tags',
 560+ ' functionhooks - Returns a list of parser function hooks',
532561 ),
533562 'filteriw' => 'Return only local or only nonlocal entries of the interwiki map',
534563 'showalldb' => 'List all database servers, not just the one lagging the most',
Index: trunk/phase3/RELEASE-NOTES
@@ -364,6 +364,8 @@
365365 * (bug 27344) add drprefix param to list=deletedrevs.
366366 * (bug 28560) list=deletedrevs should die, if combination of param is invalid.
367367 * (bug 28238) paraminfo: output both limits for multi param
 368+* (bug 27179) API: List of extension tags through meta=siteinfo
 369+* Get a list of function hooks through meta=siteinfo
368370
369371 === Languages updated in 1.18 ===
370372

Follow-up revisions

RevisionCommit summaryAuthorDate
r87168Followup r87147, let the formatters do teh escapingreedy16:38, 30 April 2011

Comments

#Comment by Catrope (talk | contribs)   16:31, 30 April 2011
+		return "<{$item}>";

??? Shouldn't you just return "<$item>" and let the XML formatter handle escaping for you?

#Comment by Duplicatebug (talk | contribs)   17:42, 11 September 2011

flags of functionHooks are missing. appendFunctionHooks does not add information about SFH_NO_HASH, which makes it hard to use, because is is very important to know, if the function hook has a leading # or not. Maybe add the # to the hookname.

Adding the information about SFH_OBJECT_ARGS is a nice to have (not used often). A objectargs="" can do the job.

Thanks.

#Comment by Duplicatebug (talk | contribs)   19:09, 18 September 2011

Status & tagging log