From 1b64ddf09cb491bf52f46e0503cb943d731fc76b Mon Sep 17 00:00:00 2001 From: Mark Holmquist Date: Thu, 14 Feb 2013 15:06:15 -0800 Subject: [PATCH] (bug 44449) Add siprop=protocols to SiteInfo API The existing method for getting allowed URL protocols will not help Parsoid, so we're adding a new API call that will help us fix bug 44449. Change-Id: I5fd130cb30313f8e8a376ff0146195f2264e8e0e --- includes/api/ApiQuerySiteinfo.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index 3ed0113788..593d6e71b3 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -96,6 +96,9 @@ class ApiQuerySiteinfo extends ApiQueryBase { case 'variables': $fit = $this->appendVariables( $p ); break; + case 'protocols': + $fit = $this->appendProtocols( $p ); + break; default: ApiBase::dieDebug( __METHOD__, "Unknown prop=$p" ); } @@ -549,6 +552,12 @@ class ApiQuerySiteinfo extends ApiQueryBase { return $this->getResult()->addValue( 'query', $property, $variables ); } + public function appendProtocols( $property ) { + global $wgUrlProtocols; + $this->getResult()->setIndexedTagName( $wgUrlProtocols, 'p' ); + return $this->getResult()->addValue( 'query', $property, $wgUrlProtocols ); + } + private function formatParserTags( $item ) { return "<{$item}>"; } @@ -601,6 +610,7 @@ class ApiQuerySiteinfo extends ApiQueryBase { 'functionhooks', 'showhooks', 'variables', + 'protocols', ) ), 'filteriw' => array( @@ -638,6 +648,7 @@ class ApiQuerySiteinfo extends ApiQueryBase { ' functionhooks - Returns a list of parser function hooks', ' 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.', ), 'filteriw' => 'Return only local or only nonlocal entries of the interwiki map', 'showalldb' => 'List all database servers, not just the one lagging the most', -- 2.20.1