Manual:Revision.php
From Linux Web Expert
<td class="mw-version-versionbox" title="<translate nowrap> MediaWiki <tvar name=1>1.36</tvar> is unsupported version</translate>">
<translate> ≤</translate> 1.36
Gerrit change 684071<translate> MediaWiki version:</translate> |
MediaWiki file: Revision.php | |
---|---|
Location: | includes/ |
Source code: | master • 1.41.1 • 1.40.3 • 1.39.7 |
Classes: | Revision |
The Revision
class represents a MediaWiki revision.
This class was deprecated in MediaWiki 1.31, in favor of RevisionRecord (doc), RevisionStore (doc) and SqlBlobStore (doc). It was completely removed in MediaWiki 1.37. See Manual:Revision.php/Migration .
Creating a new Revision object
To instantiate Revision
, call one of the static factory methods:
loadFromId( $db, $id )
- load a page revision from a given revision ID number.loadFromPageId( $db, $pageid, $id = 0 )
- load either the current, or a specified, revision that's attached to a given page.loadFromTimestamp( $db, $title, $timestamp )
- load the revision for the given title with the given timestamp.loadFromTitle( $db, $title, $id = 0 )
- load either the current, or a specified, revision that's attached to a given page.newFromArchiveRow( $row, $overrides = array() )
- make a fake revision object from an archive table row.newFromId( $id, $flags = 0 )
- load a page revision from a given revision ID number.newFromPageId( $pageId, $revId = 0, $flags = 0 )
- load either the current, or a specified, revision that's attached to a given page ID.newFromRow( $row )
newFromTitle( $title, $id = 0, $flags = 0 )
- load either the current, or a specified, revision that's attached to a given title.newNullRevision( $dbw, $pageId, $summary, $minor )
- create a new null-revision for insertion into a page's history.
Methods
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, null will be returned.<translate> (deprecated in <tvar name=2>1.21</tvar>)</translate> see Manual:ContentHandler.php#Migration .getText( $audience = Revision::FOR_PUBLIC, User $user = null )
base36Sha1( $text )
This is simply wfBaseConvert( sha1( $text ), 16, 36, 31 )
Accessors
getRecentChange()
- get the RC object belonging to the current revision, if there's one.getNext()
- get next revision for this title.getPrevious()
- get previous revision for this title.getTitle()
- returns the title of the page associated with this entry or null.
Audiences
One of:
Revision::FOR_PUBLIC
- to be displayed to all usersRevision::FOR_THIS_USER
- to be displayed to $wgUserRevision::RAW
- get the text regardless of permissions