12use MediaWiki\Rest\TokenAwareHandlerTrait;
85 if ( isset( $data[
'error'] ) ) {
89 if ( !isset( $data[
'edit'] ) || !$data[
'edit'][
'result'] ) {
90 throw new RuntimeException(
'Bad result structure received from ApiEditPage' );
93 if ( $data[
'edit'][
'result'] !==
'Success' ) {
97 new MessageValue(
"rest-edit-conflict", [ $data[
'edit'][
'result'] ] ),
102 $title = $this->titleParser->parseTitle( $data[
'edit'][
'title'] );
106 $revision = $this->revisionLookup->getRevisionById( (
int)$data[
'edit'][
'newrevid'] );
107 $content = $revision->getContent( SlotRecord::MAIN );
110 'id' => $data[
'edit'][
'pageid'],
111 'title' => $this->titleFormatter->getPrefixedText( $title ),
112 'key' => $this->titleFormatter->getPrefixedDBkey( $title ),
114 'id' => $data[
'edit'][
'newrevid'],
115 'timestamp' => $data[
'edit'][
'newtimestamp'],
121 'content_model' => $data[
'edit'][
'contentmodel'],
122 'source' => $content->serialize(),
132 if ( $code ===
'protectedpage' ) {
136 if ( $code ===
'badtoken' ) {
140 if ( $code ===
'missingtitle' ) {
144 if ( $code ===
'articleexists' ) {
148 if ( $code ===
'editconflict' ) {
152 if ( $code ===
'ratelimited' ) {
157 parent::throwHttpExceptionForActionModuleError( $msg, $statusCode );
162 array $actionModuleResult,
165 parent::mapActionModuleResponse(
166 $actionModuleResponse,
171 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()
Interface for messages with machine-readable data for use by the API.
getApiCode()
Returns a machine-readable code for use by the API.