MediaWiki REL1_37
MediaWiki\Page\RollbackPage Class Reference
Collaboration diagram for MediaWiki\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.
 
 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.
 

Private Member Functions

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

Private Attributes

ActorMigration $actorMigration
 
ActorNormalization $actorNormalization
 
bool $bot = false
 
UserIdentity $byUser
 who made the edits we are rolling back
 
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

Definition at line 55 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 
)
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 129 of file RollbackPage.php.

References MediaWiki\Page\RollbackPage\$actorMigration, MediaWiki\Page\RollbackPage\$actorNormalization, MediaWiki\Page\RollbackPage\$byUser, MediaWiki\Page\RollbackPage\$loadBalancer, MediaWiki\Page\RollbackPage\$options, MediaWiki\Page\RollbackPage\$page, MediaWiki\Page\RollbackPage\$performer, MediaWiki\Page\RollbackPage\$readOnlyMode, MediaWiki\Page\RollbackPage\$revisionStore, MediaWiki\Page\RollbackPage\$titleFormatter, MediaWiki\Page\RollbackPage\$userFactory, MediaWiki\Page\RollbackPage\$wikiPageFactory, and MediaWiki\Config\ServiceOptions\assertRequiredOptions().

Member Function Documentation

◆ authorizeRollback()

MediaWiki\Page\RollbackPage::authorizeRollback ( )

Authorize the rollback.

Returns
PermissionStatus

Definition at line 205 of file RollbackPage.php.

References StatusValue\fatal().

◆ getSummary()

MediaWiki\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 482 of file RollbackPage.php.

◆ markAsBot()

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

Mark all reverted edits as bot.

Parameters
bool | null$bot
Returns
$this

Definition at line 178 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 DB_PRIMARY, 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 195 of file RollbackPage.php.

◆ setSummary()

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

Set custom edit summary.

Parameters
string | null$summary
Returns
$this

Definition at line 167 of file RollbackPage.php.

◆ updateRecentChange()

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

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

Parameters
IDatabase$dbw
RevisionRecord$current
RevisionRecord$target

Definition at line 443 of file RollbackPage.php.

References Wikimedia\Rdbms\IDatabase\addQuotes(), MediaWiki\Revision\RevisionRecord\getPageId(), MediaWiki\Revision\RevisionRecord\getTimestamp(), MediaWiki\Revision\RevisionRecord\getUser(), Wikimedia\Rdbms\IDatabase\timestamp(), and Wikimedia\Rdbms\IDatabase\update().

Member Data Documentation

◆ $actorMigration

ActorMigration MediaWiki\Page\RollbackPage::$actorMigration
private

Definition at line 91 of file RollbackPage.php.

Referenced by MediaWiki\Page\RollbackPage\__construct().

◆ $actorNormalization

ActorNormalization MediaWiki\Page\RollbackPage::$actorNormalization
private

Definition at line 94 of file RollbackPage.php.

Referenced by MediaWiki\Page\RollbackPage\__construct().

◆ $bot

bool MediaWiki\Page\RollbackPage::$bot = false
private

Definition at line 109 of file RollbackPage.php.

◆ $byUser

UserIdentity MediaWiki\Page\RollbackPage::$byUser
private

who made the edits we are rolling back

Definition at line 103 of file RollbackPage.php.

Referenced by MediaWiki\Page\RollbackPage\__construct().

◆ $hookRunner

HookRunner MediaWiki\Page\RollbackPage::$hookRunner
private

Definition at line 85 of file RollbackPage.php.

◆ $loadBalancer

ILoadBalancer MediaWiki\Page\RollbackPage::$loadBalancer
private

Definition at line 70 of file RollbackPage.php.

Referenced by MediaWiki\Page\RollbackPage\__construct().

◆ $options

ServiceOptions MediaWiki\Page\RollbackPage::$options
private
Initial value:
=[,,]
public const CONSTRUCTOR_OPTIONS
'UseRCPatrol'
'DisableAnonTalk'

Definition at line 67 of file RollbackPage.php.

Referenced by MediaWiki\Page\RollbackPage\__construct().

◆ $page

PageIdentity MediaWiki\Page\RollbackPage::$page
private

Definition at line 97 of file RollbackPage.php.

Referenced by MediaWiki\Page\RollbackPage\__construct().

◆ $performer

Authority MediaWiki\Page\RollbackPage::$performer
private

Definition at line 100 of file RollbackPage.php.

Referenced by MediaWiki\Page\RollbackPage\__construct().

◆ $readOnlyMode

ReadOnlyMode MediaWiki\Page\RollbackPage::$readOnlyMode
private

Definition at line 76 of file RollbackPage.php.

Referenced by MediaWiki\Page\RollbackPage\__construct().

◆ $revisionStore

RevisionStore MediaWiki\Page\RollbackPage::$revisionStore
private

Definition at line 82 of file RollbackPage.php.

Referenced by MediaWiki\Page\RollbackPage\__construct().

◆ $summary

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

Definition at line 106 of file RollbackPage.php.

◆ $tags

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

Definition at line 112 of file RollbackPage.php.

◆ $titleFormatter

TitleFormatter MediaWiki\Page\RollbackPage::$titleFormatter
private

Definition at line 79 of file RollbackPage.php.

Referenced by MediaWiki\Page\RollbackPage\__construct().

◆ $userFactory

UserFactory MediaWiki\Page\RollbackPage::$userFactory
private

Definition at line 73 of file RollbackPage.php.

Referenced by MediaWiki\Page\RollbackPage\__construct().

◆ $wikiPageFactory

WikiPageFactory MediaWiki\Page\RollbackPage::$wikiPageFactory
private

Definition at line 88 of file RollbackPage.php.

Referenced by MediaWiki\Page\RollbackPage\__construct().


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