MediaWiki  1.28.0
PageArchive Class Reference

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

Collaboration diagram for PageArchive:

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

Detailed Description

Used to show archived pages and eventually restore them.

Definition at line 29 of file SpecialUndelete.php.

Constructor & Destructor Documentation

PageArchive::__construct (   $title,
Config  $config = null 
)

Definition at line 42 of file SpecialUndelete.php.

References $config, $title, ConfigFactory\getDefaultInstance(), title, and wfDebug().

Member Function Documentation

PageArchive::doesWrites ( )

Definition at line 54 of file SpecialUndelete.php.

PageArchive::getFileStatus ( )
Returns
Status

Definition at line 735 of file SpecialUndelete.php.

References $fileStatus.

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.

Returns
string|null

Definition at line 320 of file SpecialUndelete.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.

Parameters
string$timestamp
Returns
Revision|null Null when there is no previous revision

Definition at line 246 of file SpecialUndelete.php.

References $dbr, $timestamp, DB_REPLICA, getRevision(), Revision\newFromId(), title, TS_MW, 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.

Parameters
string$timestamp
Returns
Revision|null

Definition at line 199 of file SpecialUndelete.php.

References $dbr, $timestamp, DB_REPLICA, Revision\newFromArchiveRow(), title, and wfGetDB().

Referenced by getPreviousRevision().

PageArchive::getRevisionStatus ( )
Returns
Status

Definition at line 742 of file SpecialUndelete.php.

References $revisionStatus.

PageArchive::getTextFromRow (   $row)

Get the text from an archive row containing ar_text, ar_flags and ar_text_id.

Parameters
object$rowDatabase row
Returns
string

Definition at line 295 of file SpecialUndelete.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.

Returns
bool

Definition at line 341 of file SpecialUndelete.php.

References $dbr, DB_REPLICA, title, and wfGetDB().

static PageArchive::listAllPages ( )
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.

Returns
ResultWrapper

Definition at line 65 of file SpecialUndelete.php.

References $dbr, DB_REPLICA, 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.

Returns
ResultWrapper
Todo:
Does this belong in Image for fuller encapsulation?

Definition at line 177 of file SpecialUndelete.php.

References $dbr, DB_REPLICA, NS_FILE, ArchivedFile\selectFields(), title, and wfGetDB().

static PageArchive::listPages (   $dbr,
  $condition 
)
staticprotected
Parameters
IDatabase$dbr
string | array$condition
Returns
bool|ResultWrapper

Definition at line 105 of file SpecialUndelete.php.

References $dbr.

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
ResultWrapper

Definition at line 79 of file SpecialUndelete.php.

References $dbr, DB_REPLICA, Title\getDBkey(), Title\getNamespace(), Title\newFromText(), and wfGetDB().

Referenced by SpecialUndelete\showSearchForm().

PageArchive::listRevisions ( )

List the revisions of the given page.

Returns result wrapper with (ar_minor_edit, ar_timestamp, ar_user, ar_user_text, ar_comment) fields.

Returns
ResultWrapper

Definition at line 129 of file SpecialUndelete.php.

References $dbr, $options, $tables, DB_REPLICA, ChangeTags\modifyDisplayQuery(), 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).

Parameters
array$timestampsPass an empty array to restore all revisions, otherwise list the ones to undelete.
string$comment
array$fileVersions
bool$unsuppress
User$userUser 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)
Returns
array(number of file revisions restored, number of image revisions restored, log message) on success, false on failure.

Definition at line 371 of file SpecialUndelete.php.

References $comment, $user, $wgUser, global, NS_FILE, Hooks\run(), title, undeleteRevisions(), wfDebug(), wfLocalFile(), and wfMessage().

PageArchive::undeleteRevisions (   $timestamps,
  $unsuppress = false,
  $comment = '' 
)
private

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

Parameters
array$timestampsPass an empty array to restore all revisions, otherwise list the ones to undelete.
bool$unsuppressRemove all ar_deleted/fa_deleted restrictions of seletected revs
string$comment
Exceptions
ReadOnlyError
Returns
Status Status object containing the number of revisions restored on success

Definition at line 455 of file SpecialUndelete.php.

References $article, $comment, $content, $page, $status, $user, DeferredUpdates\addUpdate(), as, DB_MASTER, Revision\DELETED_TEXT, WikiPage\factory(), false, StatusValue\newFatal(), Revision\newFromArchiveRow(), User\newFromName(), StatusValue\newGood(), NS_FILE, Revision\RAW, Hooks\run(), title, wfDebug(), wfGetDB(), wfMessage(), and wfReadOnly().

Referenced by undelete().

Member Data Documentation

Config PageArchive::$config
protected

Definition at line 40 of file SpecialUndelete.php.

Referenced by __construct().

Status PageArchive::$fileStatus
protected

Definition at line 34 of file SpecialUndelete.php.

Referenced by getFileStatus().

Status PageArchive::$revisionStatus
protected

Definition at line 37 of file SpecialUndelete.php.

Referenced by getRevisionStatus().

Title PageArchive::$title
protected

Definition at line 31 of file SpecialUndelete.php.

Referenced by __construct().


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