Anomie has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/63138


Change subject: API: Fix action=parse without any page or title or text
......................................................................

API: Fix action=parse without any page or title or text

action=parse was raising an error about missing 'text' with 'title' even
when 'title' wasn't actually passed, due to a fix for bug 33865. But
this broke using action=parse to parse an edit summary without also
giving it wikitext to parse.

It turns out that the ContentHandler changes fixed bug 33865 anyway, so
the check for 'title' without 'text' could be removed. But on the other
hand, it doesn't hurt anything and warns about a probable client error,
so let's keep it in and just fix it to not complain when 'title' is not
passed (or is the default).

Also, while we're editing the file, add some more examples as also
requested in bug 48319.

Bug: 48319
Change-Id: I03c1fbcb0bd31dea8bd84e164104f7ced0ace449
---
M RELEASE-NOTES-1.22
M includes/api/ApiParse.php
2 files changed, 7 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/38/63138/1

diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22
index 50444a7..cf6a5e9 100644
--- a/RELEASE-NOTES-1.22
+++ b/RELEASE-NOTES-1.22
@@ -88,6 +88,8 @@
 * A bias in wfRandomString() toward digits 1-7 has been corrected. Generated
   strings will now start with digits 0 and 8-f as often as they should.
 * (bug 45371) Removed Parser_LinkHooks and CoreLinkFunctions classes.
+* (bug 48319) action=parse no longer returns an error if passed none of 
'oldid',
+  'pageid', 'page', 'title', and 'text' (e.g. if only passed 'summary').
 
 === API changes in 1.22 ===
 * (bug 46626) xmldoublequote parameter was removed. Because of a bug, the
diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php
index bde1d99..1a48860 100644
--- a/includes/api/ApiParse.php
+++ b/includes/api/ApiParse.php
@@ -173,7 +173,7 @@
                        $popts = $pageObj->makeParserOptions( 
$this->getContext() );
                        $popts->enableLimitReport( !$params['disablepp'] );
 
-                       if ( is_null( $text ) ) {
+                       if ( is_null( $text ) && $title !== 'API' ) {
                                $this->dieUsage( 'The text parameter should be 
passed with the title parameter. Should you be using the "page" parameter 
instead?', 'params' );
                        }
 
@@ -679,7 +679,10 @@
 
        public function getExamples() {
                return array(
-                       'api.php?action=parse&text={{Project:Sandbox}}'
+                       'api.php?action=parse&page=Project:Sandbox' => 'Parse a 
page',
+                       'api.php?action=parse&text={{Project:Sandbox}}' => 
'Parse wikitext',
+                       'api.php?action=parse&text={{PAGENAME}}&title=Test' => 
'Parse wikitext, specifying the page title',
+                       'api.php?action=parse&summary=Some+[[link]]&prop=' => 
'Parse a summary',
                );
        }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I03c1fbcb0bd31dea8bd84e164104f7ced0ace449
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to