MediaWiki REL1_37
|
Used to show archived pages and eventually restore them. More...
Public Member Functions | |
__construct (Title $title, Config $config=null) | |
doesWrites () | |
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 ( $dbr, $condition) |
Protected Attributes | |
Config | $config |
Status null | $fileStatus |
Status null | $revisionStatus |
Title | $title |
Private Member Functions | |
getRevisionByConditions (array $conditions, array $options=[]) | |
undeleteRevisions ( $timestamps, $unsuppress=false, $comment='') | |
This is the meaty bit – It restores archived revisions of the given page to the revision table. | |
Used to show archived pages and eventually restore them.
Definition at line 37 of file PageArchive.php.
Definition at line 82 of file PageArchive.php.
References $title.
PageArchive::doesWrites | ( | ) |
Definition at line 112 of file PageArchive.php.
PageArchive::getArchivedRevisionRecord | ( | int | $revId | ) |
Return the archived revision with the given ID.
int | $revId |
Definition at line 306 of file PageArchive.php.
References getRevisionByConditions().
Referenced by getPreviousRevisionRecord().
PageArchive::getFileStatus | ( | ) |
Definition at line 831 of file PageArchive.php.
PageArchive::getLastRevisionId | ( | ) |
Returns the ID of the latest deleted revision.
Definition at line 403 of file PageArchive.php.
References $dbr, and DB_REPLICA.
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.
string | $timestamp |
Definition at line 353 of file PageArchive.php.
References $dbr, DB_REPLICA, getArchivedRevisionRecord(), and wfTimestamp().
|
private |
array | $conditions | |
array | $options |
Definition at line 316 of file PageArchive.php.
References $dbr, and DB_REPLICA.
Referenced by getArchivedRevisionRecord(), and getRevisionRecordByTimestamp().
PageArchive::getRevisionRecordByTimestamp | ( | $timestamp | ) |
Return a RevisionRecord object containing data for the deleted revision.
string | $timestamp |
Definition at line 290 of file PageArchive.php.
References $dbr, DB_REPLICA, and getRevisionByConditions().
PageArchive::getRevisionStatus | ( | ) |
Definition at line 838 of file PageArchive.php.
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.
Definition at line 423 of file PageArchive.php.
References $dbr, and DB_REPLICA.
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.
Definition at line 265 of file PageArchive.php.
References $dbr, DB_REPLICA, ArchivedFile\getQueryInfo(), and NS_FILE.
|
staticprotected |
IDatabase | $dbr | |
string | array | $condition |
Definition at line 200 of file PageArchive.php.
References $dbr.
|
static |
List deleted pages recorded in the archive table matching the given title prefix.
Returns result wrapper with (ar_namespace, ar_title, count) fields.
string | $prefix | Title prefix |
Definition at line 174 of file PageArchive.php.
References $dbr, $title, DB_REPLICA, and wfGetDB().
|
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.
string | $term | Search term |
Definition at line 124 of file PageArchive.php.
References $dbr, $t, $title, DB_REPLICA, LIST_OR, and wfGetDB().
PageArchive::listRevisions | ( | ) |
List the revisions of the given page.
Returns result wrapper with various archive table fields.
Definition at line 224 of file PageArchive.php.
References $dbr, DB_REPLICA, and ChangeTags\modifyDisplayQuery().
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).
array | $timestamps | Pass an empty array to restore all revisions, otherwise list the ones to undelete. |
UserIdentity | $user | |
string | $comment | |
array | $fileVersions | |
bool | $unsuppress | |
string | string[] | null | $tags | Change tags to add to log entry ($user should be able to add the specified tags before this is called) |
Definition at line 457 of file PageArchive.php.
References NS_FILE, and undeleteRevisions().
|
private |
This is the meaty bit – It restores archived revisions of the given page to the revision table.
array | $timestamps | Pass an empty array to restore all revisions, otherwise list the ones to undelete. |
bool | $unsuppress | Remove all ar_deleted/fa_deleted restrictions of seletected revs |
string | $comment |
ReadOnlyError |
Definition at line 550 of file PageArchive.php.
References $content, $job, DB_PRIMARY, MediaWiki\Revision\RevisionStore\getArchiveQueryInfo(), MediaWiki\Revision\RevisionStore\getTimestampFromId(), MediaWiki\Revision\RevisionStore\insertRevisionOn(), HTMLCacheUpdateJob\newForBacklinks(), MediaWiki\Revision\RevisionStore\newRevisionFromArchiveRow(), NS_FILE, true, and wfMessage().
Referenced by undeleteAsUser().
|
protected |
Definition at line 49 of file PageArchive.php.
|
protected |
Definition at line 43 of file PageArchive.php.
|
private |
Definition at line 52 of file PageArchive.php.
|
private |
Definition at line 55 of file PageArchive.php.
|
private |
Definition at line 58 of file PageArchive.php.
|
private |
Definition at line 61 of file PageArchive.php.
|
private |
Definition at line 64 of file PageArchive.php.
|
private |
Definition at line 67 of file PageArchive.php.
|
protected |
Definition at line 46 of file PageArchive.php.
|
private |
Definition at line 70 of file PageArchive.php.
|
protected |
Definition at line 40 of file PageArchive.php.
|
private |
Definition at line 73 of file PageArchive.php.
|
private |
Definition at line 76 of file PageArchive.php.