MediaWiki master
MediaWiki\Page\RollbackPage Class Reference

Backend logic for performing a page rollback action. More...

Public Member Functions

 __construct (ServiceOptions $options, IConnectionProvider $dbProvider, UserFactory $userFactory, ReadOnlyMode $readOnlyMode, RevisionStore $revisionStore, TitleFormatter $titleFormatter, HookContainer $hookContainer, WikiPageFactory $wikiPageFactory, ActorMigration $actorMigration, ActorNormalization $actorNormalization, PageIdentity $page, Authority $performer, UserIdentity $byUser)
 
 authorizeRollback ()
 Authorize the rollback.
 
 markAsBot (?bool $bot)
 Mark all reverted edits as bot.
 
 rollback ()
 Backend implementation of rollbackIfAllowed().
 
 rollbackIfAllowed ()
 Rollback the most recent consecutive set of edits to a page from the same user; fails if there are no eligible edits to roll back to, e.g.
 
 setChangeTags (?array $tags)
 Change tags to apply to the rollback.
 
 setSummary (?string $summary)
 Set custom edit summary.
 

Detailed Description

Backend logic for performing a page rollback action.

Since
1.37

Definition at line 58 of file RollbackPage.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Page\RollbackPage::__construct ( ServiceOptions  $options,
IConnectionProvider  $dbProvider,
UserFactory  $userFactory,
ReadOnlyMode  $readOnlyMode,
RevisionStore  $revisionStore,
TitleFormatter  $titleFormatter,
HookContainer  $hookContainer,
WikiPageFactory  $wikiPageFactory,
ActorMigration  $actorMigration,
ActorNormalization  $actorNormalization,
PageIdentity  $page,
Authority  $performer,
UserIdentity  $byUser 
)
Access: internal
Create via the RollbackPageFactory service.
Parameters
ServiceOptions$options
IConnectionProvider$dbProvider
UserFactory$userFactory
ReadOnlyMode$readOnlyMode
RevisionStore$revisionStore
TitleFormatter$titleFormatter
HookContainer$hookContainer
WikiPageFactory$wikiPageFactory
ActorMigration$actorMigration
ActorNormalization$actorNormalization
PageIdentity$page
Authority$performer
UserIdentity$byUserwho made the edits we are rolling back

Definition at line 133 of file RollbackPage.php.

References MediaWiki\Config\ServiceOptions\assertRequiredOptions().

Member Function Documentation

◆ authorizeRollback()

MediaWiki\Page\RollbackPage::authorizeRollback ( )

Authorize the rollback.

Returns
PermissionStatus

Definition at line 209 of file RollbackPage.php.

References StatusValue\fatal().

◆ markAsBot()

MediaWiki\Page\RollbackPage::markAsBot ( ?bool  $bot)

Mark all reverted edits as bot.

Parameters
bool | null$bot
Returns
$this

Definition at line 182 of file RollbackPage.php.

◆ rollback()

MediaWiki\Page\RollbackPage::rollback ( )

Backend implementation of rollbackIfAllowed().

Note
This function does NOT check ANY permissions, it just commits the rollback to the DB. Therefore, you should only call this function directly if you want to use custom permissions checks. If you don't, use ::rollbackIfAllowed() instead.
Returns
StatusValue On success, wrapping the array with the following keys: 'summary' - rollback edit summary 'current-revision-record' - revision record that was current before rollback 'target-revision-record' - revision record we are rolling back to 'newid' => the id of the rollback revision 'tags' => the tags applied to the rollback

Definition at line 253 of file RollbackPage.php.

References EDIT_FORCE_BOT, EDIT_INTERNAL, EDIT_MINOR, and EDIT_UPDATE.

◆ rollbackIfAllowed()

MediaWiki\Page\RollbackPage::rollbackIfAllowed ( )

Rollback the most recent consecutive set of edits to a page from the same user; fails if there are no eligible edits to roll back to, e.g.

user is the sole contributor. This function performs permissions checks and executes ::rollback.

Returns
StatusValue see ::rollback for return value documentation. In case the rollback is not allowed, PermissionStatus is returned.

Definition at line 230 of file RollbackPage.php.

◆ setChangeTags()

MediaWiki\Page\RollbackPage::setChangeTags ( ?array  $tags)

Change tags to apply to the rollback.

Note
Callers are responsible for permission checks (with ChangeTags::canAddTagsAccompanyingChange)
Parameters
string[] | null$tags
Returns
$this

Definition at line 199 of file RollbackPage.php.

◆ setSummary()

MediaWiki\Page\RollbackPage::setSummary ( ?string  $summary)

Set custom edit summary.

Parameters
string | null$summary
Returns
$this

Definition at line 171 of file RollbackPage.php.


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