Revision: 53258
Author:   btongminh
Date:     2009-07-14 20:14:47 +0000 (Tue, 14 Jul 2009)

Log Message:
-----------
(bug 19040) Fix prependtext and appendtext in combination with section 
parameter in action=edit

Modified Paths:
--------------
    trunk/phase3/RELEASE-NOTES
    trunk/phase3/includes/api/ApiEditPage.php

Modified: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES  2009-07-14 20:12:42 UTC (rev 53257)
+++ trunk/phase3/RELEASE-NOTES  2009-07-14 20:14:47 UTC (rev 53258)
@@ -294,6 +294,8 @@
 * (bug 17809) Add number of users in user groups to meta=siteinfo
 * (bug 18533) Add readonly reason to readonly exception
 * (bug 19528) Added XSLT parameter to API queries in format=xml
+* (bug 19040) Fix prependtext and appendtext in combination with section 
+  parameter in action=edit
 
 === Languages updated in 1.16 ===
 

Modified: trunk/phase3/includes/api/ApiEditPage.php
===================================================================
--- trunk/phase3/includes/api/ApiEditPage.php   2009-07-14 20:12:42 UTC (rev 
53257)
+++ trunk/phase3/includes/api/ApiEditPage.php   2009-07-14 20:14:47 UTC (rev 
53258)
@@ -86,6 +86,16 @@
                                $content = '';
                        else
                                $content = $articleObj->getContent();
+                       
+                       if (!is_null($params['section'])) 
+                       {
+                               // Process the content for section edits
+                               global $wgParser;
+                               $section = intval($params['section']);
+                               $content = $wgParser->getSection($content, 
$section, false);
+                               if ($content === false)
+                                       $this->dieUsage("There is no section 
{$section}.", 'nosuchsection');
+                       }
                        $params['text'] = $params['prependtext'] . $content . 
$params['appendtext'];
                        $toMD5 = $params['prependtext'] . $params['appendtext'];
                }
@@ -345,8 +355,7 @@
                        'captchaword' => 'Answer to the CAPTCHA',
                        'md5' => array( 'The MD5 hash of the text parameter, or 
the prependtext and appendtext parameters concatenated.',
                                        'If set, the edit won\'t be done unless 
the hash is correct'),
-                       'prependtext' => array( 'Add this text to the beginning 
of the page. Overrides text.',
-                                               'Don\'t use together with 
section: that won\'t do what you expect.'),
+                       'prependtext' => 'Add this text to the beginning of the 
page. Overrides text.',
                        'appendtext' => 'Add this text to the end of the page. 
Overrides text',
                        'undo' => 'Undo this revision. Overrides text, 
prependtext and appendtext',
                        'undoafter' => 'Undo all revisions from undo to this 
one. If not set, just undo one revision',



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

Reply via email to