Umherirrender has uploaded a new change for review.
https://gerrit.wikimedia.org/r/110819
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, 34 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/19/110819/1
diff --git a/RELEASE-NOTES-1.23 b/RELEASE-NOTES-1.23
index cd602a1..4919341 100644
--- a/RELEASE-NOTES-1.23
+++ b/RELEASE-NOTES-1.23
@@ -153,6 +153,7 @@
list=usercontribs.
* list=watchlist now uses the querying user's rights rather than the wlowner's
rights when checking whether wlprop=patrol is allowed.
+* 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 464fde6..54e6243 100644
--- a/includes/api/ApiParse.php
+++ b/includes/api/ApiParse.php
@@ -361,6 +361,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" );
@@ -389,6 +398,7 @@
'sections' => 's',
'headitems' => 'hi',
'properties' => 'pp',
+ 'limitreportdata' => 'lr',
);
$this->setIndexedTagNames( $result_array, $result_mapping );
$result->addValue( null, $this->getModuleName(), $result_array
);
@@ -644,6 +654,23 @@
return $result;
}
+ private function formatLimitReportData( $limitReportData ) {
+ $result = array();
+ foreach ( $limitReportData as $name => $value ) {
+ $entry = array();
+ $entry['name'] = $name;
+ if ( !is_array( $value ) ) {
+ $value = array( $value );
+ }
+ foreach ( $value as $index => $param ) {
+ $entry['value' . ( $index + 1 )] = $param;
+ }
+ $result[] = $entry;
+ }
+
+ return $result;
+ }
+
private function setIndexedTagNames( &$array, $mapping ) {
foreach ( $mapping as $key => $name ) {
if ( isset( $array[$key] ) ) {
@@ -687,6 +714,8 @@
'iwlinks',
'wikitext',
'properties',
+ 'limitreportdata',
+ 'limitreporthtml',
)
),
'pst' => false,
@@ -741,6 +770,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: newchange
Gerrit-Change-Id: I2efc606623190756f5c993f48ef29bb0d384a95b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits