MediaWiki
1.30.2
|
Used to show archived pages and eventually restore them. More...
Public Member Functions | |
__construct ( $title, Config $config=null) | |
doesWrites () | |
getFileStatus () | |
getLastRevisionText () | |
Fetch (and decompress if necessary) the stored text of the most recently edited deleted revision of the page. More... | |
getPreviousRevision ( $timestamp) | |
Return the most-previous revision, either live or deleted, against the deleted revision given by timestamp. More... | |
getRevision ( $timestamp) | |
Return a Revision object containing data for the deleted revision. More... | |
getRevisionStatus () | |
getTextFromRow ( $row) | |
Get the text from an archive row containing ar_text, ar_flags and ar_text_id. More... | |
isDeleted () | |
Quick check if any archived revisions are present for the page. More... | |
listFiles () | |
List the deleted file revisions for this page, if it's a file page. More... | |
listRevisions () | |
List the revisions of the given page. More... | |
undelete ( $timestamps, $comment='', $fileVersions=[], $unsuppress=false, User $user=null, $tags=null) | |
Restore the given (or all) text and file revisions for the page. More... | |
Static Public Member Functions | |
static | listAllPages () |
List all deleted pages recorded in the archive table. More... | |
static | listPagesByPrefix ( $prefix) |
List deleted pages recorded in the archive table matching the given title prefix. More... | |
static | listPagesBySearch ( $term) |
List deleted pages recorded in the archive matching the given term, using search engine archive. More... | |
Static Protected Member Functions | |
static | listPages ( $dbr, $condition) |
Protected Attributes | |
Config | $config |
Status | $fileStatus |
Status | $revisionStatus |
Title | $title |
Private Member Functions | |
undeleteRevisions ( $timestamps, $unsuppress=false, $comment='') | |
This is the meaty bit – It restores archived revisions of the given page to the revision table. More... | |
Used to show archived pages and eventually restore them.
Definition at line 28 of file PageArchive.php.
PageArchive::__construct | ( | $title, | |
Config | $config = null |
||
) |
PageArchive::doesWrites | ( | ) |
Definition at line 53 of file PageArchive.php.
PageArchive::getFileStatus | ( | ) |
PageArchive::getLastRevisionText | ( | ) |
Fetch (and decompress if necessary) the stored text of the most recently edited deleted revision of the page.
If there are no archived revisions for the page, returns NULL.
Definition at line 381 of file PageArchive.php.
References $dbr, DB_REPLICA, getTextFromRow(), title, and wfGetDB().
PageArchive::getPreviousRevision | ( | $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 307 of file PageArchive.php.
References $dbr, DB_REPLICA, getRevision(), Revision\newFromId(), title, wfGetDB(), and wfTimestamp().
PageArchive::getRevision | ( | $timestamp | ) |
Return a Revision object containing data for the deleted revision.
Note that the result may or may not have a null page ID.
string | $timestamp |
Definition at line 250 of file PageArchive.php.
References $dbr, $tables, DB_REPLICA, Revision\newFromArchiveRow(), CommentStore\newKey(), title, and wfGetDB().
Referenced by getPreviousRevision().
PageArchive::getRevisionStatus | ( | ) |
PageArchive::getTextFromRow | ( | $row | ) |
Get the text from an archive row containing ar_text, ar_flags and ar_text_id.
object | $row | Database row |
Definition at line 356 of file PageArchive.php.
References $dbr, DB_REPLICA, Revision\getRevisionText(), and wfGetDB().
Referenced by getLastRevisionText().
PageArchive::isDeleted | ( | ) |
Quick check if any archived revisions are present for the page.
Definition at line 402 of file PageArchive.php.
References $dbr, DB_REPLICA, title, and wfGetDB().
|
static |
List all deleted pages recorded in the archive table.
Returns result wrapper with (ar_namespace, ar_title, count) fields, ordered by page namespace/title.
Definition at line 64 of file PageArchive.php.
References $dbr, DB_REPLICA, listPages(), and wfGetDB().
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 228 of file PageArchive.php.
References $dbr, DB_REPLICA, NS_FILE, ArchivedFile\selectFields(), title, and wfGetDB().
|
staticprotected |
IDatabase | $dbr | |
string | array | $condition |
Definition at line 154 of file PageArchive.php.
References $dbr.
Referenced by listAllPages(), listPagesByPrefix(), and listPagesBySearch().
|
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 128 of file PageArchive.php.
References $dbr, $title, DB_REPLICA, Title\getDBkey(), Title\getNamespace(), listPages(), Title\newFromText(), and wfGetDB().
Referenced by listPagesBySearch(), and SpecialUndelete\showSearchForm().
|
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 78 of file PageArchive.php.
References $dbr, $engine, $t, $term, $title, DB_REPLICA, Title\getDBkey(), Title\getNamespace(), Title\getText(), LIST_OR, listPages(), listPagesByPrefix(), Title\newFromText(), and wfGetDB().
Referenced by SpecialUndelete\showSearchForm().
PageArchive::listRevisions | ( | ) |
List the revisions of the given page.
Returns result wrapper with various archive table fields.
Definition at line 178 of file PageArchive.php.
References $dbr, $options, $tables, DB_REPLICA, ChangeTags\modifyDisplayQuery(), CommentStore\newKey(), title, and wfGetDB().
PageArchive::undelete | ( | $timestamps, | |
$comment = '' , |
|||
$fileVersions = [] , |
|||
$unsuppress = false , |
|||
User | $user = null , |
||
$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. |
string | $comment | |
array | $fileVersions | |
bool | $unsuppress | |
User | $user | User performing the action, or null to use $wgUser |
string | string[] | $tags | Change tags to add to log entry ($user should be able to add the specified tags before this is called) |
Definition at line 432 of file PageArchive.php.
References $user, $wgUser, global, NS_FILE, Hooks\run(), title, undeleteRevisions(), wfDebug(), and wfLocalFile().
|
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 509 of file PageArchive.php.
References $article, $tables, $user, DeferredUpdates\addUpdate(), as, captcha-old\count, DB_MASTER, Revision\DELETED_TEXT, WikiPage\factory(), false, StatusValue\newFatal(), Revision\newFromArchiveRow(), User\newFromName(), StatusValue\newGood(), CommentStore\newKey(), NS_FILE, Revision\RAW, Hooks\run(), title, wfDebug(), wfGetDB(), wfMessage(), and wfReadOnly().
Referenced by undelete().
|
protected |
Definition at line 39 of file PageArchive.php.
Referenced by __construct().
|
protected |
Definition at line 33 of file PageArchive.php.
Referenced by getFileStatus().
|
protected |
Definition at line 36 of file PageArchive.php.
Referenced by getRevisionStatus().
|
protected |
Definition at line 30 of file PageArchive.php.
Referenced by __construct(), listPagesByPrefix(), and listPagesBySearch().