MediaWiki 1.42.1
|
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 content model change 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 content model change. | |
setMessagePrefix ( $msgPrefix) | |
setTags ( $tags) | |
Specify the tags the user wants to add, and check permissions. | |
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.
Definition at line 26 of file ContentModelChange.php.
ContentModelChange::__construct | ( | IContentHandlerFactory | $contentHandlerFactory, |
HookContainer | $hookContainer, | ||
RevisionLookup | $revLookup, | ||
UserFactory | $userFactory, | ||
Authority | $performer, | ||
WikiPage | $page, | ||
string | $newModel ) |
IContentHandlerFactory | $contentHandlerFactory | |
HookContainer | $hookContainer | |
RevisionLookup | $revLookup | |
UserFactory | $userFactory | |
Authority | $performer | |
WikiPage | $page | |
string | $newModel |
Definition at line 62 of file ContentModelChange.php.
ContentModelChange::authorizeChange | ( | ) |
Authorize the content model change by $performer.
self::probablyCanChange
instead.Definition at line 142 of file ContentModelChange.php.
ContentModelChange::checkPermissions | ( | ) |
Check user can edit and editcontentmodel before and after.
Definition at line 156 of file ContentModelChange.php.
References MediaWiki\Permissions\PermissionStatus\toLegacyErrorArray(), and wfDeprecated().
ContentModelChange::doContentModelChange | ( | IContextSource | $context, |
string | $comment, | ||
$bot ) |
Handle change and logging after validation.
Can still be intercepted by hooks
IContextSource | $context | |
string | $comment | |
bool | $bot | Mark as a bot edit if the user can |
Definition at line 254 of file ContentModelChange.php.
References EDIT_FORCE_BOT, EDIT_INTERNAL, EDIT_NEW, EDIT_UPDATE, and wfMessage().
ContentModelChange::probablyCanChange | ( | ) |
Check whether $performer can execute the content model change.
self::authorizeChange
instead.Definition at line 125 of file ContentModelChange.php.
ContentModelChange::setMessagePrefix | ( | $msgPrefix | ) |
string | $msgPrefix |
Definition at line 95 of file ContentModelChange.php.
ContentModelChange::setTags | ( | $tags | ) |
Specify the tags the user wants to add, and check permissions.
string[] | $tags |
Definition at line 171 of file ContentModelChange.php.
References ChangeTags\canAddTagsAccompanyingChange().