jenkins-bot has submitted this change and it was merged.

Change subject: ApiParse: Add prop=modules
......................................................................


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
---
M includes/api/ApiParse.php
1 file changed, 13 insertions(+), 0 deletions(-)

Approvals:
  TheDJ: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php
index a7cc436..fcba5b5 100644
--- a/includes/api/ApiParse.php
+++ b/includes/api/ApiParse.php
@@ -346,6 +346,13 @@
                        }
                }
 
+               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 @@
                        'iwlinks' => 'iw',
                        'sections' => 's',
                        'headitems' => 'hi',
+                       'modules' => 'm',
+                       'modulescripts' => 'm',
+                       'modulestyles' => 'm',
+                       'modulemessages' => 'm',
                        'properties' => 'pp',
                        'limitreportdata' => 'lr',
                );
@@ -723,6 +734,7 @@
                                        'displaytitle',
                                        'headitems',
                                        'headhtml',
+                                       'modules',
                                        'iwlinks',
                                        'wikitext',
                                        'properties',
@@ -779,6 +791,7 @@
                                ' displaytitle   - Adds the title of the parsed 
wikitext',
                                ' headitems      - Gives items to put in the 
<head> of the page',
                                ' headhtml       - Gives parsed <head> 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',

-- 
To view, visit https://gerrit.wikimedia.org/r/126848
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib5032e4eeaf6bb97dac965c580a5107437c7bbd4
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <matma....@gmail.com>
Gerrit-Reviewer: Anomie <bjor...@wikimedia.org>
Gerrit-Reviewer: Bartosz Dziewoński <matma....@gmail.com>
Gerrit-Reviewer: Catrope <roan.katt...@gmail.com>
Gerrit-Reviewer: Mattflaschen <mflasc...@wikimedia.org>
Gerrit-Reviewer: TheDJ <hartman.w...@gmail.com>
Gerrit-Reviewer: Umherirrender <umherirrender_de...@web.de>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to