12use MediaWiki\Rest\TokenAwareHandlerTrait;
24 use TokenAwareHandlerTrait;
85 if ( isset( $data[
'error'] ) ) {
89 if ( !isset( $data[
'edit'] ) || !$data[
'edit'][
'result'] ) {
90 throw new HttpException(
'Bad result structure received from ApiEditPage' );
93 if ( $data[
'edit'][
'result'] !==
'Success' ) {
99 $title = $this->titleParser->parseTitle( $data[
'edit'][
'title'] );
103 $revision = $this->revisionLookup->getRevisionById( (
int)$data[
'edit'][
'newrevid'] );
104 $content = $revision->getContent( SlotRecord::MAIN );
107 'id' => $data[
'edit'][
'pageid'],
108 'title' => $this->titleFormatter->getPrefixedText(
$title ),
109 'key' => $this->titleFormatter->getPrefixedDBkey(
$title ),
111 'id' => $data[
'edit'][
'newrevid'],
112 'timestamp' => $data[
'edit'][
'newtimestamp'],
118 'content_model' => $data[
'edit'][
'contentmodel'],
129 if ( $code ===
'protectedpage' ) {
133 if ( $code ===
'badtoken' ) {
137 if ( $code ===
'missingtitle' ) {
141 if ( $code ===
'articleexists' ) {
145 if ( $code ===
'editconflict' ) {
149 if ( $code ===
'ratelimited' ) {
154 parent::throwHttpExceptionForActionModuleError( $msg, $statusCode );
159 array $actionModuleResult,
162 parent::mapActionModuleResponse(
163 $actionModuleResponse,
168 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.