From: Roan Kattouw Date: Wed, 12 Mar 2008 13:25:12 +0000 (+0000) Subject: (bug 13315) Adding section editing to API action=edit. Please read my post on the... X-Git-Tag: 1.31.0-rc.0~49159 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=2f4a97ce2890a1b8c4bfece08134a25979731e76;p=lhc%2Fweb%2Fwiklou.git (bug 13315) Adding section editing to API action=edit. Please read my post on the mediawiki-api list for usage notes --- diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php index 6c6c4e1f96..3e9512c9f7 100644 --- a/includes/api/ApiEditPage.php +++ b/includes/api/ApiEditPage.php @@ -91,6 +91,13 @@ class ApiEditPage extends ApiBase { $reqArr['wpCaptchaId'] = $params['captchaid']; if(!is_null($params['captchaword'])) $reqArr['wpCaptchaWord'] = $params['captchaword']; + if(!is_null($params['section'])) + { + $section = intval($params['section']); + if($section == 0 && $params['section'] != '0' && $params['section'] != 'new') + $this->dieUsage("The section parameter must be set to an integer or 'new'", "invalidsection"); + $reqArr['wpSection'] = $params['section']; + } if($params['watch']) $watch = true; @@ -204,6 +211,7 @@ class ApiEditPage extends ApiBase { protected function getAllowedParams() { return array ( 'title' => null, + 'section' => null, 'text' => null, 'token' => null, 'summary' => null, @@ -222,6 +230,7 @@ class ApiEditPage extends ApiBase { protected function getParamDescription() { return array ( 'title' => 'Page title', + 'section' => 'Section number. 0 for the top section, \'new\' for a new section', 'text' => 'Page content', 'token' => 'Edit token. You can get one of these through prop=info', 'summary' => 'Edit summary', @@ -249,4 +258,4 @@ class ApiEditPage extends ApiBase { public function getVersion() { return __CLASS__ . ': $Id$'; } -} \ No newline at end of file +}