12use MediaWiki\Rest\TokenAwareHandlerTrait;
61 if ( isset( $data[
'error'] ) ) {
65 if ( !isset( $data[
'edit'] ) || !$data[
'edit'][
'result'] ) {
66 throw new RuntimeException(
'Bad result structure received from ApiEditPage' );
69 if ( $data[
'edit'][
'result'] !==
'Success' ) {
73 new MessageValue(
"rest-edit-conflict", [ $data[
'edit'][
'result'] ] ),
78 $title = $this->titleParser->parseTitle( $data[
'edit'][
'title'] );
82 $revision = $this->revisionLookup->getRevisionById( (
int)$data[
'edit'][
'newrevid'] );
83 $content = $revision->getContent( SlotRecord::MAIN );
86 'id' => $data[
'edit'][
'pageid'],
87 'title' => $this->titleFormatter->getPrefixedText( $title ),
88 'key' => $this->titleFormatter->getPrefixedDBkey( $title ),
90 'id' => $data[
'edit'][
'newrevid'],
91 'timestamp' => $data[
'edit'][
'newtimestamp'],
97 'content_model' => $data[
'edit'][
'contentmodel'],
98 'source' => $content->serialize(),
108 if ( $code ===
'protectedpage' ) {
112 if ( $code ===
'badtoken' ) {
116 if ( $code ===
'missingtitle' ) {
120 if ( $code ===
'articleexists' ) {
124 if ( $code ===
'editconflict' ) {
128 if ( $code ===
'ratelimited' ) {
133 parent::throwHttpExceptionForActionModuleError( $msg, $statusCode );
138 array $actionModuleResult,
141 parent::mapActionModuleResponse(
142 $actionModuleResponse,
147 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.