Index: trunk/phase3/includes/api/ApiEditPage.php |
— | — | @@ -86,6 +86,16 @@ |
87 | 87 | $content = ''; |
88 | 88 | else |
89 | 89 | $content = $articleObj->getContent(); |
| 90 | + |
| 91 | + if (!is_null($params['section'])) |
| 92 | + { |
| 93 | + // Process the content for section edits |
| 94 | + global $wgParser; |
| 95 | + $section = intval($params['section']); |
| 96 | + $content = $wgParser->getSection($content, $section, false); |
| 97 | + if ($content === false) |
| 98 | + $this->dieUsage("There is no section {$section}.", 'nosuchsection'); |
| 99 | + } |
90 | 100 | $params['text'] = $params['prependtext'] . $content . $params['appendtext']; |
91 | 101 | $toMD5 = $params['prependtext'] . $params['appendtext']; |
92 | 102 | } |
— | — | @@ -345,8 +355,7 @@ |
346 | 356 | 'captchaword' => 'Answer to the CAPTCHA', |
347 | 357 | 'md5' => array( 'The MD5 hash of the text parameter, or the prependtext and appendtext parameters concatenated.', |
348 | 358 | 'If set, the edit won\'t be done unless the hash is correct'), |
349 | | - 'prependtext' => array( 'Add this text to the beginning of the page. Overrides text.', |
350 | | - 'Don\'t use together with section: that won\'t do what you expect.'), |
| 359 | + 'prependtext' => 'Add this text to the beginning of the page. Overrides text.', |
351 | 360 | 'appendtext' => 'Add this text to the end of the page. Overrides text', |
352 | 361 | 'undo' => 'Undo this revision. Overrides text, prependtext and appendtext', |
353 | 362 | 'undoafter' => 'Undo all revisions from undo to this one. If not set, just undo one revision', |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -294,6 +294,8 @@ |
295 | 295 | * (bug 17809) Add number of users in user groups to meta=siteinfo |
296 | 296 | * (bug 18533) Add readonly reason to readonly exception |
297 | 297 | * (bug 19528) Added XSLT parameter to API queries in format=xml |
| 298 | +* (bug 19040) Fix prependtext and appendtext in combination with section |
| 299 | + parameter in action=edit |
298 | 300 | |
299 | 301 | === Languages updated in 1.16 === |
300 | 302 | |