83 if ( isset( $data[
'error'] ) ) {
87 if ( !isset( $data[
'edit'] ) || !$data[
'edit'][
'result'] ) {
88 throw new HttpException(
'Bad result structure received from ApiEditPage' );
91 if ( $data[
'edit'][
'result'] !==
'Success' ) {
97 $title = $this->titleParser->parseTitle( $data[
'edit'][
'title'] );
101 $revision = $this->revisionLookup->getRevisionById( (
int)$data[
'edit'][
'newrevid'] );
102 $content = $revision->getContent( SlotRecord::MAIN );
105 'id' => $data[
'edit'][
'pageid'],
106 'title' => $this->titleFormatter->getPrefixedText(
$title ),
107 'key' => $this->titleFormatter->getPrefixedDBkey(
$title ),
109 'id' => $data[
'edit'][
'newrevid'],
110 'timestamp' => $data[
'edit'][
'newtimestamp'],
116 'content_model' => $data[
'edit'][
'contentmodel'],
127 if ( $code ===
'protectedpage' ) {
131 if ( $code ===
'badtoken' ) {
135 if ( $code ===
'missingtitle' ) {
139 if ( $code ===
'articleexists' ) {
143 if ( $code ===
'editconflict' ) {
147 if ( $code ===
'ratelimited' ) {
152 parent::throwHttpExceptionForActionModuleError( $msg, $statusCode );
170 if ( $this->
getSession()->getProvider()->safeAgainstCsrf() ) {
171 if ( !empty( $body[
'token'] ) ) {
179 return $this->
getUser()->getEditToken();
181 return $body[
'token'] ??
'';
187 array $actionModuleResult,
190 parent::mapActionModuleResponse(
191 $actionModuleResponse,
196 if ( $actionModuleResult[
'edit'][
'new'] ??
false ) {
A class containing constants representing the names of configuration variables.
const RightsText
Name constant for the RightsText setting, for use with Config::get()
const RightsUrl
Name constant for the RightsUrl setting, for use with Config::get()
Allow programs to request this object from WebRequest::response() and handle all outputting (or lack ...
Interface for configuration instances.
Interface for messages with machine-readable data for use by the API.
getApiCode()
Returns a machine-readable code for use by the API.
A title parser service for MediaWiki.