MediaWiki master
MediaWiki\Content\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, WikiPageFactory $wikiPageFactory, LogFormatterFactory $logFormatterFactory, Authority $performer, PageIdentity $page, string $newModel)
 
 authorizeChange ()
 Authorize the content model change by $performer.
 
 doContentModelChange (IContextSource $context, string $comment, $bot)
 Handle change and logging after validation.
 
 probablyCanChange ()
 Check whether $performer can execute the content model change.
 
 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 34 of file ContentModelChange.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Content\ContentModelChange::__construct ( IContentHandlerFactory $contentHandlerFactory,
HookContainer $hookContainer,
RevisionLookup $revLookup,
UserFactory $userFactory,
WikiPageFactory $wikiPageFactory,
LogFormatterFactory $logFormatterFactory,
Authority $performer,
PageIdentity $page,
string $newModel )
Access: internal
Create via the ContentModelChangeFactory service.

Definition at line 58 of file ContentModelChange.php.

References MediaWiki\Page\WikiPageFactory\newFromTitle().

Member Function Documentation

◆ authorizeChange()

MediaWiki\Content\ContentModelChange::authorizeChange ( )

Authorize the content model change by $performer.

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

Definition at line 144 of file ContentModelChange.php.

◆ doContentModelChange()

MediaWiki\Content\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

Definition at line 245 of file ContentModelChange.php.

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

◆ probablyCanChange()

MediaWiki\Content\ContentModelChange::probablyCanChange ( )

Check whether $performer can execute the content model change.

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

Definition at line 127 of file ContentModelChange.php.

◆ setMessagePrefix()

MediaWiki\Content\ContentModelChange::setMessagePrefix ( $msgPrefix)
Parameters
string$msgPrefix

Definition at line 95 of file ContentModelChange.php.

◆ setTags()

MediaWiki\Content\ContentModelChange::setTags ( $tags)

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

Parameters
string[]$tags
Returns
Status

Definition at line 159 of file ContentModelChange.php.


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