MediaWiki REL1_41
PageArchive Class Reference

Used to show archived pages and eventually restore them. More...

Collaboration diagram for PageArchive:

Public Member Functions

 __construct (Title $title)
 
 getArchivedRevisionRecord (int $revId)
 Return the archived revision with the given ID.
 
 getFileStatus ()
 
 getLastRevisionId ()
 Returns the ID of the latest deleted revision.
 
 getPreviousRevisionRecord (string $timestamp)
 Return the most-previous revision, either live or deleted, against the deleted revision given by timestamp.
 
 getRevisionRecordByTimestamp ( $timestamp)
 Return a RevisionRecord object containing data for the deleted revision.
 
 getRevisionStatus ()
 
 isDeleted ()
 Quick check if any archived revisions are present for the page.
 
 listFiles ()
 List the deleted file revisions for this page, if it's a file page.
 
 listRevisions ()
 List the revisions of the given page.
 
 undeleteAsUser ( $timestamps, UserIdentity $user, $comment='', $fileVersions=[], $unsuppress=false, $tags=null)
 Restore the given (or all) text and file revisions for the page.
 

Static Public Member Functions

static listPagesByPrefix ( $prefix)
 List deleted pages recorded in the archive table matching the given title prefix.
 
static listPagesBySearch ( $term)
 List deleted pages recorded in the archive matching the given term, using search engine archive.
 

Static Protected Member Functions

static listPages (IReadableDatabase $dbr, $condition)
 

Protected Attributes

Status null $fileStatus
 
Status null $revisionStatus
 
Title $title
 

Detailed Description

Used to show archived pages and eventually restore them.

Definition at line 35 of file PageArchive.php.

Constructor & Destructor Documentation

◆ __construct()

PageArchive::__construct ( Title $title)
Parameters
Title$title

Definition at line 49 of file PageArchive.php.

Member Function Documentation

◆ getArchivedRevisionRecord()

PageArchive::getArchivedRevisionRecord ( int $revId)

Return the archived revision with the given ID.

Since
1.35
Deprecated
since 1.38, hard-deprecated since 1.41. Use ArchivedRevisionLookup::getArchivedRevisionRecord
Parameters
int$revId
Returns
RevisionRecord|null

Definition at line 207 of file PageArchive.php.

References wfDeprecated().

◆ getFileStatus()

PageArchive::getFileStatus ( )
Deprecated
since 1.38, hard-deprecated since 1.38. The entrypoints in UndeletePage return a StatusValue
Returns
Status|null

Definition at line 323 of file PageArchive.php.

References wfDeprecated().

◆ getLastRevisionId()

PageArchive::getLastRevisionId ( )

Returns the ID of the latest deleted revision.

Deprecated
since 1.38, hard-deprecated since 1.41. Use ArchivedRevisionLookup::getLastRevisionId
Returns
int|false The revision's ID, or false if there is no deleted revision.

Definition at line 238 of file PageArchive.php.

References wfDeprecated().

◆ getPreviousRevisionRecord()

PageArchive::getPreviousRevisionRecord ( string $timestamp)

Return the most-previous revision, either live or deleted, against the deleted revision given by timestamp.

May produce unexpected results in case of history merges or other unusual time issues.

Since
1.35
Deprecated
since 1.38, hard-deprecated since 1.41. Use ArchivedRevisionLookup::getPreviousRevisionRecord
Parameters
string$timestamp
Returns
RevisionRecord|null Null when there is no previous revision

Definition at line 226 of file PageArchive.php.

References wfDeprecated().

◆ getRevisionRecordByTimestamp()

PageArchive::getRevisionRecordByTimestamp ( $timestamp)

Return a RevisionRecord object containing data for the deleted revision.

Access: internal
only for use in SpecialUndelete
Deprecated
since 1.38, hard-deprecated since 1.41. Use ArchivedRevisionLookup::getRevisionRecordByTimestamp
Parameters
string$timestamp
Returns
RevisionRecord|null

Definition at line 192 of file PageArchive.php.

References wfDeprecated().

◆ getRevisionStatus()

PageArchive::getRevisionStatus ( )
Deprecated
since 1.38, hard-deprecated since 1.38. The entrypoints in UndeletePage return a StatusValue
Returns
Status|null

Definition at line 332 of file PageArchive.php.

References wfDeprecated().

◆ isDeleted()

PageArchive::isDeleted ( )

Quick check if any archived revisions are present for the page.

This says nothing about whether the page currently exists in the page table or not.

Deprecated
since 1.38, hard-deprecated since 1.41. Use ArchivedRevisionLookup::hasArchivedRevisions
Returns
bool

Definition at line 251 of file PageArchive.php.

References wfDeprecated().

◆ listFiles()

PageArchive::listFiles ( )

List the deleted file revisions for this page, if it's a file page.

Returns a result wrapper with various filearchive fields, or null if not a file page.

Returns
IResultWrapper|null
Todo
Does this belong in Image for fuller encapsulation?

Definition at line 171 of file PageArchive.php.

References NS_FILE.

◆ listPages()

static PageArchive::listPages ( IReadableDatabase $dbr,
$condition )
staticprotected
Parameters
IReadableDatabase$dbr
string | array$condition
Returns
IResultWrapper

Definition at line 139 of file PageArchive.php.

References Wikimedia\Rdbms\IReadableDatabase\newSelectQueryBuilder().

◆ listPagesByPrefix()

static PageArchive::listPagesByPrefix ( $prefix)
static

List deleted pages recorded in the archive table matching the given title prefix.

Returns result wrapper with (ar_namespace, ar_title, count) fields.

Parameters
string$prefixTitle prefix
Returns
IResultWrapper|bool

Definition at line 113 of file PageArchive.php.

References MediaWiki\Title\Title\getDBkey(), and MediaWiki\Title\Title\getNamespace().

◆ listPagesBySearch()

static PageArchive::listPagesBySearch ( $term)
static

List deleted pages recorded in the archive matching the given term, using search engine archive.

Returns result wrapper with (ar_namespace, ar_title, count) fields.

Parameters
string$termSearch term
Returns
IResultWrapper|bool

Definition at line 61 of file PageArchive.php.

References MediaWiki\Title\Title\getDBkey(), MediaWiki\Title\Title\getNamespace(), MediaWiki\Title\Title\getText(), and LIST_OR.

◆ listRevisions()

PageArchive::listRevisions ( )

List the revisions of the given page.

Returns result wrapper with various archive table fields.

Deprecated
since 1.38, hard-deprecated since 1.41. Use ArchivedRevisionLookup::listRevisions
Returns
IResultWrapper

Definition at line 157 of file PageArchive.php.

References wfDeprecated().

◆ undeleteAsUser()

PageArchive::undeleteAsUser ( $timestamps,
UserIdentity $user,
$comment = '',
$fileVersions = [],
$unsuppress = false,
$tags = null )

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

Since
1.35
Deprecated
since 1.38, use UndeletePage instead
Parameters
array$timestampsPass an empty array to restore all revisions, otherwise list the ones to undelete.
UserIdentity$user
string$comment
array$fileVersions
bool$unsuppress
string | string[] | null$tagsChange tags to add to log entry ($user should be able to add the specified tags before this is called)
Returns
array|false [ number of file revisions restored, number of image revisions restored, log message ] on success, false on failure.

Definition at line 279 of file PageArchive.php.

Member Data Documentation

◆ $fileStatus

Status null PageArchive::$fileStatus
protected

Definition at line 41 of file PageArchive.php.

◆ $revisionStatus

Status null PageArchive::$revisionStatus
protected

Definition at line 44 of file PageArchive.php.

◆ $title

Title PageArchive::$title
protected

Definition at line 38 of file PageArchive.php.


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