X-Git-Url: https://git.cyclocoop.org/admin/?a=blobdiff_plain;f=includes%2Fapi%2FApiEditPage.php;h=f697b6f0a21084a1b91fd62d1d7b90a48954b322;hb=52d78033ea60059312bb4f68631e66f6963bad6c;hp=f663cc655977dc9bd738ffb62a1b51dfca46b1e0;hpb=0d8e9eacae1f47c60518f871dbb73f4539413d39;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php index f663cc6559..f697b6f0a2 100644 --- a/includes/api/ApiEditPage.php +++ b/includes/api/ApiEditPage.php @@ -48,8 +48,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; @@ -252,9 +256,10 @@ class ApiEditPage extends ApiBase { 'format' => $contentFormat, 'model' => $contentHandler->getModelID(), 'wpEditToken' => $params['token'], - 'wpIgnoreBlankSummary' => '', + 'wpIgnoreBlankSummary' => true, 'wpIgnoreBlankArticle' => true, 'wpIgnoreSelfRedirect' => true, + 'bot' => $params['bot'], ); if ( !is_null( $params['summary'] ) ) { @@ -295,10 +300,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']; @@ -401,7 +409,7 @@ class ApiEditPage extends ApiBase { $oldRequest = $wgRequest; $wgRequest = $req; - $status = $ep->internalAttemptSave( $result, $user->isAllowed( 'bot' ) && $params['bot'] ); + $status = $ep->attemptSave( $result ); $wgRequest = $oldRequest; switch ( $status->value ) { @@ -462,7 +470,6 @@ class ApiEditPage extends ApiBase { case EditPage::AS_CONFLICT_DETECTED: $this->dieUsageMsg( 'editconflict' ); - // case EditPage::AS_SUMMARY_NEEDED: Can't happen since we set wpIgnoreBlankSummary case EditPage::AS_TEXTBOX_EMPTY: $this->dieUsageMsg( 'emptynewsection' ); @@ -487,6 +494,7 @@ class ApiEditPage extends ApiBase { break; case EditPage::AS_SUMMARY_NEEDED: + // Shouldn't happen since we set wpIgnoreBlankSummary, but just in case $this->dieUsageMsg( 'summaryrequired' ); case EditPage::AS_END: