MediaWiki  master
Page\UndeletePage Class Reference

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

Collaboration diagram for Page\UndeletePage:

Public Member Functions

 __construct (HookContainer $hookContainer, JobQueueGroup $jobQueueGroup, ILoadBalancer $loadBalancer, ReadOnlyMode $readOnlyMode, RepoGroup $repoGroup, LoggerInterface $logger, RevisionStore $revisionStore, WikiPageFactory $wikiPageFactory, PageUpdaterFactory $pageUpdaterFactory, IContentHandlerFactory $contentHandlerFactory, ArchivedRevisionLookup $archivedRevisionLookup, NamespaceInfo $namespaceInfo, ITextFormatter $contLangMsgTextFormatter, ProperPageIdentity $page, Authority $performer)
 
 canProbablyUndeleteAssociatedTalk ()
 Tests whether it's probably possible to undelete the associated talk page. More...
 
 getFileStatus ()
 
 getRevisionStatus ()
 
 setTags (array $tags)
 Change tags to add to log entry (the user should be able to add the specified tags before this is called) More...
 
 setUndeleteAssociatedTalk (bool $undelete)
 Whether to delete the associated talk page with the subject page. More...
 
 setUndeleteOnlyFileVersions (array $fileVersions)
 If you don't want to undelete all file versions, pass an array of versions to undelete. More...
 
 setUndeleteOnlyTimestamps (array $timestamps)
 If you don't want to undelete all revisions, pass an array of timestamps to undelete. More...
 
 setUnsuppress (bool $unsuppress)
 Whether to remove all ar_deleted/fa_deleted restrictions of selected revs. More...
 
 undeleteIfAllowed (string $comment)
 Same as undeleteUnsafe, but checks permissions. More...
 
 undeleteUnsafe (string $comment)
 Restore the given (or all) text and file revisions for the page. More...
 

Public Attributes

const FILES_RESTORED = 'files'
 
const REVISIONS_RESTORED = 'revs'
 

Private Member Functions

 addLogEntry (ProperPageIdentity $page, string $comment, int $textRestored, int $filesRestored)
 
 authorizeUndeletion ()
 
 runPreUndeleteHook (string $comment)
 
 undeleteRevisions (ProperPageIdentity $page, array $timestamps, string $comment)
 This is the meaty bit – It restores archived revisions of the given page to the revision table. More...
 

Private Attributes

ArchivedRevisionLookup $archivedRevisionLookup
 
WikiPage null $associatedTalk
 If not null, it means that we have to undelete it. More...
 
IContentHandlerFactory $contentHandlerFactory
 
ITextFormatter $contLangMsgTextFormatter
 
Status null $fileStatus
 
int[] $fileVersions = []
 
HookRunner $hookRunner
 
JobQueueGroup $jobQueueGroup
 
ILoadBalancer $loadBalancer
 
LoggerInterface $logger
 
NamespaceInfo $namespaceInfo
 
ProperPageIdentity $page
 
PageUpdaterFactory $pageUpdaterFactory
 
Authority $performer
 
ReadOnlyMode $readOnlyMode
 
RepoGroup $repoGroup
 
StatusValue null $revisionStatus
 
RevisionStore $revisionStore
 
string[] $tags = []
 
string[] $timestamps = []
 
bool $unsuppress = false
 
WikiPageFactory $wikiPageFactory
 

Detailed Description

Backend logic for performing a page undelete action.

Since
1.38

Definition at line 57 of file UndeletePage.php.

Constructor & Destructor Documentation

◆ __construct()

Page\UndeletePage::__construct ( HookContainer  $hookContainer,
JobQueueGroup  $jobQueueGroup,
ILoadBalancer  $loadBalancer,
ReadOnlyMode  $readOnlyMode,
RepoGroup  $repoGroup,
LoggerInterface  $logger,
RevisionStore  $revisionStore,
WikiPageFactory  $wikiPageFactory,
PageUpdaterFactory  $pageUpdaterFactory,
IContentHandlerFactory  $contentHandlerFactory,
ArchivedRevisionLookup  $archivedRevisionLookup,
NamespaceInfo  $namespaceInfo,
ITextFormatter  $contLangMsgTextFormatter,
ProperPageIdentity  $page,
Authority  $performer 
)
Access: internal
Create via the UndeletePageFactory service.
Parameters
HookContainer$hookContainer
JobQueueGroup$jobQueueGroup
ILoadBalancer$loadBalancer
ReadOnlyMode$readOnlyMode
RepoGroup$repoGroup
LoggerInterface$logger
RevisionStore$revisionStore
WikiPageFactory$wikiPageFactory
PageUpdaterFactory$pageUpdaterFactory
IContentHandlerFactory$contentHandlerFactory
ArchivedRevisionLookup$archivedRevisionLookup
NamespaceInfo$namespaceInfo
ITextFormatter$contLangMsgTextFormatter
ProperPageIdentity$page
Authority$performer

Definition at line 126 of file UndeletePage.php.

References Page\UndeletePage\$archivedRevisionLookup, Page\UndeletePage\$contentHandlerFactory, Page\UndeletePage\$contLangMsgTextFormatter, Page\UndeletePage\$jobQueueGroup, Page\UndeletePage\$loadBalancer, Page\UndeletePage\$logger, Page\UndeletePage\$namespaceInfo, Page\UndeletePage\$page, Page\UndeletePage\$pageUpdaterFactory, Page\UndeletePage\$performer, Page\UndeletePage\$readOnlyMode, Page\UndeletePage\$repoGroup, Page\UndeletePage\$revisionStore, and Page\UndeletePage\$wikiPageFactory.

Member Function Documentation

◆ addLogEntry()

Page\UndeletePage::addLogEntry ( ProperPageIdentity  $page,
string  $comment,
int  $textRestored,
int  $filesRestored 
)
private
Parameters
ProperPageIdentity$page
string$comment
int$textRestored
int$filesRestored

Definition at line 408 of file UndeletePage.php.

◆ authorizeUndeletion()

Page\UndeletePage::authorizeUndeletion ( )
private
Returns
PermissionStatus

Definition at line 265 of file UndeletePage.php.

◆ canProbablyUndeleteAssociatedTalk()

Page\UndeletePage::canProbablyUndeleteAssociatedTalk ( )

Tests whether it's probably possible to undelete the associated talk page.

This checks the replica, so it may not see the latest master change, and is useful e.g. for building the UI.

Returns
StatusValue

Definition at line 211 of file UndeletePage.php.

References StatusValue\newFatal().

◆ getFileStatus()

Page\UndeletePage::getFileStatus ( )
Access: internal
BC method to be used by PageArchive only
Returns
Status|null

Definition at line 715 of file UndeletePage.php.

◆ getRevisionStatus()

Page\UndeletePage::getRevisionStatus ( )
Access: internal
BC methods to be used by PageArchive only
Returns
StatusValue|null

Definition at line 723 of file UndeletePage.php.

◆ runPreUndeleteHook()

Page\UndeletePage::runPreUndeleteHook ( string  $comment)
private
Parameters
string$comment
Returns
StatusValue

Definition at line 378 of file UndeletePage.php.

◆ setTags()

Page\UndeletePage::setTags ( array  $tags)

Change tags to add to log entry (the user should be able to add the specified tags before this is called)

Parameters
string[]$tags
Returns
self For chaining

Definition at line 178 of file UndeletePage.php.

◆ setUndeleteAssociatedTalk()

Page\UndeletePage::setUndeleteAssociatedTalk ( bool  $undelete)

Whether to delete the associated talk page with the subject page.

Parameters
bool$undelete
Returns
self For chaining

Definition at line 233 of file UndeletePage.php.

◆ setUndeleteOnlyFileVersions()

Page\UndeletePage::setUndeleteOnlyFileVersions ( array  $fileVersions)

If you don't want to undelete all file versions, pass an array of versions to undelete.

Parameters
int[]$fileVersions
Returns
self For chaining

Definition at line 200 of file UndeletePage.php.

◆ setUndeleteOnlyTimestamps()

Page\UndeletePage::setUndeleteOnlyTimestamps ( array  $timestamps)

If you don't want to undelete all revisions, pass an array of timestamps to undelete.

Parameters
string[]$timestamps
Returns
self For chaining

Definition at line 189 of file UndeletePage.php.

◆ setUnsuppress()

Page\UndeletePage::setUnsuppress ( bool  $unsuppress)

Whether to remove all ar_deleted/fa_deleted restrictions of selected revs.

Parameters
bool$unsuppress
Returns
self For chaining

Definition at line 167 of file UndeletePage.php.

◆ undeleteIfAllowed()

Page\UndeletePage::undeleteIfAllowed ( string  $comment)

Same as undeleteUnsafe, but checks permissions.

Parameters
string$comment
Returns
StatusValue

Definition at line 253 of file UndeletePage.php.

◆ undeleteRevisions()

Page\UndeletePage::undeleteRevisions ( ProperPageIdentity  $page,
array  $timestamps,
string  $comment 
)
private

This is the meaty bit – It restores archived revisions of the given page to the revision table.

Parameters
ProperPageIdentity$page
string[]$timestamps
string$comment
Exceptions
ReadOnlyError
Returns
StatusValue Status object containing the number of revisions restored on success

Definition at line 440 of file UndeletePage.php.

◆ undeleteUnsafe()

Page\UndeletePage::undeleteUnsafe ( string  $comment)

Restore the given (or all) text and file revisions for the page.

Once restored, the items will be removed from the archive tables. The deletion log will be updated with an undeletion notice.

This also sets Status objects, $this->fileStatus and $this->revisionStatus (depending what operations are attempted).

Note
This method doesn't check user permissions. Use undeleteIfAllowed for that.
Parameters
string$comment
Returns
StatusValue Good Status with the following value on success: [ self::REVISIONS_RESTORED => number of text revisions restored, self::FILES_RESTORED => number of file revisions restored ] Fatal Status on failure.

Definition at line 295 of file UndeletePage.php.

Member Data Documentation

◆ $archivedRevisionLookup

ArchivedRevisionLookup Page\UndeletePage::$archivedRevisionLookup
private

Definition at line 84 of file UndeletePage.php.

Referenced by Page\UndeletePage\__construct().

◆ $associatedTalk

WikiPage null Page\UndeletePage::$associatedTalk
private

If not null, it means that we have to undelete it.

Definition at line 104 of file UndeletePage.php.

◆ $contentHandlerFactory

IContentHandlerFactory Page\UndeletePage::$contentHandlerFactory
private

Definition at line 82 of file UndeletePage.php.

Referenced by Page\UndeletePage\__construct().

◆ $contLangMsgTextFormatter

ITextFormatter Page\UndeletePage::$contLangMsgTextFormatter
private

Definition at line 106 of file UndeletePage.php.

Referenced by Page\UndeletePage\__construct().

◆ $fileStatus

Status null Page\UndeletePage::$fileStatus
private

Definition at line 92 of file UndeletePage.php.

◆ $fileVersions

int [] Page\UndeletePage::$fileVersions = []
private

Definition at line 98 of file UndeletePage.php.

◆ $hookRunner

HookRunner Page\UndeletePage::$hookRunner
private

Definition at line 64 of file UndeletePage.php.

◆ $jobQueueGroup

JobQueueGroup Page\UndeletePage::$jobQueueGroup
private

Definition at line 66 of file UndeletePage.php.

Referenced by Page\UndeletePage\__construct().

◆ $loadBalancer

ILoadBalancer Page\UndeletePage::$loadBalancer
private

Definition at line 68 of file UndeletePage.php.

Referenced by Page\UndeletePage\__construct().

◆ $logger

LoggerInterface Page\UndeletePage::$logger
private

Definition at line 70 of file UndeletePage.php.

Referenced by Page\UndeletePage\__construct().

◆ $namespaceInfo

NamespaceInfo Page\UndeletePage::$namespaceInfo
private

Definition at line 86 of file UndeletePage.php.

Referenced by Page\UndeletePage\__construct().

◆ $page

ProperPageIdentity Page\UndeletePage::$page
private

Definition at line 88 of file UndeletePage.php.

Referenced by Page\UndeletePage\__construct().

◆ $pageUpdaterFactory

PageUpdaterFactory Page\UndeletePage::$pageUpdaterFactory
private

Definition at line 80 of file UndeletePage.php.

Referenced by Page\UndeletePage\__construct().

◆ $performer

Authority Page\UndeletePage::$performer
private

Definition at line 90 of file UndeletePage.php.

Referenced by Page\UndeletePage\__construct().

◆ $readOnlyMode

ReadOnlyMode Page\UndeletePage::$readOnlyMode
private

Definition at line 72 of file UndeletePage.php.

Referenced by Page\UndeletePage\__construct().

◆ $repoGroup

RepoGroup Page\UndeletePage::$repoGroup
private

Definition at line 74 of file UndeletePage.php.

Referenced by Page\UndeletePage\__construct().

◆ $revisionStatus

StatusValue null Page\UndeletePage::$revisionStatus
private

Definition at line 94 of file UndeletePage.php.

◆ $revisionStore

RevisionStore Page\UndeletePage::$revisionStore
private

Definition at line 76 of file UndeletePage.php.

Referenced by Page\UndeletePage\__construct().

◆ $tags

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

Definition at line 102 of file UndeletePage.php.

◆ $timestamps

string [] Page\UndeletePage::$timestamps = []
private

Definition at line 96 of file UndeletePage.php.

◆ $unsuppress

bool Page\UndeletePage::$unsuppress = false
private

Definition at line 100 of file UndeletePage.php.

◆ $wikiPageFactory

WikiPageFactory Page\UndeletePage::$wikiPageFactory
private

Definition at line 78 of file UndeletePage.php.

Referenced by Page\UndeletePage\__construct().

◆ FILES_RESTORED

const Page\UndeletePage::FILES_RESTORED = 'files'

Definition at line 60 of file UndeletePage.php.

◆ REVISIONS_RESTORED

const Page\UndeletePage::REVISIONS_RESTORED = 'revs'

Definition at line 61 of file UndeletePage.php.


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