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 ()
 
 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.
 

Public Attributes

const CONSTRUCTOR_OPTIONS
 

Detailed Description

Backend logic for performing a page rollback action.

Since
1.37

Definition at line 57 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.

Definition at line 94 of file RollbackPage.php.

References MediaWiki\Config\ServiceOptions\assertRequiredOptions().

Member Function Documentation

◆ authorizeRollback()

MediaWiki\Page\RollbackPage::authorizeRollback ( )

Definition at line 165 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 143 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 209 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 186 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 160 of file RollbackPage.php.

◆ setSummary()

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

Set custom edit summary.

Parameters
string | null$summary
Returns
$this

Definition at line 132 of file RollbackPage.php.

Member Data Documentation

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\Page\RollbackPage::CONSTRUCTOR_OPTIONS
Initial value:
= [
]
const UseRCPatrol
Name constant for the UseRCPatrol setting, for use with Config::get()
const DisableAnonTalk
Name constant for the DisableAnonTalk setting, for use with Config::get()
Access: internal
For use in PageCommandFactory only

Definition at line 62 of file RollbackPage.php.


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