MediaWiki  master
Revision Class Reference
Inheritance diagram for Revision:
Collaboration diagram for Revision:

Classes

class  ContributionsLookup
 
class  ContributionsSegment
 @newable More...
 
class  FallbackSlotRoleHandler
 A SlotRoleHandler for providing basic functionality for undefined slot roles. More...
 
class  IncompleteRevisionException
 Exception throw when trying to access undefined fields on an incomplete RevisionRecord. More...
 
class  MainSlotRoleHandler
 A SlotRoleHandler for the main slot. More...
 
class  MutableRevisionRecord
 
class  MutableRevisionSlots
 Mutable version of RevisionSlots, for constructing a new revision. More...
 
class  RenderedRevision
 RenderedRevision represents the rendered representation of a revision. More...
 
class  RevisionAccessException
 Exception representing a failure to look up a revision. More...
 
class  RevisionArchiveRecord
 A RevisionRecord representing a revision of a deleted page persisted in the archive table. More...
 
interface  RevisionFactory
 Service for constructing revision objects. More...
 
interface  RevisionLookup
 Service for looking up page revisions. More...
 
class  RevisionRecord
 Page revision base class. More...
 
class  RevisionRenderer
 The RevisionRenderer service provides access to rendered output for revisions. More...
 
class  RevisionSlots
 Value object representing the set of slots belonging to a revision. More...
 
class  RevisionStore
 Service for looking up page revisions. More...
 
class  RevisionStoreCacheRecord
 A cached RevisionStoreRecord. More...
 
class  RevisionStoreFactory
 Factory service for RevisionStore instances. More...
 
class  RevisionStoreRecord
 A RevisionRecord representing an existing revision persisted in the revision table. More...
 
class  SlotRecord
 Value object representing a content slot associated with a page revision. More...
 
interface  SlotRenderingProvider
 A lazy provider of ParserOutput objects for a revision's individual slots. More...
 
class  SlotRoleHandler
 SlotRoleHandler instances are used to declare the existence and behavior of slot roles. More...
 
class  SlotRoleRegistry
 A registry service for SlotRoleHandlers, used to define which slot roles are available on which page. More...
 
class  SuppressedDataException
 Exception raised in response to an audience check when attempting to access suppressed information without permission. More...
 

Public Member Functions

 __construct ( $row, $queryFlags=0, Title $title=null)
 
 getComment ( $audience=self::FOR_PUBLIC, User $user=null)
 
 getContent ( $audience=self::FOR_PUBLIC, User $user=null)
 Fetch revision content if it's available to the specified audience. More...
 
 getContentFormat ()
 Returns the content format for the main slot of this revision. More...
 
 getContentHandler ()
 Returns the content handler appropriate for this revision's content model. More...
 
 getContentModel ()
 Returns the content model for the main slot of this revision. More...
 
 getId ()
 Get revision ID. More...
 
 getNext ()
 Get next revision for this title. More...
 
 getPage ()
 Get the page ID. More...
 
 getParentId ()
 Get parent revision ID (the original previous page revision) More...
 
 getPrevious ()
 Get previous revision for this title. More...
 
 getRecentChange ( $flags=0)
 Get the RC object belonging to the current revision, if there's one. More...
 
 getRevisionRecord ()
 
 getSerializedData ()
 Get original serialized data (without checking view restrictions) More...
 
 getSha1 ()
 Returns the base36 sha1 of the content in this revision, or null if unknown. More...
 
 getSize ()
 Returns the length of the text in this revision, or null if unknown. More...
 
 getTextId ()
 Get the ID of the row of the text table that contains the content of the revision's main slot, if that content is stored in the text table. More...
 
 getTimestamp ()
 
 getTitle ()
 Returns the title of the page associated with this entry. More...
 
 getUser ( $audience=self::FOR_PUBLIC, User $user=null)
 Fetch revision's user id if it's available to the specified audience. More...
 
 getUserText ( $audience=self::FOR_PUBLIC, User $user=null)
 Fetch revision's username if it's available to the specified audience. More...
 
 getVisibility ()
 Get the deletion bitfield of the revision. More...
 
 insertOn ( $dbw)
 Insert a new revision into the database, returning the new revision ID number on success and dies horribly on failure. More...
 
 isCurrent ()
 
 isDeleted ( $field)
 
 isMinor ()
 
 isUnpatrolled ()
 
 setId ( $id)
 Set the revision ID. More...
 
 setTitle ( $title)
 Set the title of the revision. More...
 
 setUserIdAndName ( $id, $name)
 Set the user ID/name. More...
 
 userCan ( $field, User $user=null)
 Determine if the current user is allowed to view a particular field of this revision, if it's marked as deleted. More...
 

Static Public Member Functions

static base36Sha1 ( $text)
 Get the base 36 SHA-1 value for a string of text. More...
 
static compressRevisionText (&$text)
 If $wgCompressRevisions is enabled, we will compress data. More...
 
static countByPageId ( $db, $id)
 Get count of revisions per page...not very efficient. More...
 
static countByTitle ( $db, $title)
 Get count of revisions per page...not very efficient. More...
 
static decompressRevisionText ( $text, $flags)
 Re-converts revision text according to it's flags. More...
 
static getArchiveQueryInfo ()
 Return the tables, fields, and join conditions to be selected to create a new archived revision object. More...
 
static getParentLengths ( $db, array $revIds)
 Do a batched query to get the parent revision lengths. More...
 
static getQueryInfo ( $options=[])
 Return the tables, fields, and join conditions to be selected to create a new revision object. More...
 
static getRevisionText ( $row, $prefix='old_', $wiki=false)
 Get revision text associated with an old or archive row. More...
 
static getTimestampFromId ( $title, $id, $flags=0)
 Get rev_timestamp from rev_id, without loading the rest of the row. More...
 
static loadFromPageId ( $db, $pageid, $id=0)
 Load either the current, or a specified, revision that's attached to a given page. More...
 
static loadFromTimestamp ( $db, $title, $timestamp)
 Load the revision for the given title with the given timestamp. More...
 
static loadFromTitle ( $db, $title, $id=0)
 Load either the current, or a specified, revision that's attached to a given page. More...
 
static newFromArchiveRow ( $row, $overrides=[])
 Make a fake revision object from an archive table row. More...
 
static newFromId ( $id, $flags=0)
 Load a page revision from a given revision ID number. More...
 
static newFromPageId ( $pageId, $revId=0, $flags=0)
 Load either the current, or a specified, revision that's attached to a given page ID. More...
 
static newFromRow ( $row)
 
static newFromTitle (LinkTarget $linkTarget, $id=0, $flags=0)
 Load either the current, or a specified, revision that's attached to a given link target. More...
 
static newKnownCurrent (IDatabase $db, $pageIdOrTitle, $revId=0)
 Load a revision based on a known page ID and current revision ID from the DB. More...
 
static newNullRevision ( $dbw, $pageId, $summary, $minor, $user=null)
 Create a new null-revision for insertion into a page's history. More...
 
static userCanBitfield ( $bitfield, $field, User $user=null, Title $title=null)
 Determine if the current user is allowed to view a particular field of this revision, if it's marked as deleted. More...
 
static userWasLastToEdit ( $db, $pageId, $userId, $since)
 Check if no edits were made by other users since the time a user started editing the page. More...
 

Public Attributes

const DELETED_COMMENT = RevisionRecord::DELETED_COMMENT
 
const DELETED_RESTRICTED = RevisionRecord::DELETED_RESTRICTED
 
const DELETED_TEXT = RevisionRecord::DELETED_TEXT
 
const DELETED_USER = RevisionRecord::DELETED_USER
 
const FOR_PUBLIC = RevisionRecord::FOR_PUBLIC
 
const FOR_THIS_USER = RevisionRecord::FOR_THIS_USER
 
const RAW = RevisionRecord::RAW
 
const SUPPRESSED_ALL = RevisionRecord::SUPPRESSED_ALL
 
const SUPPRESSED_USER = RevisionRecord::SUPPRESSED_USER
 
const TEXT_CACHE_GROUP = SqlBlobStore::TEXT_CACHE_GROUP
 
- Public Attributes inherited from IDBAccessObject
const READ_LOCKING = self::READ_LATEST | 2
 Constants for object loading bitfield flags (higher => higher QoS) More...
 
const READ_NONE = -1
 

Private Member Functions

 ensureTitle ( $row, $queryFlags, $title=null)
 Make sure we have some Title object for use by the constructor. More...
 
 getMainSlotRaw ()
 

Static Private Member Functions

static getBlobStore ( $wiki=false)
 
static getRevisionFactory ()
 
static getRevisionLookup ()
 
static getRevisionStore ( $wiki=false)
 

Private Attributes

RevisionRecord $mRecord
 

Detailed Description

Deprecated:
since 1.31, use RevisionRecord, RevisionStore, and BlobStore instead.

Definition at line 39 of file Revision.php.

Constructor & Destructor Documentation

◆ __construct()

Revision::__construct (   $row,
  $queryFlags = 0,
Title  $title = null 
)
Parameters
object | array | RevisionRecord$rowEither a database row or an array
int$queryFlags
Title | null$titleSince 1.35, constructing with anything other than a RevisionRecord is hard deprecated (since 1.31 the entire class is deprecated)

Definition at line 364 of file Revision.php.

References $title, ensureTitle(), getRevisionFactory(), and wfDeprecated().

Member Function Documentation

◆ base36Sha1()

static Revision::base36Sha1 (   $text)
static

Get the base 36 SHA-1 value for a string of text.

Deprecated:
since 1.31 (soft), 1.35 (hard)
Parameters
string$text
Returns
string

Definition at line 1044 of file Revision.php.

References Revision\SlotRecord\base36Sha1(), and wfDeprecated().

◆ compressRevisionText()

static Revision::compressRevisionText ( $text)
static

If $wgCompressRevisions is enabled, we will compress data.

The input string is modified in place. Return value is the flags field: contains 'gzip' if the data is compressed, and 'utf-8' if we're saving in UTF-8 mode.

Deprecated:
since 1.31 (soft), 1.35 (hard)
Parameters
string&$text
Returns
string

Definition at line 980 of file Revision.php.

References getBlobStore(), and wfDeprecated().

◆ countByPageId()

static Revision::countByPageId (   $db,
  $id 
)
static

Get count of revisions per page...not very efficient.

Deprecated:
since 1.31 (soft), 1.35 (hard)
Parameters
IDatabase$db
int$idPage id
Returns
int

Definition at line 1157 of file Revision.php.

References getRevisionStore(), and wfDeprecated().

◆ countByTitle()

static Revision::countByTitle (   $db,
  $title 
)
static

Get count of revisions per page...not very efficient.

Deprecated:
since 1.31 (soft), 1.35 (hard)
Parameters
IDatabase$db
Title$title
Returns
int

Definition at line 1171 of file Revision.php.

References $title, getRevisionStore(), and wfDeprecated().

◆ decompressRevisionText()

static Revision::decompressRevisionText (   $text,
  $flags 
)
static

Re-converts revision text according to it's flags.

Deprecated:
since 1.31 (soft), 1.35 (hard)
Parameters
string | false$text
array$flagsCompression flags
Returns
string|bool Decompressed text, or false on failure

Definition at line 994 of file Revision.php.

References getBlobStore(), and wfDeprecated().

◆ ensureTitle()

Revision::ensureTitle (   $row,
  $queryFlags,
  $title = null 
)
private

Make sure we have some Title object for use by the constructor.

For B/C, the constructor shouldn't fail even for a bad page ID or bad revision ID.

Parameters
array | object$row
int$queryFlags
Title | null$title
Returns
Title $title if not null, or a Title constructed from information in $row.

Definition at line 408 of file Revision.php.

References $title, getRevisionStore(), Title\makeTitleSafe(), NS_SPECIAL, and wfLogWarning().

Referenced by __construct().

◆ getArchiveQueryInfo()

static Revision::getArchiveQueryInfo ( )
static

Return the tables, fields, and join conditions to be selected to create a new archived revision object.

Since
1.31
Deprecated:
since 1.31 (soft), 1.35 (hard), use RevisionStore::getArchiveQueryInfo() instead.
Returns
array With three keys:
  • tables: (string[]) to include in the $table to IDatabase->select()
  • fields: (string[]) to include in the $vars to IDatabase->select()
  • joins: (array) to include in the $join_conds to IDatabase->select()

Definition at line 334 of file Revision.php.

References getRevisionStore(), and wfDeprecated().

◆ getBlobStore()

static Revision::getBlobStore (   $wiki = false)
staticprivate
Parameters
bool | string$wikiThe ID of the target wiki database. Use false for the local wiki.
Returns
SqlBlobStore

Definition at line 91 of file Revision.php.

Referenced by compressRevisionText(), decompressRevisionText(), and getTextId().

◆ getComment()

Revision::getComment (   $audience = self::FOR_PUBLIC,
User  $user = null 
)
Deprecated:
since 1.31 (soft), 1.35 (hard)
Parameters
int$audienceOne of: Revision::FOR_PUBLIC to be displayed to all users Revision::FOR_THIS_USER to be displayed to the given user Revision::RAW get the text regardless of permissions
User | null$userUser object to check for, only if FOR_THIS_USER is passed to the $audience parameter (not passing for FOR_THIS_USER is deprecated since 1.35)
Returns
string|null Returns null if the specified audience does not have access to the comment.

Definition at line 692 of file Revision.php.

References wfDeprecated().

◆ getContent()

Revision::getContent (   $audience = self::FOR_PUBLIC,
User  $user = null 
)

Fetch revision content if it's available to the specified audience.

If the specified audience does not have the ability to view this revision, or the content could not be loaded, null will be returned.

Deprecated:
since 1.31 (soft), 1.35 (hard)
Parameters
int$audienceOne of: Revision::FOR_PUBLIC to be displayed to all users Revision::FOR_THIS_USER to be displayed to $user Revision::RAW get the text regardless of permissions
User | null$userUser object to check for, only if FOR_THIS_USER is passed to the $audience parameter
Since
1.21
Returns
Content|null

Definition at line 778 of file Revision.php.

References Revision\SlotRecord\MAIN, and wfDeprecated().

◆ getContentFormat()

Revision::getContentFormat ( )

Returns the content format for the main slot of this revision.

If no content format was stored in the database, the default format for this revision's content model is returned.

Deprecated:
since 1.31 (soft), 1.35 (hard)
Returns
string The content format id associated with this revision, see the CONTENT_FORMAT_XXX constants.

Definition at line 846 of file Revision.php.

References getContentHandler(), getMainSlotRaw(), and wfDeprecated().

◆ getContentHandler()

Revision::getContentHandler ( )

Returns the content handler appropriate for this revision's content model.

Deprecated:
since 1.31 (soft), 1.35 (hard)
Exceptions
MWException
Returns
ContentHandler

Definition at line 868 of file Revision.php.

References getContentModel(), and wfDeprecated().

Referenced by getContentFormat(), and WikiPage\getUndoContent().

◆ getContentModel()

Revision::getContentModel ( )

Returns the content model for the main slot of this revision.

If no content model was stored in the database, the default content model for the title is used to determine the content model to use. If no title is know, CONTENT_MODEL_WIKITEXT is used as a last resort.

Deprecated:
since 1.31 (soft), 1.35 (hard)
Returns
string The content model id associated with this revision, see the CONTENT_MODEL_XXX constants.

Definition at line 821 of file Revision.php.

References getMainSlotRaw(), getTitle(), Revision\SlotRecord\MAIN, and wfDeprecated().

Referenced by getContentHandler().

◆ getId()

Revision::getId ( )

Get revision ID.

Returns
int|null

Definition at line 455 of file Revision.php.

◆ getMainSlotRaw()

Revision::getMainSlotRaw ( )
private
Returns
SlotRecord|null

Definition at line 508 of file Revision.php.

References Revision\SlotRecord\MAIN, and Revision\RevisionRecord\RAW.

Referenced by getContentFormat(), getContentModel(), getSerializedData(), and getTextId().

◆ getNext()

Revision::getNext ( )

Get next revision for this title.

Deprecated:
since 1.31 (soft), 1.35 (hard), use RevisionLookup::getNextRevision instead
Returns
Revision|null

Definition at line 916 of file Revision.php.

References getRevisionLookup(), getTitle(), and wfDeprecated().

◆ getPage()

Revision::getPage ( )

Get the page ID.

Deprecated:
since 1.31 (soft), 1.35 (hard)
Returns
int|null

Definition at line 621 of file Revision.php.

References wfDeprecated().

◆ getParentId()

Revision::getParentId ( )

Get parent revision ID (the original previous page revision)

Deprecated:
since 1.31 (soft), 1.35 (hard)
Returns
int|null The ID of the parent revision. 0 indicates that there is no parent revision. Null indicates that the parent revision is not known.

Definition at line 545 of file Revision.php.

References wfDeprecated().

◆ getParentLengths()

static Revision::getParentLengths (   $db,
array  $revIds 
)
static

Do a batched query to get the parent revision lengths.

Deprecated:
in 1.31, use RevisionStore::getRevisionSizes instead. Hard deprecated since 1.35.
Parameters
IDatabase$db
array$revIds
Returns
array

Definition at line 349 of file Revision.php.

References getRevisionStore(), and wfDeprecated().

◆ getPrevious()

Revision::getPrevious ( )

Get previous revision for this title.

Deprecated:
since 1.31 (soft), 1.35 (hard)
Returns
Revision|null

Definition at line 903 of file Revision.php.

References getRevisionLookup(), getTitle(), and wfDeprecated().

◆ getQueryInfo()

static Revision::getQueryInfo (   $options = [])
static

Return the tables, fields, and join conditions to be selected to create a new revision object.

Since
1.31
Deprecated:
since 1.31 (soft), 1.35 (hard), use RevisionStore::getQueryInfo() instead.
Parameters
array$optionsAny combination of the following strings
  • 'page': Join with the page table, and select fields to identify the page
  • 'user': Join with the user table, and select the user name
  • 'text': Join with the text table, and select fields to load page text
Returns
array With three keys:
  • tables: (string[]) to include in the $table to IDatabase->select()
  • fields: (string[]) to include in the $vars to IDatabase->select()
  • joins: (array) to include in the $join_conds to IDatabase->select()

Definition at line 318 of file Revision.php.

References getRevisionStore(), and wfDeprecated().

◆ getRecentChange()

Revision::getRecentChange (   $flags = 0)

Get the RC object belonging to the current revision, if there's one.

Deprecated:
since 1.31 (soft), 1.35 (hard)
Parameters
int$flags(optional) $flags include: Revision::READ_LATEST : Select the data from the master
Since
1.22
Returns
RecentChange|null

Definition at line 733 of file Revision.php.

References getRevisionStore(), and wfDeprecated().

◆ getRevisionFactory()

static Revision::getRevisionFactory ( )
staticprivate
Returns
RevisionFactory

Definition at line 82 of file Revision.php.

Referenced by __construct(), newFromArchiveRow(), and newFromRow().

◆ getRevisionLookup()

static Revision::getRevisionLookup ( )
staticprivate
Returns
RevisionLookup

Definition at line 75 of file Revision.php.

Referenced by getNext(), getPrevious(), newFromId(), newFromPageId(), newFromTitle(), and newKnownCurrent().

◆ getRevisionRecord()

Revision::getRevisionRecord ( )
Returns
RevisionRecord

Definition at line 446 of file Revision.php.

References $mRecord.

Referenced by WikiPage\getUndoContent(), and LinksUpdate\setRevision().

◆ getRevisionStore()

static Revision::getRevisionStore (   $wiki = false)
staticprivate

◆ getRevisionText()

static Revision::getRevisionText (   $row,
  $prefix = 'old_',
  $wiki = false 
)
static

Get revision text associated with an old or archive row.

If the text field is not included, this uses RevisionStore to load the appropriate slot and return its serialized content. This is the default backwards-compatibility behavior when reading from the MCR aware database schema is enabled. For this to work, either the revision ID or the page ID must be included in the row.

When using the old text field, the flags field must also be set. Including the old_id field will activate cache usage as long as the $wiki parameter is not set.

Deprecated:
since 1.32, use RevisionStore::newRevisionFromRow instead.
Parameters
stdClass$rowThe text data. If a falsy value is passed instead, false is returned.
string$prefixTable prefix (default 'old_')
string | bool$wikiThe name of the wiki to load the revision text from (same as the wiki $row was loaded from) or false to indicate the local wiki (this is the default). Otherwise, it must be a symbolic wiki database identifier as understood by the LoadBalancer class.
Returns
string|false Text the text requested or false on failure

Definition at line 943 of file Revision.php.

References $content, getRevisionStore(), Revision\SlotRecord\MAIN, and wfDeprecated().

◆ getSerializedData()

Revision::getSerializedData ( )

Get original serialized data (without checking view restrictions)

Since
1.21
Deprecated:
since 1.31 (soft), 1.35 (hard), use BlobStore::getBlob instead.
Returns
string

Definition at line 803 of file Revision.php.

References getMainSlotRaw(), and wfDeprecated().

◆ getSha1()

Revision::getSha1 ( )

Returns the base36 sha1 of the content in this revision, or null if unknown.

Deprecated:
since 1.31 (soft), 1.35 (hard)
Returns
string|null

Definition at line 573 of file Revision.php.

References wfDeprecated().

◆ getSize()

Revision::getSize ( )

Returns the length of the text in this revision, or null if unknown.

Deprecated:
since 1.31 (soft), 1.35 (hard)
Returns
int|null

Definition at line 557 of file Revision.php.

References wfDeprecated().

◆ getTextId()

Revision::getTextId ( )

Get the ID of the row of the text table that contains the content of the revision's main slot, if that content is stored in the text table.

If the content is stored elsewhere, this returns null.

Deprecated:
since 1.31 (soft), 1.35 (hard), use RevisionRecord()->getSlot()->getContentAddress() to get that actual address that can be used with BlobStore::getBlob(); or use RevisionRecord::hasSameContent() to check if two revisions have the same content.
Returns
int|null

Definition at line 529 of file Revision.php.

References getBlobStore(), getMainSlotRaw(), and wfDeprecated().

◆ getTimestamp()

Revision::getTimestamp ( )
Deprecated:
since 1.31 (soft), 1.35 (hard)
Returns
string

Definition at line 881 of file Revision.php.

References wfDeprecated().

◆ getTimestampFromId()

static Revision::getTimestampFromId (   $title,
  $id,
  $flags = 0 
)
static

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

Deprecated:
since 1.35
Parameters
Title$title(ignored since 1.34)
int$id
int$flags
Returns
string|bool False if not found

Definition at line 1143 of file Revision.php.

References getRevisionStore(), and wfDeprecated().

◆ getTitle()

Revision::getTitle ( )

Returns the title of the page associated with this entry.

Since 1.31, this will never return null.

Will do a query, when title is not set and id is given.

Returns
Title

Definition at line 590 of file Revision.php.

References Title\newFromLinkTarget().

Referenced by getContentModel(), getNext(), and getPrevious().

◆ getUser()

Revision::getUser (   $audience = self::FOR_PUBLIC,
User  $user = null 
)

Fetch revision's user id if it's available to the specified audience.

If the specified audience does not have access to it, zero will be returned.

Parameters
int$audienceOne of: Revision::FOR_PUBLIC to be displayed to all users Revision::FOR_THIS_USER to be displayed to the given user Revision::RAW get the ID regardless of permissions
User | null$userUser object to check for, only if FOR_THIS_USER is passed to the $audience parameter (not passing for FOR_THIS_USER is deprecated since 1.35)
Returns
int

Definition at line 639 of file Revision.php.

References wfDeprecated().

◆ getUserText()

Revision::getUserText (   $audience = self::FOR_PUBLIC,
User  $user = null 
)

Fetch revision's username if it's available to the specified audience.

If the specified audience does not have access to the username, an empty string will be returned.

Deprecated:
since 1.31 (soft), 1.35 (hard)
Parameters
int$audienceOne of: Revision::FOR_PUBLIC to be displayed to all users Revision::FOR_THIS_USER to be displayed to the given user Revision::RAW get the text regardless of permissions
User | null$userUser object to check for, only if FOR_THIS_USER is passed to the $audience parameter (not passing for FOR_THIS_USER is deprecated since 1.35)
Returns
string

Definition at line 668 of file Revision.php.

References wfDeprecated().

◆ getVisibility()

Revision::getVisibility ( )

Get the deletion bitfield of the revision.

Deprecated:
since 1.31 (soft), 1.35 (hard)
Returns
int

Definition at line 757 of file Revision.php.

References wfDeprecated().

◆ insertOn()

Revision::insertOn (   $dbw)

Insert a new revision into the database, returning the new revision ID number on success and dies horribly on failure.

Deprecated:
since 1.31 (soft), 1.35 (hard)
Parameters
IDatabase$dbw(master connection)
Exceptions
MWException
Returns
int The revision ID

Definition at line 1014 of file Revision.php.

References getRevisionStore(), Revision\RevisionRecord\RAW, and wfDeprecated().

◆ isCurrent()

Revision::isCurrent ( )
Deprecated:
since 1.31 (soft), 1.35 (hard)
Returns
bool

Definition at line 891 of file Revision.php.

References wfDeprecated().

◆ isDeleted()

Revision::isDeleted (   $field)
Parameters
int$fieldOne of DELETED_* bitfield constants
Deprecated:
since 1.31 (soft), 1.35 (hard)
Returns
bool

Definition at line 745 of file Revision.php.

References wfDeprecated().

◆ isMinor()

Revision::isMinor ( )
Deprecated:
since 1.31 (soft), 1.35 (hard)
Returns
bool

Definition at line 708 of file Revision.php.

References wfDeprecated().

◆ isUnpatrolled()

Revision::isUnpatrolled ( )
Deprecated:
since 1.31 (soft), 1.35 (hard)
Returns
int Rcid of the unpatrolled row, zero if there isn't one

Definition at line 717 of file Revision.php.

References getRevisionStore(), and wfDeprecated().

◆ loadFromPageId()

static Revision::loadFromPageId (   $db,
  $pageid,
  $id = 0 
)
static

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

If not attached to that page, will return null.

Deprecated:
since 1.31, use RevisionStore::getRevisionByPageId() instead. Hard deprecated since 1.35
Parameters
IDatabase$db
int$pageid
int$id
Returns
Revision|null

Definition at line 260 of file Revision.php.

References getRevisionStore(), and wfDeprecated().

◆ loadFromTimestamp()

static Revision::loadFromTimestamp (   $db,
  $title,
  $timestamp 
)
static

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.

Deprecated:
since 1.31, use RevisionStore::getRevisionByTimestamp() or RevisionStore::loadRevisionFromTimestamp() instead. Hard deprecated since 1.35
Parameters
IDatabase$db
Title$title
string$timestamp
Returns
Revision|null

Definition at line 298 of file Revision.php.

References $title, getRevisionStore(), and wfDeprecated().

◆ loadFromTitle()

static Revision::loadFromTitle (   $db,
  $title,
  $id = 0 
)
static

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

If not attached to that page, will return null.

Deprecated:
since 1.31, use RevisionStore::getRevisionByTitle() instead. Hard deprecated in 1.35
Parameters
IDatabase$db
Title$title
int$id
Returns
Revision|null

Definition at line 279 of file Revision.php.

References $title, getRevisionStore(), and wfDeprecated().

◆ newFromArchiveRow()

static Revision::newFromArchiveRow (   $row,
  $overrides = [] 
)
static

Make a fake revision object from an archive table row.

This is queried for permissions or even inserted (as in Special:Undelete)

Deprecated:
since 1.31 (soft), 1.35 (hard)
Parameters
object$row
array$overrides
Exceptions
MWException
Returns
Revision

Definition at line 182 of file Revision.php.

References $title, getRevisionFactory(), Title\makeTitle(), and wfDeprecated().

◆ newFromId()

static Revision::newFromId (   $id,
  $flags = 0 
)
static

Load a page revision from a given revision ID number.

Returns null if no such revision can be found.

Deprecated:
since 1.31 together with the class. Hard deprecated since 1.35

$flags include: Revision::READ_LATEST : Select the data from the master Revision::READ_LOCKING : Select & lock the data from the master

Parameters
int$id
int$flags(optional)
Returns
Revision|null

Definition at line 120 of file Revision.php.

References getRevisionLookup(), and wfDeprecated().

◆ newFromPageId()

static Revision::newFromPageId (   $pageId,
  $revId = 0,
  $flags = 0 
)
static

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.

$flags include: Revision::READ_LATEST : Select the data from the master (since 1.20) Revision::READ_LOCKING : Select & lock the data from the master

Deprecated:
since 1.31 together with the class. Hard deprecated since 1.35
Parameters
int$pageId
int$revId(optional)
int$flagsBitfield (optional)
Returns
Revision|null

Definition at line 164 of file Revision.php.

References getRevisionLookup(), and wfDeprecated().

◆ newFromRow()

static Revision::newFromRow (   $row)
static
Since
1.19

MCR migration note: replaced by RevisionStore::newRevisionFromRow(). Note that newFromRow() also accepts arrays, while newRevisionFromRow() does not. Instead, a MutableRevisionRecord should be constructed directly. RevisionStore::newMutableRevisionFromArray() can be used as a temporary replacement, but should be avoided.

Deprecated:
since 1.31 together with the Revision class. Hard deprecated since 1.35
Parameters
object | array$row
Returns
Revision

Definition at line 236 of file Revision.php.

References getRevisionFactory(), and wfDeprecated().

◆ newFromTitle()

static Revision::newFromTitle ( LinkTarget  $linkTarget,
  $id = 0,
  $flags = 0 
)
static

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.

Deprecated:
since 1.31 together with the class. Hard deprecated since 1.35

$flags include: Revision::READ_LATEST : Select the data from the master Revision::READ_LOCKING : Select & lock the data from the master

Parameters
LinkTarget$linkTarget
int$id(optional)
int$flagsBitfield (optional)
Returns
Revision|null

Definition at line 142 of file Revision.php.

References getRevisionLookup(), and wfDeprecated().

Referenced by Title\countRevisionsBetween(), and Title\getAuthorsBetween().

◆ newKnownCurrent()

static Revision::newKnownCurrent ( IDatabase  $db,
  $pageIdOrTitle,
  $revId = 0 
)
static

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. The title will also be loaded if $pageIdOrTitle is an integer ID.

Parameters
IDatabase$dbignored!
int | Title$pageIdOrTitlePage ID or Title object
int$revIdKnown current revision of this page. Determined automatically if not given.
Returns
Revision|bool Returns false if missing
Since
1.28
Deprecated:
since 1.31 and hard deprecated since 1.35

Definition at line 1215 of file Revision.php.

References $title, getRevisionLookup(), Title\newFromID(), and wfDeprecated().

◆ newNullRevision()

static Revision::newNullRevision (   $dbw,
  $pageId,
  $summary,
  $minor,
  $user = null 
)
static

Create a new null-revision for insertion into a page's history.

This will not re-save the text, but simply refer to the text from the previous version.

Such revisions can for instance identify page rename operations and other such meta-modifications.

Deprecated:
since 1.31 (soft), 1.35 (hard)
Parameters
IDatabase$dbw
int$pageIdID number of the page to read from
string$summaryRevision's summary
bool$minorWhether the revision should be considered as minor
User | null$userUser object to use or null for $wgUser
Returns
Revision|null Revision or null on error

Definition at line 1066 of file Revision.php.

References $title, getRevisionStore(), Title\newFromID(), CommentStoreComment\newUnsavedComment(), and wfDeprecated().

◆ setId()

Revision::setId (   $id)

Set the revision ID.

This should only be used for proposed revisions that turn out to be null edits.

Note
Only supported on Revisions that were constructed based on associative arrays, since they are mutable.
Deprecated:
since 1.31 (soft), 1.35 (hard)
Since
1.19
Parameters
int | string$id
Exceptions
MWException

Definition at line 472 of file Revision.php.

References wfDeprecated().

◆ setTitle()

Revision::setTitle (   $title)

Set the title of the revision.

Deprecated:
since 1.31, this is now a noop. Pass the Title to the constructor instead. hard deprecated since 1.35
Parameters
Title$title

Definition at line 603 of file Revision.php.

References $title, and wfDeprecated().

◆ setUserIdAndName()

Revision::setUserIdAndName (   $id,
  $name 
)

Set the user ID/name.

This should only be used for proposed revisions that turn out to be null edits

Note
Only supported on Revisions that were constructed based on associative arrays, since they are mutable.
Since
1.28
Deprecated:
since 1.31 (soft), 1.35 (hard), please reuse old Revision object
Parameters
int$idUser ID
string$nameUser name
Exceptions
MWException

Definition at line 495 of file Revision.php.

References User\newFromAnyId(), and wfDeprecated().

◆ userCan()

Revision::userCan (   $field,
User  $user = null 
)

Determine if the current user is allowed to view a particular field of this revision, if it's marked as deleted.

Deprecated:
since 1.31 (soft), 1.35 (hard)
Parameters
int$fieldOne of self::DELETED_TEXT, self::DELETED_COMMENT, self::DELETED_USER
User | null$userUser object to check, or null to use $wgUser (deprecated since 1.35)
Returns
bool

Definition at line 1098 of file Revision.php.

References Revision\RevisionRecord\userCanBitfield(), and wfDeprecated().

◆ userCanBitfield()

static Revision::userCanBitfield (   $bitfield,
  $field,
User  $user = null,
Title  $title = null 
)
static

Determine if the current user is allowed to view a particular field of this revision, if it's marked as deleted.

This is used by various classes to avoid duplication.

Parameters
int$bitfieldCurrent field
int$fieldOne of self::DELETED_TEXT = File::DELETED_FILE, self::DELETED_COMMENT = File::DELETED_COMMENT, self::DELETED_USER = File::DELETED_USER
User | null$userUser object to check, or null to use $wgUser
Title | null$titleA Title object to check for per-page restrictions on, instead of just plain userrights
Returns
bool

Definition at line 1121 of file Revision.php.

References $title, Revision\RevisionRecord\userCanBitfield(), and wfDeprecated().

◆ userWasLastToEdit()

static Revision::userWasLastToEdit (   $db,
  $pageId,
  $userId,
  $since 
)
static

Check if no edits were made by other users since the time a user started editing the page.

Limit to 50 revisions for the sake of performance.

Since
1.20
Deprecated:
since 1.24 (soft), 1.35 (hard)
Parameters
IDatabase | int$dbThe Database to perform the check on. May be given as a Database object or a database identifier usable with wfGetDB.
int$pageIdThe ID of the page in question
int$userIdThe ID of the user in question
string$sinceLook at edits since this time
Returns
bool True if the given user was the only one to edit since the given timestamp

Definition at line 1192 of file Revision.php.

References getRevisionStore(), wfDeprecated(), and wfGetDB().

Member Data Documentation

◆ $mRecord

RevisionRecord Revision::$mRecord
private

Definition at line 42 of file Revision.php.

Referenced by getRevisionRecord().

◆ DELETED_COMMENT

const Revision::DELETED_COMMENT = RevisionRecord::DELETED_COMMENT

Definition at line 46 of file Revision.php.

◆ DELETED_RESTRICTED

const Revision::DELETED_RESTRICTED = RevisionRecord::DELETED_RESTRICTED

Definition at line 48 of file Revision.php.

◆ DELETED_TEXT

const Revision::DELETED_TEXT = RevisionRecord::DELETED_TEXT

Definition at line 45 of file Revision.php.

◆ DELETED_USER

const Revision::DELETED_USER = RevisionRecord::DELETED_USER

Definition at line 47 of file Revision.php.

◆ FOR_PUBLIC

const Revision::FOR_PUBLIC = RevisionRecord::FOR_PUBLIC

Definition at line 53 of file Revision.php.

◆ FOR_THIS_USER

const Revision::FOR_THIS_USER = RevisionRecord::FOR_THIS_USER

Definition at line 54 of file Revision.php.

◆ RAW

const Revision::RAW = RevisionRecord::RAW

Definition at line 55 of file Revision.php.

◆ SUPPRESSED_ALL

const Revision::SUPPRESSED_ALL = RevisionRecord::SUPPRESSED_ALL

Definition at line 50 of file Revision.php.

◆ SUPPRESSED_USER

const Revision::SUPPRESSED_USER = RevisionRecord::SUPPRESSED_USER

Definition at line 49 of file Revision.php.

◆ TEXT_CACHE_GROUP

const Revision::TEXT_CACHE_GROUP = SqlBlobStore::TEXT_CACHE_GROUP

Definition at line 57 of file Revision.php.


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