From: Bartosz DziewoƄski Date: Wed, 16 Apr 2014 21:07:54 +0000 (+0200) Subject: ApiParse: Add prop=modules X-Git-Tag: 1.31.0-rc.0~15958 X-Git-Url: http://git.cyclocoop.org/%7B%7B%20url_for%28%27admin_vote_add%27%29%20%7D%7D?a=commitdiff_plain;h=1abe2525cda430bbe99bd370490882067896a300;p=lhc%2Fweb%2Fwiklou.git ApiParse: Add prop=modules action=parse&prop=modules now provides the ResourceLoader modules used on the page (included in the ParserOutput object). This is intended to be used by the live preview functionality. Bug: 24134 Change-Id: Ib5032e4eeaf6bb97dac965c580a5107437c7bbd4 --- diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php index a7cc436ce1..fcba5b5f74 100644 --- a/includes/api/ApiParse.php +++ b/includes/api/ApiParse.php @@ -346,6 +346,13 @@ class ApiParse extends ApiBase { } } + if ( isset( $prop['modules'] ) ) { + $result_array['modules'] = array_values( array_unique( $p_result->getModules() ) ); + $result_array['modulescripts'] = array_values( array_unique( $p_result->getModuleScripts() ) ); + $result_array['modulestyles'] = array_values( array_unique( $p_result->getModuleStyles() ) ); + $result_array['modulemessages'] = array_values( array_unique( $p_result->getModuleMessages() ) ); + } + if ( isset( $prop['iwlinks'] ) ) { $result_array['iwlinks'] = $this->formatIWLinks( $p_result->getInterwikiLinks() ); } @@ -399,6 +406,10 @@ class ApiParse extends ApiBase { 'iwlinks' => 'iw', 'sections' => 's', 'headitems' => 'hi', + 'modules' => 'm', + 'modulescripts' => 'm', + 'modulestyles' => 'm', + 'modulemessages' => 'm', 'properties' => 'pp', 'limitreportdata' => 'lr', ); @@ -723,6 +734,7 @@ class ApiParse extends ApiBase { 'displaytitle', 'headitems', 'headhtml', + 'modules', 'iwlinks', 'wikitext', 'properties', @@ -779,6 +791,7 @@ class ApiParse extends ApiBase { ' displaytitle - Adds the title of the parsed wikitext', ' headitems - Gives items to put in the of the page', ' headhtml - Gives parsed of the page', + ' modules - Gives the ResourceLoader modules used on the page', ' iwlinks - Gives interwiki links in the parsed wikitext', ' wikitext - Gives the original wikitext that was parsed', ' properties - Gives various properties defined in the parsed wikitext',