MediaWiki REL1_37
MediaWiki\Revision\RevisionLookup Interface Reference

Service for looking up page revisions. More...

Inheritance diagram for MediaWiki\Revision\RevisionLookup:
Collaboration diagram for MediaWiki\Revision\RevisionLookup:

Public Member Functions

 getFirstRevision ( $page, int $flags=IDBAccessObject::READ_NORMAL)
 Get the first revision of the page.
 
 getKnownCurrentRevision (PageIdentity $page, $revId=0)
 Load a revision based on a known page ID and current revision ID from the DB.
 
 getNextRevision (RevisionRecord $rev, $flags=0)
 Get next revision for this title.
 
 getPreviousRevision (RevisionRecord $rev, $flags=0)
 Get previous revision for this title.
 
 getRevisionById ( $id, $flags=0, PageIdentity $page=null)
 Load a page revision from a given revision ID number.
 
 getRevisionByPageId ( $pageId, $revId=0, $flags=0)
 Load either the current, or a specified, revision that's attached to a given page ID.
 
 getRevisionByTimestamp ( $page, string $timestamp, int $flags=RevisionLookup::READ_NORMAL)
 Load the revision for the given title with the given timestamp.
 
 getRevisionByTitle ( $page, $revId=0, $flags=0)
 Load either the current, or a specified, revision that's attached to a given link target.
 
 getTimestampFromId ( $id, $flags=0)
 Get rev_timestamp from rev_id, without loading the rest of the row.
 

Additional Inherited Members

- Public Attributes inherited from IDBAccessObject
const READ_NONE = -1
 Constants for object loading bitfield flags (higher => higher QoS)
 

Detailed Description

Service for looking up page revisions.

Note
This was written to act as a drop-in replacement for the corresponding static methods in the old Revision class (which was later removed in 1.37).
Since
1.31
1.32 Renamed from MediaWiki\Storage\RevisionLookup

Definition at line 38 of file RevisionLookup.php.

Member Function Documentation

◆ getFirstRevision()

MediaWiki\Revision\RevisionLookup::getFirstRevision (   $page,
int  $flags = IDBAccessObject::READ_NORMAL 
)

Get the first revision of the page.

Since
1.35
Parameters
LinkTarget | PageIdentity$pageCalling with LinkTarget is deprecated since 1.36
int$flagsbit field, see IDBAccessObject::READ_* constants.
Returns
RevisionRecord|null

Implemented in MediaWiki\Revision\RevisionStore.

◆ getKnownCurrentRevision()

MediaWiki\Revision\RevisionLookup::getKnownCurrentRevision ( PageIdentity  $page,
  $revId = 0 
)

Load a revision based on a known page ID and current revision ID from the DB.

This method allows for the use of caching, though accessing anything that normally requires permission checks (aside from the text) will trigger a small DB lookup.

MCR migration note: this replaced Revision::newKnownCurrent

Parameters
PageIdentity$pagethe associated page
int$revIdcurrent revision of this page
Returns
RevisionRecord|bool Returns false if missing

Implemented in MediaWiki\Revision\RevisionStore.

◆ getNextRevision()

MediaWiki\Revision\RevisionLookup::getNextRevision ( RevisionRecord  $rev,
  $flags = 0 
)

Get next revision for this title.

MCR migration note: this replaced Revision::getNext

Parameters
RevisionRecord$rev
int$flags(optional) $flags include: IDBAccessObject::READ_LATEST: Select the data from the primary DB
Returns
RevisionRecord|null

Implemented in MediaWiki\Revision\RevisionStore.

Referenced by MediaWiki\Watchlist\WatchlistManager\clearTitleUserNotifications().

◆ getPreviousRevision()

MediaWiki\Revision\RevisionLookup::getPreviousRevision ( RevisionRecord  $rev,
  $flags = 0 
)

Get previous revision for this title.

MCR migration note: this replaced Revision::getPrevious

Parameters
RevisionRecord$rev
int$flags(optional) $flags include: IDBAccessObject::READ_LATEST: Select the data from the primary DB
Returns
RevisionRecord|null

Implemented in MediaWiki\Revision\RevisionStore.

◆ getRevisionById()

MediaWiki\Revision\RevisionLookup::getRevisionById (   $id,
  $flags = 0,
PageIdentity  $page = null 
)

Load a page revision from a given revision ID number.

Returns null if no such revision can be found.

MCR migration note: this replaced Revision::newFromId

$flags include:

Parameters
int$id
int$flagsbit field, see IDBAccessObject::READ_XXX
PageIdentity | null$pageThe page the revision belongs to. Providing the page may improve performance.
Returns
RevisionRecord|null

Implemented in MediaWiki\Revision\RevisionStore.

Referenced by MediaWiki\Watchlist\WatchlistManager\clearTitleUserNotifications().

◆ getRevisionByPageId()

MediaWiki\Revision\RevisionLookup::getRevisionByPageId (   $pageId,
  $revId = 0,
  $flags = 0 
)

Load either the current, or a specified, revision that's attached to a given page ID.

Returns null if no such revision can be found.

MCR migration note: this replaced Revision::newFromPageId

Parameters
int$pageId
int$revId(optional)
int$flagsbit field, see IDBAccessObject::READ_XXX
Returns
RevisionRecord|null

Implemented in MediaWiki\Revision\RevisionStore.

◆ getRevisionByTimestamp()

MediaWiki\Revision\RevisionLookup::getRevisionByTimestamp (   $page,
string  $timestamp,
int  $flags = RevisionLookup::READ_NORMAL 
)

Load the revision for the given title with the given timestamp.

WARNING: Timestamps may in some circumstances not be unique, so this isn't the best key to use.

MCR migration note: this replaced Revision::loadFromTimestamp

Parameters
LinkTarget | PageIdentity$pageCalling with LinkTarget is deprecated since 1.36
string$timestamp
int$flagsBitfield (optional) include: RevisionLookup::READ_LATEST: Select the data from the primary DB RevisionLookup::READ_LOCKING: Select & lock the data from the primary DB Default: RevisionLookup::READ_NORMAL
Returns
RevisionRecord|null

Implemented in MediaWiki\Revision\RevisionStore.

◆ getRevisionByTitle()

MediaWiki\Revision\RevisionLookup::getRevisionByTitle (   $page,
  $revId = 0,
  $flags = 0 
)

Load either the current, or a specified, revision that's attached to a given link target.

If not attached to that link target, will return null.

MCR migration note: this replaced Revision::newFromTitle

Parameters
LinkTarget | PageIdentity$pageCalling with LinkTarget is deprecated since 1.36
int$revId(optional)
int$flagsbit field, see IDBAccessObject::READ_XXX
Returns
RevisionRecord|null

Implemented in MediaWiki\Revision\RevisionStore.

◆ getTimestampFromId()

MediaWiki\Revision\RevisionLookup::getTimestampFromId (   $id,
  $flags = 0 
)

Get rev_timestamp from rev_id, without loading the rest of the row.

MCR migration note: this replaced Revision::getTimestampFromId

Parameters
int$id
int$flags
Returns
string|bool False if not found
Since
1.34 (present earlier in RevisionStore)

Implemented in MediaWiki\Revision\RevisionStore.


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