[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/ -> Revision.php (summary)

Representation of a page version. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

File Size: 1790 lines (51 kb)
Included or required:0 times
Referenced: 1 time
Includes or requires: 0 files

Defines 1 class

Revision:: (69 methods):
  newFromId()
  newFromTitle()
  newFromPageId()
  newFromArchiveRow()
  newFromRow()
  loadFromId()
  loadFromPageId()
  loadFromTitle()
  loadFromTimestamp()
  newFromConds()
  loadFromConds()
  fetchRevision()
  fetchFromConds()
  userJoinCond()
  pageJoinCond()
  selectFields()
  selectArchiveFields()
  selectTextFields()
  selectPageFields()
  selectUserFields()
  getParentLengths()
  __construct()
  getId()
  setId()
  getTextId()
  getParentId()
  getSize()
  getSha1()
  getTitle()
  setTitle()
  getPage()
  getUser()
  getRawUser()
  getUserText()
  getRawUserText()
  getComment()
  getRawComment()
  isMinor()
  isUnpatrolled()
  getRecentChange()
  isDeleted()
  getVisibility()
  getText()
  getContent()
  getRawText()
  getSerializedData()
  getContentInternal()
  getContentModel()
  getContentFormat()
  getContentHandler()
  getTimestamp()
  isCurrent()
  getPrevious()
  getNext()
  getPreviousRevisionId()
  getRevisionText()
  compressRevisionText()
  decompressRevisionText()
  insertOn()
  checkContentModel()
  base36Sha1()
  loadText()
  newNullRevision()
  userCan()
  userCanBitfield()
  getTimestampFromId()
  countByPageId()
  countByTitle()
  userWasLastToEdit()


Class: Revision  - X-Ref


newFromId( $id, $flags = 0 )   X-Ref
Load a page revision from a given revision ID number.
Returns null if no such revision can be found.

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

param: int $id
param: int $flags (optional)
return: Revision|null

newFromTitle( $title, $id = 0, $flags = 0 )   X-Ref
Load either the current, or a specified, revision
that's attached to a given title. If not attached
to that title, will return null.

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

param: Title $title
param: int $id (optional)
param: int $flags Bitfield (optional)
return: Revision|null

newFromPageId( $pageId, $revId = 0, $flags = 0 )   X-Ref
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

param: int $pageId
param: int $revId (optional)
param: int $flags Bitfield (optional)
return: Revision|null

newFromArchiveRow( $row, $overrides = array()   X-Ref
Make a fake revision object from an archive table row. This is queried
for permissions or even inserted (as in Special:Undelete)

param: object $row
param: array $overrides
return: Revision

newFromRow( $row )   X-Ref

param: object $row
return: Revision

loadFromId( $db, $id )   X-Ref
Load a page revision from a given revision ID number.
Returns null if no such revision can be found.

param: DatabaseBase $db
param: int $id
return: Revision|null

loadFromPageId( $db, $pageid, $id = 0 )   X-Ref
Load either the current, or a specified, revision
that's attached to a given page. If not attached
to that page, will return null.

param: DatabaseBase $db
param: int $pageid
param: int $id
return: Revision|null

loadFromTitle( $db, $title, $id = 0 )   X-Ref
Load either the current, or a specified, revision
that's attached to a given page. If not attached
to that page, will return null.

param: DatabaseBase $db
param: Title $title
param: int $id
return: Revision|null

loadFromTimestamp( $db, $title, $timestamp )   X-Ref
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.

param: DatabaseBase $db
param: Title $title
param: string $timestamp
return: Revision|null

newFromConds( $conditions, $flags = 0 )   X-Ref
Given a set of conditions, fetch a revision.

param: array $conditions
param: int $flags (optional)
return: Revision|null

loadFromConds( $db, $conditions, $flags = 0 )   X-Ref
Given a set of conditions, fetch a revision from
the given database connection.

param: DatabaseBase $db
param: array $conditions
param: int $flags (optional)
return: Revision|null

fetchRevision( $title )   X-Ref
Return a wrapper for a series of database rows to
fetch all of a given page's revisions in turn.
Each row can be fed to the constructor to get objects.

param: Title $title
return: ResultWrapper

fetchFromConds( $db, $conditions, $flags = 0 )   X-Ref
Given a set of conditions, return a ResultWrapper
which will return matching database rows with the
fields necessary to build Revision objects.

param: DatabaseBase $db
param: array $conditions
param: int $flags (optional)
return: ResultWrapper

userJoinCond()   X-Ref
Return the value of a select() JOIN conds array for the user table.
This will get user table rows for logged-in users.

return: array

pageJoinCond()   X-Ref
Return the value of a select() page conds array for the page table.
This will assure that the revision(s) are not orphaned from live pages.

return: array

selectFields()   X-Ref
Return the list of revision fields that should be selected to create
a new revision.

return: array

selectArchiveFields()   X-Ref
Return the list of revision fields that should be selected to create
a new revision from an archive row.

return: array

selectTextFields()   X-Ref
Return the list of text fields that should be selected to read the
revision text

return: array

selectPageFields()   X-Ref
Return the list of page fields that should be selected from page table

return: array

selectUserFields()   X-Ref
Return the list of user fields that should be selected from user table

return: array

getParentLengths( $db, array $revIds )   X-Ref
Do a batched query to get the parent revision lengths

param: DatabaseBase $db
param: array $revIds
return: array

__construct( $row )   X-Ref
Constructor

param: object|array $row Either a database row or an array

getId()   X-Ref
Get revision ID

return: int|null

setId( $id )   X-Ref
Set the revision ID

param: int $id

getTextId()   X-Ref
Get text row ID

return: int|null

getParentId()   X-Ref
Get parent revision ID (the original previous page revision)

return: int|null

getSize()   X-Ref
Returns the length of the text in this revision, or null if unknown.

return: int|null

getSha1()   X-Ref
Returns the base36 sha1 of the text in this revision, or null if unknown.

return: string|null

getTitle()   X-Ref
Returns the title of the page associated with this entry or null.

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

return: Title|null

setTitle( $title )   X-Ref
Set the title of the revision

param: Title $title

getPage()   X-Ref
Get the page ID

return: int|null

getUser( $audience = self::FOR_PUBLIC, User $user = null )   X-Ref
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.

param: int $audience One of:
param: User $user User object to check for, only if FOR_THIS_USER is passed
return: int

getRawUser()   X-Ref
Fetch revision's user id without regard for the current user's permissions

return: string

getUserText( $audience = self::FOR_PUBLIC, User $user = null )   X-Ref
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.

param: int $audience One of:
param: User $user User object to check for, only if FOR_THIS_USER is passed
return: string

getRawUserText()   X-Ref
Fetch revision's username without regard for view restrictions

return: string

getComment( $audience = self::FOR_PUBLIC, User $user = null )   X-Ref
Fetch revision comment if it's available to the specified audience.
If the specified audience does not have access to the comment, an
empty string will be returned.

param: int $audience One of:
param: User $user User object to check for, only if FOR_THIS_USER is passed
return: string

getRawComment()   X-Ref
Fetch revision comment without regard for the current user's permissions

return: string

isMinor()   X-Ref

return: bool

isUnpatrolled()   X-Ref

return: int Rcid of the unpatrolled row, zero if there isn't one

getRecentChange()   X-Ref
Get the RC object belonging to the current revision, if there's one

return: RecentChange|null

isDeleted( $field )   X-Ref

param: int $field One of DELETED_* bitfield constants
return: bool

getVisibility()   X-Ref
Get the deletion bitfield of the revision

return: int

getText( $audience = self::FOR_PUBLIC, User $user = null )   X-Ref
Fetch revision text if it's available to the specified audience.
If the specified audience does not have the ability to view this
revision, an empty string will be returned.

param: int $audience One of:
param: User $user User object to check for, only if FOR_THIS_USER is passed
return: string

getContent( $audience = self::FOR_PUBLIC, User $user = null )   X-Ref
Fetch revision content if it's available to the specified audience.
If the specified audience does not have the ability to view this
revision, null will be returned.

param: int $audience One of:
param: User $user User object to check for, only if FOR_THIS_USER is passed
return: Content|null

getRawText()   X-Ref
Fetch revision text without regard for view restrictions

return: string

getSerializedData()   X-Ref
Fetch original serialized data without regard for view restrictions

return: string

getContentInternal()   X-Ref
Gets the content object for the revision (or null on failure).

Note that for mutable Content objects, each call to this method will return a
fresh clone.

return: Content|null The Revision's content, or null on failure.

getContentModel()   X-Ref
Returns the content model for this revision.

If no content model was stored in the database, $this->getTitle()->getContentModel() is
used to determine the content model to use. If no title is know, CONTENT_MODEL_WIKITEXT
is used as a last resort.

return: string The content model id associated with this revision,

getContentFormat()   X-Ref
Returns the content format for this revision.

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

return: string The content format id associated with this revision,

getContentHandler()   X-Ref
Returns the content handler appropriate for this revision's content model.

return: ContentHandler

getTimestamp()   X-Ref

return: string

isCurrent()   X-Ref

return: bool

getPrevious()   X-Ref
Get previous revision for this title

return: Revision|null

getNext()   X-Ref
Get next revision for this title

return: Revision|null

getPreviousRevisionId( $db )   X-Ref
Get previous revision Id for this page_id
This is used to populate rev_parent_id on save

param: DatabaseBase $db
return: int

getRevisionText( $row, $prefix = 'old_', $wiki = false )   X-Ref
Get revision text associated with an old or archive row
$row is usually an object from wfFetchRow(), both the flags and the text
field must be included.

param: stdClass $row The text data
param: string $prefix Table prefix (default 'old_')
param: string|bool $wiki The name of the wiki to load the revision text from
return: string Text the text requested or false on failure

compressRevisionText( &$text )   X-Ref
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.

param: mixed $text Reference to a text
return: string

decompressRevisionText( $text, $flags )   X-Ref
Re-converts revision text according to it's flags.

param: mixed $text Reference to a text
param: array $flags Compression flags
return: string|bool Decompressed text, or false on failure

insertOn( $dbw )   X-Ref
Insert a new revision into the database, returning the new revision ID
number on success and dies horribly on failure.

param: DatabaseBase $dbw (master connection)
return: int

checkContentModel()   X-Ref
No description

base36Sha1( $text )   X-Ref
Get the base 36 SHA-1 value for a string of text

param: string $text
return: string

loadText()   X-Ref
Lazy-load the revision's text.
Currently hardcoded to the 'text' table storage engine.

return: string|bool The revision's text, or false on failure

newNullRevision( $dbw, $pageId, $summary, $minor, $user = null )   X-Ref
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.

param: DatabaseBase $dbw
param: int $pageId ID number of the page to read from
param: string $summary Revision's summary
param: bool $minor Whether the revision should be considered as minor
param: User|null $user User object to use or null for $wgUser
return: Revision|null Revision or null on error

userCan( $field, User $user = null )   X-Ref
Determine if the current user is allowed to view a particular
field of this revision, if it's marked as deleted.

param: int $field One of self::DELETED_TEXT,
param: User|null $user User object to check, or null to use $wgUser
return: bool

userCanBitfield( $bitfield, $field, User $user = null,Title $title = null)   X-Ref
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.

param: int $bitfield Current field
param: int $field One of self::DELETED_TEXT = File::DELETED_FILE,
param: User|null $user User object to check, or null to use $wgUser
param: Title|null $title A Title object to check for per-page restrictions on,
return: bool

getTimestampFromId( $title, $id )   X-Ref
Get rev_timestamp from rev_id, without loading the rest of the row

param: Title $title
param: int $id
return: string

countByPageId( $db, $id )   X-Ref
Get count of revisions per page...not very efficient

param: DatabaseBase $db
param: int $id Page id
return: int

countByTitle( $db, $title )   X-Ref
Get count of revisions per page...not very efficient

param: DatabaseBase $db
param: Title $title
return: int

userWasLastToEdit( $db, $pageId, $userId, $since )   X-Ref
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.

param: DatabaseBase|int $db The Database to perform the check on. May be given as a
param: int $pageId The ID of the page in question
param: int $userId The ID of the user in question
param: string $since Look at edits since this time
return: bool True if the given user was the only one to edit since the given timestamp



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1