82 if ( isset( $data[
'error'] ) ) {
86 if ( !isset( $data[
'edit'] ) || !$data[
'edit'][
'result'] ) {
87 throw new HttpException(
'Bad result structure received from ApiEditPage' );
90 if ( $data[
'edit'][
'result'] !==
'Success' ) {
96 $title = $this->titleParser->parseTitle( $data[
'edit'][
'title'] );
100 $revision = $this->revisionLookup->getRevisionById( (
int)$data[
'edit'][
'newrevid'] );
101 $content = $revision->getContent( SlotRecord::MAIN );
104 'id' => $data[
'edit'][
'pageid'],
105 'title' => $this->titleFormatter->getPrefixedText(
$title ),
106 'key' => $this->titleFormatter->getPrefixedDBkey(
$title ),
108 'id' => $data[
'edit'][
'newrevid'],
109 'timestamp' => $data[
'edit'][
'newtimestamp'],
112 'url' => $this->config->get(
'RightsUrl' ),
113 'title' => $this->config->get(
'RightsText' )
115 'content_model' => $data[
'edit'][
'contentmodel'],
126 if ( $code ===
'protectedpage' ) {
130 if ( $code ===
'badtoken' ) {
134 if ( $code ===
'missingtitle' ) {
138 if ( $code ===
'articleexists' ) {
142 if ( $code ===
'editconflict' ) {
146 if ( $code ===
'ratelimited' ) {
151 parent::throwHttpExceptionForActionModuleError( $msg, $statusCode );
169 if ( $this->
getSession()->getProvider()->safeAgainstCsrf() ) {
170 if ( !empty( $body[
'token'] ) ) {
178 return $this->
getUser()->getEditToken();
180 return $body[
'token'] ??
'';
186 array $actionModuleResult,
189 parent::mapActionModuleResponse(
190 $actionModuleResponse,
195 if ( $actionModuleResult[
'edit'][
'new'] ??
false ) {
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.