MediaWiki  master
MediaWiki\Page\RollbackPage Class Reference

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

Public Member Functions

 __construct (ServiceOptions $options, ILoadBalancer $loadBalancer, 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. More...
 
 markAsBot (?bool $bot)
 Mark all reverted edits as bot. More...
 
 rollback ()
 Backend implementation of rollbackIfAllowed(). More...
 
 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. More...
 
 setChangeTags (?array $tags)
 Change tags to apply to the rollback. More...
 
 setSummary (?string $summary)
 Set custom edit summary. More...
 

Detailed Description

Backend logic for performing a page rollback action.

Since
1.37

Definition at line 56 of file RollbackPage.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Page\RollbackPage::__construct ( ServiceOptions  $options,
ILoadBalancer  $loadBalancer,
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
ILoadBalancer$loadBalancer
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 131 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 207 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 180 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 255 of file RollbackPage.php.

References DB_PRIMARY, EDIT_FORCE_BOT, EDIT_INTERNAL, EDIT_MINOR, EDIT_UPDATE, StatusValue\newFatal(), StatusValue\newGood(), and RecentChange\PRC_AUTOPATROLLED.

◆ 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 232 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 197 of file RollbackPage.php.

◆ setSummary()

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

Set custom edit summary.

Parameters
string | null$summary
Returns
$this

Definition at line 169 of file RollbackPage.php.


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