MediaWiki REL1_34
ApiEditPage.php
Go to the documentation of this file.
1<?php
25
35class ApiEditPage extends ApiBase {
36 public function execute() {
38
39 $user = $this->getUser();
40 $params = $this->extractRequestParams();
41
42 $this->requireAtLeastOneParameter( $params, 'text', 'appendtext', 'prependtext', 'undo' );
43
44 $pageObj = $this->getTitleOrPageId( $params );
45 $titleObj = $pageObj->getTitle();
46 $apiResult = $this->getResult();
47
48 if ( $params['redirect'] ) {
49 if ( $params['prependtext'] === null && $params['appendtext'] === null
50 && $params['section'] !== 'new'
51 ) {
52 $this->dieWithError( 'apierror-redirect-appendonly' );
53 }
54 if ( $titleObj->isRedirect() ) {
55 $oldTitle = $titleObj;
56
57 $titles = Revision::newFromTitle( $oldTitle, false, Revision::READ_LATEST )
58 ->getContent( RevisionRecord::FOR_THIS_USER, $user )
59 ->getRedirectChain();
60 // array_shift( $titles );
61
62 $redirValues = [];
63
65 foreach ( $titles as $id => $newTitle ) {
66 $titles[$id - 1] = $titles[$id - 1] ?? $oldTitle;
67
68 $redirValues[] = [
69 'from' => $titles[$id - 1]->getPrefixedText(),
70 'to' => $newTitle->getPrefixedText()
71 ];
72
73 $titleObj = $newTitle;
74
75 // T239428: Check whether the new title is valid
76 if ( $titleObj->isExternal() || !$titleObj->canExist() ) {
77 $redirValues[count( $redirValues ) - 1]['to'] = $titleObj->getFullText();
78 $this->dieWithError(
79 [
80 'apierror-edit-invalidredirect',
81 Message::plaintextParam( $oldTitle->getPrefixedText() ),
82 Message::plaintextParam( $titleObj->getFullText() ),
83 ],
84 'edit-invalidredirect',
85 [ 'redirects' => $redirValues ]
86 );
87 }
88 }
89
90 ApiResult::setIndexedTagName( $redirValues, 'r' );
91 $apiResult->addValue( null, 'redirects', $redirValues );
92
93 // Since the page changed, update $pageObj
94 $pageObj = WikiPage::factory( $titleObj );
95 }
96 }
97
98 if ( !isset( $params['contentmodel'] ) || $params['contentmodel'] == '' ) {
99 $contentHandler = $pageObj->getContentHandler();
100 } else {
101 $contentHandler = ContentHandler::getForModelID( $params['contentmodel'] );
102 }
103 $contentModel = $contentHandler->getModelID();
104
105 $name = $titleObj->getPrefixedDBkey();
106 $model = $contentHandler->getModelID();
107
108 if ( $params['undo'] > 0 ) {
109 // allow undo via api
110 } elseif ( $contentHandler->supportsDirectApiEditing() === false ) {
111 $this->dieWithError( [ 'apierror-no-direct-editing', $model, $name ] );
112 }
113
114 if ( !isset( $params['contentformat'] ) || $params['contentformat'] == '' ) {
115 $contentFormat = $contentHandler->getDefaultFormat();
116 } else {
117 $contentFormat = $params['contentformat'];
118 }
119
120 if ( !$contentHandler->isSupportedFormat( $contentFormat ) ) {
121 $this->dieWithError( [ 'apierror-badformat', $contentFormat, $model, $name ] );
122 }
123
124 if ( $params['createonly'] && $titleObj->exists() ) {
125 $this->dieWithError( 'apierror-articleexists' );
126 }
127 if ( $params['nocreate'] && !$titleObj->exists() ) {
128 $this->dieWithError( 'apierror-missingtitle' );
129 }
130
131 // Now let's check whether we're even allowed to do this
133 $titleObj,
134 $titleObj->exists() ? 'edit' : [ 'edit', 'create' ],
135 [ 'autoblock' => true ]
136 );
137
138 $toMD5 = $params['text'];
139 if ( !is_null( $params['appendtext'] ) || !is_null( $params['prependtext'] ) ) {
140 $content = $pageObj->getContent();
141
142 if ( !$content ) {
143 if ( $titleObj->getNamespace() == NS_MEDIAWIKI ) {
144 # If this is a MediaWiki:x message, then load the messages
145 # and return the message value for x.
146 $text = $titleObj->getDefaultMessageText();
147 if ( $text === false ) {
148 $text = '';
149 }
150
151 try {
152 $content = ContentHandler::makeContent( $text, $titleObj );
153 } catch ( MWContentSerializationException $ex ) {
154 $this->dieWithException( $ex, [
155 'wrap' => ApiMessage::create( 'apierror-contentserializationexception', 'parseerror' )
156 ] );
157 return;
158 }
159 } else {
160 # Otherwise, make a new empty content.
161 $content = $contentHandler->makeEmptyContent();
162 }
163 }
164
165 // @todo Add support for appending/prepending to the Content interface
166
167 if ( !( $content instanceof TextContent ) ) {
168 $modelName = $contentHandler->getModelID();
169 $this->dieWithError( [ 'apierror-appendnotsupported', $modelName ] );
170 }
171
172 if ( !is_null( $params['section'] ) ) {
173 if ( !$contentHandler->supportsSections() ) {
174 $modelName = $contentHandler->getModelID();
175 $this->dieWithError( [ 'apierror-sectionsnotsupported', $modelName ] );
176 }
177
178 if ( $params['section'] == 'new' ) {
179 // DWIM if they're trying to prepend/append to a new section.
180 $content = null;
181 } else {
182 // Process the content for section edits
183 $section = $params['section'];
184 $content = $content->getSection( $section );
185
186 if ( !$content ) {
187 $this->dieWithError( [ 'apierror-nosuchsection', wfEscapeWikiText( $section ) ] );
188 }
189 }
190 }
191
192 if ( !$content ) {
193 $text = '';
194 } else {
195 $text = $content->serialize( $contentFormat );
196 }
197
198 $params['text'] = $params['prependtext'] . $text . $params['appendtext'];
199 $toMD5 = $params['prependtext'] . $params['appendtext'];
200 }
201
202 if ( $params['undo'] > 0 ) {
203 if ( $params['undoafter'] > 0 ) {
204 if ( $params['undo'] < $params['undoafter'] ) {
205 list( $params['undo'], $params['undoafter'] ) =
206 [ $params['undoafter'], $params['undo'] ];
207 }
208 $undoafterRev = Revision::newFromId( $params['undoafter'] );
209 }
210 $undoRev = Revision::newFromId( $params['undo'] );
211 if ( is_null( $undoRev ) || $undoRev->isDeleted( RevisionRecord::DELETED_TEXT ) ) {
212 $this->dieWithError( [ 'apierror-nosuchrevid', $params['undo'] ] );
213 }
214
215 if ( $params['undoafter'] == 0 ) {
216 $undoafterRev = $undoRev->getPrevious();
217 }
218 if ( is_null( $undoafterRev ) || $undoafterRev->isDeleted( RevisionRecord::DELETED_TEXT ) ) {
219 $this->dieWithError( [ 'apierror-nosuchrevid', $params['undoafter'] ] );
220 }
221
222 if ( $undoRev->getPage() != $pageObj->getId() ) {
223 $this->dieWithError( [ 'apierror-revwrongpage', $undoRev->getId(),
224 $titleObj->getPrefixedText() ] );
225 }
226 if ( $undoafterRev->getPage() != $pageObj->getId() ) {
227 $this->dieWithError( [ 'apierror-revwrongpage', $undoafterRev->getId(),
228 $titleObj->getPrefixedText() ] );
229 }
230
231 $newContent = $contentHandler->getUndoContent(
232 $pageObj->getRevision(),
233 $undoRev,
234 $undoafterRev
235 );
236
237 if ( !$newContent ) {
238 $this->dieWithError( 'undo-failure', 'undofailure' );
239 }
240 if ( empty( $params['contentmodel'] )
241 && empty( $params['contentformat'] )
242 ) {
243 // If we are reverting content model, the new content model
244 // might not support the current serialization format, in
245 // which case go back to the old serialization format,
246 // but only if the user hasn't specified a format/model
247 // parameter.
248 if ( !$newContent->isSupportedFormat( $contentFormat ) ) {
249 $contentFormat = $undoafterRev->getContentFormat();
250 }
251 // Override content model with model of undid revision.
252 $contentModel = $newContent->getModel();
253 }
254 $params['text'] = $newContent->serialize( $contentFormat );
255 // If no summary was given and we only undid one rev,
256 // use an autosummary
257
258 if ( is_null( $params['summary'] ) ) {
259 $nextRev = MediaWikiServices::getInstance()->getRevisionLookup()
260 ->getNextRevision( $undoafterRev->getRevisionRecord() );
261 if ( $nextRev && $nextRev->getId() == $params['undo'] ) {
262 $params['summary'] = wfMessage( 'undo-summary' )
263 ->params( $params['undo'], $undoRev->getUserText() )
264 ->inContentLanguage()->text();
265 }
266 }
267 }
268
269 // See if the MD5 hash checks out
270 if ( !is_null( $params['md5'] ) && md5( $toMD5 ) !== $params['md5'] ) {
271 $this->dieWithError( 'apierror-badmd5' );
272 }
273
274 // EditPage wants to parse its stuff from a WebRequest
275 // That interface kind of sucks, but it's workable
276 $requestArray = [
277 'wpTextbox1' => $params['text'],
278 'format' => $contentFormat,
279 'model' => $contentModel,
280 'wpEditToken' => $params['token'],
281 'wpIgnoreBlankSummary' => true,
282 'wpIgnoreBlankArticle' => true,
283 'wpIgnoreSelfRedirect' => true,
284 'bot' => $params['bot'],
285 'wpUnicodeCheck' => EditPage::UNICODE_CHECK,
286 ];
287
288 if ( !is_null( $params['summary'] ) ) {
289 $requestArray['wpSummary'] = $params['summary'];
290 }
291
292 if ( !is_null( $params['sectiontitle'] ) ) {
293 $requestArray['wpSectionTitle'] = $params['sectiontitle'];
294 }
295
296 // TODO: Pass along information from 'undoafter' as well
297 if ( $params['undo'] > 0 ) {
298 $requestArray['wpUndidRevision'] = $params['undo'];
299 }
300
301 // Watch out for basetimestamp == '' or '0'
302 // It gets treated as NOW, almost certainly causing an edit conflict
303 if ( $params['basetimestamp'] !== null && (bool)$this->getMain()->getVal( 'basetimestamp' ) ) {
304 $requestArray['wpEdittime'] = $params['basetimestamp'];
305 } else {
306 $requestArray['wpEdittime'] = $pageObj->getTimestamp();
307 }
308
309 if ( $params['starttimestamp'] !== null ) {
310 $requestArray['wpStarttime'] = $params['starttimestamp'];
311 } else {
312 $requestArray['wpStarttime'] = wfTimestampNow(); // Fake wpStartime
313 }
314
315 if ( $params['minor'] || ( !$params['notminor'] && $user->getOption( 'minordefault' ) ) ) {
316 $requestArray['wpMinoredit'] = '';
317 }
318
319 if ( $params['recreate'] ) {
320 $requestArray['wpRecreate'] = '';
321 }
322
323 if ( !is_null( $params['section'] ) ) {
324 $section = $params['section'];
325 if ( !preg_match( '/^((T-)?\d+|new)$/', $section ) ) {
326 $this->dieWithError( 'apierror-invalidsection' );
327 }
328 $content = $pageObj->getContent();
329 if ( $section !== '0' && $section != 'new'
330 && ( !$content || !$content->getSection( $section ) )
331 ) {
332 $this->dieWithError( [ 'apierror-nosuchsection', $section ] );
333 }
334 $requestArray['wpSection'] = $params['section'];
335 } else {
336 $requestArray['wpSection'] = '';
337 }
338
339 $watch = $this->getWatchlistValue( $params['watchlist'], $titleObj );
340
341 // Deprecated parameters
342 if ( $params['watch'] ) {
343 $watch = true;
344 } elseif ( $params['unwatch'] ) {
345 $watch = false;
346 }
347
348 if ( $watch ) {
349 $requestArray['wpWatchthis'] = '';
350 }
351
352 // Apply change tags
353 if ( $params['tags'] ) {
354 $tagStatus = ChangeTags::canAddTagsAccompanyingChange( $params['tags'], $user );
355 if ( $tagStatus->isOK() ) {
356 $requestArray['wpChangeTags'] = implode( ',', $params['tags'] );
357 } else {
358 $this->dieStatus( $tagStatus );
359 }
360 }
361
362 // Pass through anything else we might have been given, to support extensions
363 // This is kind of a hack but it's the best we can do to make extensions work
364 $requestArray += $this->getRequest()->getValues();
365
366 global $wgTitle, $wgRequest;
367
368 $req = new DerivativeRequest( $this->getRequest(), $requestArray, true );
369
370 // Some functions depend on $wgTitle == $ep->mTitle
371 // TODO: Make them not or check if they still do
372 $wgTitle = $titleObj;
373
374 $articleContext = new RequestContext;
375 $articleContext->setRequest( $req );
376 $articleContext->setWikiPage( $pageObj );
377 $articleContext->setUser( $this->getUser() );
378
380 $articleObject = Article::newFromWikiPage( $pageObj, $articleContext );
381
382 $ep = new EditPage( $articleObject );
383
384 $ep->setApiEditOverride( true );
385 $ep->setContextTitle( $titleObj );
386 $ep->importFormData( $req );
387 $content = $ep->textbox1;
388
389 // Do the actual save
390 $oldRevId = $articleObject->getRevIdFetched();
391 $result = null;
392 // Fake $wgRequest for some hooks inside EditPage
393 // @todo FIXME: This interface SUCKS
394 $oldRequest = $wgRequest;
395 $wgRequest = $req;
396
397 $status = $ep->attemptSave( $result );
398 $wgRequest = $oldRequest;
399
400 $r = [];
401 switch ( $status->value ) {
404 if ( isset( $status->apiHookResult ) ) {
405 $r = $status->apiHookResult;
406 $r['result'] = 'Failure';
407 $apiResult->addValue( null, $this->getModuleName(), $r );
408 return;
409 }
410 if ( !$status->getErrors() ) {
411 // This appears to be unreachable right now, because all
412 // code paths will set an error. Could change, though.
413 $status->fatal( 'hookaborted' ); //@codeCoverageIgnore
414 }
415 $this->dieStatus( $status );
416
417 // These two cases will normally have been caught earlier, and will
418 // only occur if something blocks the user between the earlier
419 // check and the check in EditPage (presumably a hook). It's not
420 // obvious that this is even possible.
421 // @codeCoverageIgnoreStart
423 $this->dieBlocked( $user->getBlock() );
424
426 $this->dieReadOnly();
427 // @codeCoverageIgnoreEnd
428
430 $r['new'] = true;
431 // fall-through
432
434 $r['result'] = 'Success';
435 $r['pageid'] = (int)$titleObj->getArticleID();
436 $r['title'] = $titleObj->getPrefixedText();
437 $r['contentmodel'] = $articleObject->getContentModel();
438 $newRevId = $articleObject->getLatest();
439 if ( $newRevId == $oldRevId ) {
440 $r['nochange'] = true;
441 } else {
442 $r['oldrevid'] = (int)$oldRevId;
443 $r['newrevid'] = (int)$newRevId;
444 $r['newtimestamp'] = wfTimestamp( TS_ISO_8601,
445 $pageObj->getTimestamp() );
446 }
447 break;
448
449 default:
450 if ( !$status->getErrors() ) {
451 // EditPage sometimes only sets the status code without setting
452 // any actual error messages. Supply defaults for those cases.
453 switch ( $status->value ) {
454 // Currently needed
456 $status->fatal( 'apierror-noimageredirect-anon' );
457 break;
459 $status->fatal( 'apierror-noimageredirect' );
460 break;
463 $status->fatal( 'apierror-contenttoobig', $this->getConfig()->get( 'MaxArticleSize' ) );
464 break;
466 $status->fatal( 'apierror-noedit-anon' );
467 break;
469 $status->fatal( 'apierror-cantchangecontentmodel' );
470 break;
472 $status->fatal( 'apierror-pagedeleted' );
473 break;
475 $status->fatal( 'editconflict' );
476 break;
477
478 // Currently shouldn't be needed, but here in case
479 // hooks use them without setting appropriate
480 // errors on the status.
481 // @codeCoverageIgnoreStart
483 $status->fatal( 'apierror-spamdetected', $result['spam'] );
484 break;
486 $status->fatal( 'apierror-noedit' );
487 break;
489 $status->fatal( 'apierror-ratelimited' );
490 break;
492 $status->fatal( 'nocreate-loggedin' );
493 break;
495 $status->fatal( 'apierror-emptypage' );
496 break;
498 $status->fatal( 'apierror-emptynewsection' );
499 break;
501 $status->fatal( 'apierror-summaryrequired' );
502 break;
503 default:
504 wfWarn( __METHOD__ . ": Unknown EditPage code {$status->value} with no message" );
505 $status->fatal( 'apierror-unknownerror-editpage', $status->value );
506 break;
507 // @codeCoverageIgnoreEnd
508 }
509 }
510 $this->dieStatus( $status );
511 }
512 $apiResult->addValue( null, $this->getModuleName(), $r );
513 }
514
515 public function mustBePosted() {
516 return true;
517 }
518
519 public function isWriteMode() {
520 return true;
521 }
522
523 public function getAllowedParams() {
524 return [
525 'title' => [
526 ApiBase::PARAM_TYPE => 'string',
527 ],
528 'pageid' => [
529 ApiBase::PARAM_TYPE => 'integer',
530 ],
531 'section' => null,
532 'sectiontitle' => [
533 ApiBase::PARAM_TYPE => 'string',
534 ],
535 'text' => [
536 ApiBase::PARAM_TYPE => 'text',
537 ],
538 'summary' => null,
539 'tags' => [
540 ApiBase::PARAM_TYPE => 'tags',
542 ],
543 'minor' => false,
544 'notminor' => false,
545 'bot' => false,
546 'basetimestamp' => [
547 ApiBase::PARAM_TYPE => 'timestamp',
548 ],
549 'starttimestamp' => [
550 ApiBase::PARAM_TYPE => 'timestamp',
551 ],
552 'recreate' => false,
553 'createonly' => false,
554 'nocreate' => false,
555 'watch' => [
556 ApiBase::PARAM_DFLT => false,
558 ],
559 'unwatch' => [
560 ApiBase::PARAM_DFLT => false,
562 ],
563 'watchlist' => [
564 ApiBase::PARAM_DFLT => 'preferences',
566 'watch',
567 'unwatch',
568 'preferences',
569 'nochange'
570 ],
571 ],
572 'md5' => null,
573 'prependtext' => [
574 ApiBase::PARAM_TYPE => 'text',
575 ],
576 'appendtext' => [
577 ApiBase::PARAM_TYPE => 'text',
578 ],
579 'undo' => [
580 ApiBase::PARAM_TYPE => 'integer',
583 ],
584 'undoafter' => [
585 ApiBase::PARAM_TYPE => 'integer',
588 ],
589 'redirect' => [
590 ApiBase::PARAM_TYPE => 'boolean',
591 ApiBase::PARAM_DFLT => false,
592 ],
593 'contentformat' => [
594 ApiBase::PARAM_TYPE => ContentHandler::getAllContentFormats(),
595 ],
596 'contentmodel' => [
597 ApiBase::PARAM_TYPE => ContentHandler::getContentModels(),
598 ],
599 'token' => [
600 // Standard definition automatically inserted
601 ApiBase::PARAM_HELP_MSG_APPEND => [ 'apihelp-edit-param-token' ],
602 ],
603 ];
604 }
605
606 public function needsToken() {
607 return 'csrf';
608 }
609
610 protected function getExamplesMessages() {
611 return [
612 'action=edit&title=Test&summary=test%20summary&' .
613 'text=article%20content&basetimestamp=2007-08-24T12:34:54Z&token=123ABC'
614 => 'apihelp-edit-example-edit',
615 'action=edit&title=Test&summary=NOTOC&minor=&' .
616 'prependtext=__NOTOC__%0A&basetimestamp=2007-08-24T12:34:54Z&token=123ABC'
617 => 'apihelp-edit-example-prepend',
618 'action=edit&title=Test&undo=13585&undoafter=13579&' .
619 'basetimestamp=2007-08-24T12:34:54Z&token=123ABC'
620 => 'apihelp-edit-example-undo',
621 ];
622 }
623
624 public function getHelpUrls() {
625 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Edit';
626 }
627}
wfWarn( $msg, $callerOffset=1, $level=E_USER_NOTICE)
Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings.
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
if(! $wgDBerrorLogTZ) $wgRequest
Definition Setup.php:751
if(! $wgRequest->checkUrlExtension()) if(isset( $_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'] !='') $wgTitle
Definition api.php:58
This abstract class implements many basic API functions, and is the base of all API classes.
Definition ApiBase.php:42
const PARAM_DEPRECATED
(boolean) Is the parameter deprecated (will show a warning)?
Definition ApiBase.php:112
dieWithError( $msg, $code=null, $data=null, $httpCode=null)
Abort execution with an error.
Definition ApiBase.php:2014
checkTitleUserPermissions(LinkTarget $linkTarget, $actions, $options=[])
Helper function for permission-denied errors.
Definition ApiBase.php:2156
getMain()
Get the main module.
Definition ApiBase.php:536
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
Definition ApiBase.php:94
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
Definition ApiBase.php:55
const PARAM_HELP_MSG_APPEND
((string|array|Message)[]) Specify additional i18n messages to append to the normal message for this ...
Definition ApiBase.php:138
dieReadOnly()
Helper function for readonly errors.
Definition ApiBase.php:2114
const PARAM_MIN
(integer) Lowest value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
Definition ApiBase.php:106
dieBlocked(AbstractBlock $block)
Throw an ApiUsageException, which will (if uncaught) call the main module's error handler and die wit...
Definition ApiBase.php:2055
getResult()
Get the result object.
Definition ApiBase.php:640
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
Definition ApiBase.php:761
const PARAM_RANGE_ENFORCE
(boolean) For PARAM_TYPE 'integer', enforce PARAM_MIN and PARAM_MAX?
Definition ApiBase.php:124
getWatchlistValue( $watchlist, $titleObj, $userOption=null)
Return true if we're to watch the page, false if not, null if no change.
Definition ApiBase.php:1099
dieWithException( $exception, array $options=[])
Abort execution with an error derived from an exception.
Definition ApiBase.php:2026
requireAtLeastOneParameter( $params, $required)
Die if none of a certain set of parameters is set and not false.
Definition ApiBase.php:959
getModuleName()
Get the name of the module being executed by this instance.
Definition ApiBase.php:520
getTitleOrPageId( $params, $load=false)
Get a WikiPage object from a title or pageid param, if possible.
Definition ApiBase.php:1034
dieStatus(StatusValue $status)
Throw an ApiUsageException based on the Status object.
Definition ApiBase.php:2086
useTransactionalTimeLimit()
Call wfTransactionalTimeLimit() if this request was POSTed.
Definition ApiBase.php:1871
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
Definition ApiBase.php:58
A module that allows for editing and creating pages.
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
needsToken()
Returns the token type this module requires in order to execute.
isWriteMode()
Indicates whether this module requires write mode.
mustBePosted()
Indicates whether this module must be called with a POST request.
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
getExamplesMessages()
Returns usage examples for this module.
getHelpUrls()
Return links to more detailed help pages about the module.
static create( $msg, $code=null, array $data=null)
Create an IApiMessage for the message.
static newFromWikiPage(WikiPage $page, IContextSource $context)
Create an Article object of the appropriate class for the given page.
Definition Article.php:192
static canAddTagsAccompanyingChange(array $tags, User $user=null)
Is it OK to allow the user to apply all the specified tags at the same time as they edit/make the cha...
Similar to FauxRequest, but only fakes URL parameters and method (POST or GET) and use the base reque...
The edit page/HTML interface (split from Article) The actual database and text munging is still in Ar...
Definition EditPage.php:46
const AS_HOOK_ERROR_EXPECTED
Status: A hook function returned an error.
Definition EditPage.php:70
const AS_READ_ONLY_PAGE_ANON
Status: this anonymous user is not allowed to edit this page.
Definition EditPage.php:85
const AS_MAX_ARTICLE_SIZE_EXCEEDED
Status: article is too big (> $wgMaxArticleSize), after merging in the new section.
Definition EditPage.php:138
const AS_CONFLICT_DETECTED
Status: (non-resolvable) edit conflict.
Definition EditPage.php:122
const AS_SPAM_ERROR
Status: summary contained spam according to one of the regexes in $wgSummarySpamRegex.
Definition EditPage.php:148
const AS_READ_ONLY_PAGE_LOGGED
Status: this logged in user is not allowed to edit this page.
Definition EditPage.php:90
const AS_BLANK_ARTICLE
Status: user tried to create a blank page and wpIgnoreBlankArticle == false.
Definition EditPage.php:117
const AS_READ_ONLY_PAGE
Status: wiki is in readonly mode (wfReadOnly() == true)
Definition EditPage.php:95
const AS_CONTENT_TOO_BIG
Status: Content too big (> $wgMaxArticleSize)
Definition EditPage.php:80
const AS_BLOCKED_PAGE_FOR_USER
Status: User is blocked from editing this page.
Definition EditPage.php:75
const AS_NO_CHANGE_CONTENT_MODEL
Status: user tried to modify the content model, but is not allowed to do that ( User::isAllowed('edit...
Definition EditPage.php:164
const AS_IMAGE_REDIRECT_LOGGED
Status: logged in user is not allowed to upload (User::isAllowed('upload') == false)
Definition EditPage.php:158
const AS_ARTICLE_WAS_DELETED
Status: article was deleted while editing and param wpRecreate == false or form was not posted.
Definition EditPage.php:106
const AS_TEXTBOX_EMPTY
Status: user tried to create a new section without content.
Definition EditPage.php:133
const AS_SUCCESS_UPDATE
Status: Article successfully updated.
Definition EditPage.php:55
const AS_IMAGE_REDIRECT_ANON
Status: anonymous user is not allowed to upload (User::isAllowed('upload') == false)
Definition EditPage.php:153
const AS_NO_CREATE_PERMISSION
Status: user tried to create this page, but is not allowed to do that ( Title->userCan('create') == f...
Definition EditPage.php:112
const AS_SUCCESS_NEW_ARTICLE
Status: Article successfully created.
Definition EditPage.php:60
const UNICODE_CHECK
Used for Unicode support checks.
Definition EditPage.php:50
const AS_RATE_LIMITED
Status: rate limiter for action 'edit' was tripped.
Definition EditPage.php:100
const AS_HOOK_ERROR
Status: Article update aborted by a hook function.
Definition EditPage.php:65
const AS_SUMMARY_NEEDED
Status: no edit summary given and the user has forceeditsummary set and the user is not editing in hi...
Definition EditPage.php:128
Exception representing a failure to serialize or unserialize a content object.
MediaWikiServices is the service locator for the application scope of MediaWiki.
Page revision base class.
static plaintextParam( $plaintext)
Definition Message.php:1104
Group all the pieces relevant to the context of a request into one instance.
setRequest(WebRequest $request)
Content object implementation for representing flat text.
Represents a title within MediaWiki.
Definition Title.php:42
const NS_MEDIAWIKI
Definition Defines.php:77
$content
Definition router.php:78
return true
Definition router.php:94