jenkins-bot has submitted this change and it was merged.
Change subject: Add prop 'limitreportdata' and 'limitreporthtml' to action=parse
......................................................................
Add prop 'limitreportdata' and 'limitreporthtml' to action=parse
This allows the get the limit report in provided uselang and not only
the english version out of the parsed html.
Change-Id: I2efc606623190756f5c993f48ef29bb0d384a95b
---
M RELEASE-NOTES-1.23
M includes/api/ApiParse.php
2 files changed, 36 insertions(+), 0 deletions(-)
Approvals:
Anomie: Looks good to me, approved
jenkins-bot: Verified
diff --git a/RELEASE-NOTES-1.23 b/RELEASE-NOTES-1.23
index e1ceb91..660869c 100644
--- a/RELEASE-NOTES-1.23
+++ b/RELEASE-NOTES-1.23
@@ -162,6 +162,7 @@
* (bug 23005) Added action=revisiondelete.
* Added siprop=restrictions to API action=query&meta=siteinfo for querying
possible page restriction (protection) levels and types.
+* Added prop 'limitreportdata' and 'limitreporthtml' to action=parse.
=== Languages updated in 1.23 ===
diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php
index 9963eda..495071a 100644
--- a/includes/api/ApiParse.php
+++ b/includes/api/ApiParse.php
@@ -362,6 +362,15 @@
$result_array['properties'] = $this->formatProperties(
$p_result->getProperties() );
}
+ if ( isset( $prop['limitreportdata'] ) ) {
+ $result_array['limitreportdata'] =
$this->formatLimitReportData( $p_result->getLimitReportData() );
+ }
+ if ( isset( $prop['limitreporthtml'] ) ) {
+ $limitreportHtml = EditPage::getPreviewLimitReport(
$p_result );
+ $result_array['limitreporthtml'] = array();
+ ApiResult::setContent(
$result_array['limitreporthtml'], $limitreportHtml );
+ }
+
if ( $params['generatexml'] ) {
if ( $this->content->getModel() !=
CONTENT_MODEL_WIKITEXT ) {
$this->dieUsage( "generatexml is only supported
for wikitext content", "notwikitext" );
@@ -390,6 +399,7 @@
'sections' => 's',
'headitems' => 'hi',
'properties' => 'pp',
+ 'limitreportdata' => 'lr',
);
$this->setIndexedTagNames( $result_array, $result_mapping );
$result->addValue( null, $this->getModuleName(), $result_array
);
@@ -645,6 +655,25 @@
return $result;
}
+ private function formatLimitReportData( $limitReportData ) {
+ $result = array();
+ $apiResult = $this->getResult();
+
+ foreach ( $limitReportData as $name => $value ) {
+ $entry = array();
+ $entry['name'] = $name;
+ if ( !is_array( $value ) ) {
+ $value = array( $value );
+ }
+ $apiResult->setIndexedTagName( $value, 'param' );
+ $apiResult->setIndexedTagName_recursive( $value,
'param' );
+ $entry = array_merge( $entry, $value );
+ $result[] = $entry;
+ }
+
+ return $result;
+ }
+
private function setIndexedTagNames( &$array, $mapping ) {
foreach ( $mapping as $key => $name ) {
if ( isset( $array[$key] ) ) {
@@ -688,6 +717,8 @@
'iwlinks',
'wikitext',
'properties',
+ 'limitreportdata',
+ 'limitreporthtml',
)
),
'pst' => false,
@@ -741,6 +772,10 @@
' 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',
+ ' limitreportdata - Gives the limit report in a
structured way.',
+ " Gives no data, when
{$p}disablepp is set.",
+ ' limitreporthtml - Gives the HTML version of
the limit report.',
+ " Gives no data, when
{$p}disablepp is set.",
),
'effectivelanglinks' => array(
'Includes language links supplied by
extensions',
--
To view, visit https://gerrit.wikimedia.org/r/110819
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I2efc606623190756f5c993f48ef29bb0d384a95b
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: Umherirrender <[email protected]>
Gerrit-Reviewer: Yurik <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits