MediaWiki REL1_39
ContentModelChange Class Reference

Backend logic for changing the content model of a page. More...

Public Member Functions

 __construct (IContentHandlerFactory $contentHandlerFactory, HookContainer $hookContainer, RevisionLookup $revLookup, UserFactory $userFactory, Authority $performer, WikiPage $page, string $newModel)
 
 authorizeChange ()
 Authorize the move by $performer.
 
 checkPermissions ()
 Check user can edit and editcontentmodel before and after.
 
 doContentModelChange (IContextSource $context, string $comment, $bot)
 Handle change and logging after validation.
 
 probablyCanChange ()
 Check whether $performer can execute the move.
 
 setMessagePrefix ( $msgPrefix)
 
 setTags ( $tags)
 Specify the tags the user wants to add, and check permissions.
 

Detailed Description

Backend logic for changing the content model of a page.

Note that you can create a new page directly with a desired content model and format, e.g. via EditPage or externally from ApiEditPage.

Since
1.35
Author
DannyS712

Definition at line 22 of file ContentModelChange.php.

Constructor & Destructor Documentation

◆ __construct()

ContentModelChange::__construct ( IContentHandlerFactory $contentHandlerFactory,
HookContainer $hookContainer,
RevisionLookup $revLookup,
UserFactory $userFactory,
Authority $performer,
WikiPage $page,
string $newModel )
Access: internal
Create via the ContentModelChangeFactory service.
Parameters
IContentHandlerFactory$contentHandlerFactory
HookContainer$hookContainer
RevisionLookup$revLookup
UserFactory$userFactory
Authority$performer
WikiPage$page
string$newModel

Definition at line 58 of file ContentModelChange.php.

Member Function Documentation

◆ authorizeChange()

ContentModelChange::authorizeChange ( )

Authorize the move by $performer.

Note
this method should be used right before the actual move is performed. To check whether a current performer has the potential to move the page, use self::probablyCanChange instead.
Returns
PermissionStatus

Definition at line 138 of file ContentModelChange.php.

◆ checkPermissions()

ContentModelChange::checkPermissions ( )

Check user can edit and editcontentmodel before and after.

Deprecated
since 1.36. Use ::probablyCanChange or ::authorizeChange instead.
Returns
array from wfMergeErrorArrays

Definition at line 152 of file ContentModelChange.php.

References MediaWiki\Permissions\PermissionStatus\toLegacyErrorArray(), and wfDeprecated().

◆ doContentModelChange()

ContentModelChange::doContentModelChange ( IContextSource $context,
string $comment,
$bot )

Handle change and logging after validation.

Can still be intercepted by hooks

Parameters
IContextSource$context
string$comment
bool$botMark as a bot edit if the user can
Returns
Status
Exceptions
ThrottledError

Definition at line 251 of file ContentModelChange.php.

References $title, EDIT_FORCE_BOT, EDIT_INTERNAL, EDIT_NEW, EDIT_UPDATE, and wfMessage().

◆ probablyCanChange()

ContentModelChange::probablyCanChange ( )

Check whether $performer can execute the move.

Note
this method does not guarantee full permissions check, so it should only be used to to decide whether to show a move form. To authorize the move action use self::authorizeChange instead.
Returns
PermissionStatus

Definition at line 121 of file ContentModelChange.php.

◆ setMessagePrefix()

ContentModelChange::setMessagePrefix ( $msgPrefix)
Parameters
string$msgPrefix

Definition at line 91 of file ContentModelChange.php.

◆ setTags()

ContentModelChange::setTags ( $tags)

Specify the tags the user wants to add, and check permissions.

Parameters
string[]$tags
Returns
Status

Definition at line 167 of file ContentModelChange.php.

References ChangeTags\canAddTagsAccompanyingChange().


The documentation for this class was generated from the following file: