* (bug 27179) API: List of extension tags
authorSam Reed <reedy@users.mediawiki.org>
Fri, 29 Apr 2011 23:02:10 +0000 (23:02 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Fri, 29 Apr 2011 23:02:10 +0000 (23:02 +0000)
* Get a list of function hooks through meta=siteinfo

RELEASE-NOTES
includes/api/ApiQuerySiteinfo.php

index 7d4be66..4fda976 100644 (file)
@@ -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 ===
 
index 5c7175c..13550d6 100644 (file)
@@ -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 "&lt;{$item}&gt;";
+       }
+
        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',