MediaWiki  master
Page\RollbackPage Class Reference

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

Collaboration diagram for Page\RollbackPage:

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

Private Member Functions

 getSummary (RevisionRecord $current, RevisionRecord $target)
 Generate and format summary for the rollback. More...
 
 updateRecentChange (IDatabase $dbw, RevisionRecord $current, RevisionRecord $target)
 Set patrolling and bot flag on the edits which get rolled back. More...
 

Private Attributes

ActorMigration $actorMigration
 
ActorNormalization $actorNormalization
 
bool $bot = false
 
UserIdentity $byUser
 who made the edits we are rolling back More...
 
HookRunner $hookRunner
 
ILoadBalancer $loadBalancer
 
ServiceOptions $options
 
PageIdentity $page
 
Authority $performer
 
ReadOnlyMode $readOnlyMode
 
RevisionStore $revisionStore
 
string $summary = ''
 
string[] $tags = []
 
TitleFormatter $titleFormatter
 
UserFactory $userFactory
 
WikiPageFactory $wikiPageFactory
 

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

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 Page\RollbackPage\$actorMigration, Page\RollbackPage\$actorNormalization, Page\RollbackPage\$byUser, Page\RollbackPage\$loadBalancer, Page\RollbackPage\$options, Page\RollbackPage\$page, Page\RollbackPage\$performer, Page\RollbackPage\$readOnlyMode, Page\RollbackPage\$revisionStore, Page\RollbackPage\$titleFormatter, Page\RollbackPage\$userFactory, and Page\RollbackPage\$wikiPageFactory.

Member Function Documentation

◆ authorizeRollback()

Page\RollbackPage::authorizeRollback ( )

Authorize the rollback.

Returns
PermissionStatus

Definition at line 207 of file RollbackPage.php.

◆ getSummary()

Page\RollbackPage::getSummary ( RevisionRecord  $current,
RevisionRecord  $target 
)
private

Generate and format summary for the rollback.

Parameters
RevisionRecord$current
RevisionRecord$target
Returns
string

Definition at line 526 of file RollbackPage.php.

◆ markAsBot()

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

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(), CommentStoreComment\newUnsavedComment(), and RecentChange\PRC_AUTOPATROLLED.

◆ rollbackIfAllowed()

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

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

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

Set custom edit summary.

Parameters
string | null$summary
Returns
$this

Definition at line 169 of file RollbackPage.php.

◆ updateRecentChange()

Page\RollbackPage::updateRecentChange ( IDatabase  $dbw,
RevisionRecord  $current,
RevisionRecord  $target 
)
private

Set patrolling and bot flag on the edits which get rolled back.

Parameters
IDatabase$dbw
RevisionRecord$current
RevisionRecord$target

Definition at line 438 of file RollbackPage.php.

References if, LIST_AND, LIST_OR, and RecentChange\PRC_AUTOPATROLLED.

Member Data Documentation

◆ $actorMigration

ActorMigration Page\RollbackPage::$actorMigration
private

Definition at line 92 of file RollbackPage.php.

Referenced by Page\RollbackPage\__construct().

◆ $actorNormalization

ActorNormalization Page\RollbackPage::$actorNormalization
private

Definition at line 95 of file RollbackPage.php.

Referenced by Page\RollbackPage\__construct().

◆ $bot

bool Page\RollbackPage::$bot = false
private

Definition at line 110 of file RollbackPage.php.

◆ $byUser

UserIdentity Page\RollbackPage::$byUser
private

who made the edits we are rolling back

Definition at line 104 of file RollbackPage.php.

Referenced by Page\RollbackPage\__construct().

◆ $hookRunner

HookRunner Page\RollbackPage::$hookRunner
private

Definition at line 86 of file RollbackPage.php.

◆ $loadBalancer

ILoadBalancer Page\RollbackPage::$loadBalancer
private

Definition at line 71 of file RollbackPage.php.

Referenced by Page\RollbackPage\__construct().

◆ $options

ServiceOptions Page\RollbackPage::$options
private
Initial value:
=[,,]
public const CONSTRUCTOR_OPTIONS
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()

Definition at line 68 of file RollbackPage.php.

Referenced by Page\RollbackPage\__construct().

◆ $page

PageIdentity Page\RollbackPage::$page
private

Definition at line 98 of file RollbackPage.php.

Referenced by Page\RollbackPage\__construct().

◆ $performer

Authority Page\RollbackPage::$performer
private

Definition at line 101 of file RollbackPage.php.

Referenced by Page\RollbackPage\__construct().

◆ $readOnlyMode

ReadOnlyMode Page\RollbackPage::$readOnlyMode
private

Definition at line 77 of file RollbackPage.php.

Referenced by Page\RollbackPage\__construct().

◆ $revisionStore

RevisionStore Page\RollbackPage::$revisionStore
private

Definition at line 83 of file RollbackPage.php.

Referenced by Page\RollbackPage\__construct().

◆ $summary

string Page\RollbackPage::$summary = ''
private

Definition at line 107 of file RollbackPage.php.

◆ $tags

string [] Page\RollbackPage::$tags = []
private

Definition at line 113 of file RollbackPage.php.

◆ $titleFormatter

TitleFormatter Page\RollbackPage::$titleFormatter
private

Definition at line 80 of file RollbackPage.php.

Referenced by Page\RollbackPage\__construct().

◆ $userFactory

UserFactory Page\RollbackPage::$userFactory
private

Definition at line 74 of file RollbackPage.php.

Referenced by Page\RollbackPage\__construct().

◆ $wikiPageFactory

WikiPageFactory Page\RollbackPage::$wikiPageFactory
private

Definition at line 89 of file RollbackPage.php.

Referenced by Page\RollbackPage\__construct().


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