Merge "Fix description for MessagesBgn.php"
[lhc/web/wiklou.git] / includes / api / ApiEditPage.php
index 15fa333..ef8957e 100644 (file)
@@ -28,7 +28,9 @@
  * A module that allows for editing and creating pages.
  *
  * Currently, this wraps around the EditPage class in an ugly way,
- * EditPage.php should be rewritten to provide a cleaner interface
+ * EditPage.php should be rewritten to provide a cleaner interface,
+ * see T20654 if you're inspired to fix this.
+ *
  * @ingroup API
  */
 class ApiEditPage extends ApiBase {
@@ -48,8 +50,12 @@ 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 ( $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;
@@ -296,10 +302,13 @@ class ApiEditPage extends ApiBase {
                if ( !is_null( $params['section'] ) ) {
                        $section = $params['section'];
                        if ( !preg_match( '/^((T-)?\d+|new)$/', $section ) ) {
-                               $this->dieUsage( "The section parameter must be a valid section id or 'new'", "invalidsection" );
+                               $this->dieUsage( "The section parameter must be a valid section id or 'new'",
+                                       "invalidsection" );
                        }
                        $content = $pageObj->getContent();
-                       if ( $section !== '0' && $section != 'new' && ( !$content || !$content->getSection( $section ) ) ) {
+                       if ( $section !== '0' && $section != 'new'
+                               && ( !$content || !$content->getSection( $section ) )
+                       ) {
                                $this->dieUsage( "There is no section {$section}.", 'nosuchsection' );
                        }
                        $requestArray['wpSection'] = $params['section'];