X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=blobdiff_plain;f=includes%2Fapi%2FApiEditPage.php;h=cb0f8c22913131507f94219b32a23a8f150c1090;hb=5971b2c39a4856bf119510aa37e9c1ee82ea7e1e;hp=635f6f889c759207a6119cfdba0221e600042b11;hpb=04d4a19ec2fda92cec2ec4cb498cfc224d57d6fc;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php index 635f6f889c..cb0f8c2291 100644 --- a/includes/api/ApiEditPage.php +++ b/includes/api/ApiEditPage.php @@ -48,6 +48,9 @@ class ApiEditPage extends ApiBase { $apiResult = $this->getResult(); if ( $params['redirect'] ) { + if ( $params['prependtext'] === null && $params['appendtext'] === null && $params['section'] !== 'new' ) { + $this->dieUsage( 'You have attempted to edit using the "redirect"-following mode, which must be used in conjuction with section=new, prependtext, or appendtext.', 'redirect-appendonly' ); + } if ( $titleObj->isRedirect() ) { $oldTitle = $titleObj; @@ -526,7 +529,7 @@ class ApiEditPage extends ApiBase { array( 'editconflict' ), array( 'emptynewsection' ), array( 'unknownerror', 'retval' ), - array( 'code' => 'nosuchsection', 'info' => 'There is no section section.' ), + array( 'code' => 'nosuchsection', 'info' => 'There is no such section.' ), array( 'code' => 'invalidsection', 'info' => 'The section parameter must be a valid section id or \'new\'' @@ -542,6 +545,10 @@ class ApiEditPage extends ApiBase { array( 'code' => 'appendnotsupported', 'info' => 'This type of page can not be edited by appending or prepending text.' ), + array( + 'code' => 'redirect-appendonly', + 'info' => 'You have attempted to edit using the "redirect"-following mode, which must be used in conjuction with section=new, prependtext, or appendtext.', + ), array( 'code' => 'badformat', 'info' => 'The requested serialization format can not be applied to the page\'s content model'