13use MediaWiki\Rest\TokenAwareHandlerTrait;
86 if ( isset( $data[
'error'] ) ) {
90 if ( !isset( $data[
'edit'] ) || !$data[
'edit'][
'result'] ) {
91 throw new RuntimeException(
'Bad result structure received from ApiEditPage' );
94 if ( $data[
'edit'][
'result'] !==
'Success' ) {
100 $title = $this->titleParser->parseTitle( $data[
'edit'][
'title'] );
104 $revision = $this->revisionLookup->getRevisionById( (
int)$data[
'edit'][
'newrevid'] );
105 $content = $revision->getContent( SlotRecord::MAIN );
108 'id' => $data[
'edit'][
'pageid'],
109 'title' => $this->titleFormatter->getPrefixedText( $title ),
110 'key' => $this->titleFormatter->getPrefixedDBkey( $title ),
112 'id' => $data[
'edit'][
'newrevid'],
113 'timestamp' => $data[
'edit'][
'newtimestamp'],
119 'content_model' => $data[
'edit'][
'contentmodel'],
120 'source' => $content->serialize(),
130 if ( $code ===
'protectedpage' ) {
134 if ( $code ===
'badtoken' ) {
138 if ( $code ===
'missingtitle' ) {
142 if ( $code ===
'articleexists' ) {
146 if ( $code ===
'editconflict' ) {
150 if ( $code ===
'ratelimited' ) {
155 parent::throwHttpExceptionForActionModuleError( $msg, $statusCode );
160 array $actionModuleResult,
163 parent::mapActionModuleResponse(
164 $actionModuleResponse,
169 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.