MediaWiki REL1_32
|
Public Member Functions | |
__construct ( $row, $queryFlags=0, Title $title=null) | |
getComment ( $audience=self::FOR_PUBLIC, User $user=null) | |
Fetch revision comment if it's available to the specified audience. | |
getContent ( $audience=self::FOR_PUBLIC, User $user=null) | |
Fetch revision content if it's available to the specified audience. | |
getContentFormat () | |
Returns the content format for the main slot of this revision. | |
getContentHandler () | |
Returns the content handler appropriate for this revision's content model. | |
getContentModel () | |
Returns the content model for the main slot of this revision. | |
getId () | |
Get revision ID. | |
getNext () | |
Get next revision for this title. | |
getPage () | |
Get the page ID. | |
getParentId () | |
Get parent revision ID (the original previous page revision) | |
getPrevious () | |
Get previous revision for this title. | |
getRecentChange ( $flags=0) | |
Get the RC object belonging to the current revision, if there's one. | |
getRevisionRecord () | |
getSerializedData () | |
Get original serialized data (without checking view restrictions) | |
getSha1 () | |
Returns the base36 sha1 of the content in this revision, or null if unknown. | |
getSize () | |
Returns the length of the text in this revision, or null if unknown. | |
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. | |
getTimestamp () | |
getTitle () | |
Returns the title of the page associated with this entry. | |
getUser ( $audience=self::FOR_PUBLIC, User $user=null) | |
Fetch revision's user id if it's available to the specified audience. | |
getUserText ( $audience=self::FOR_PUBLIC, User $user=null) | |
Fetch revision's username if it's available to the specified audience. | |
getVisibility () | |
Get the deletion bitfield of the revision. | |
insertOn ( $dbw) | |
Insert a new revision into the database, returning the new revision ID number on success and dies horribly on failure. | |
isCurrent () | |
isDeleted ( $field) | |
isMinor () | |
isUnpatrolled () | |
setId ( $id) | |
Set the revision ID. | |
setTitle ( $title) | |
Set the title of the revision. | |
setUserIdAndName ( $id, $name) | |
Set the user ID/name. | |
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. | |
Static Public Member Functions | |
static | base36Sha1 ( $text) |
Get the base 36 SHA-1 value for a string of text. | |
static | compressRevisionText (&$text) |
If $wgCompressRevisions is enabled, we will compress data. | |
static | countByPageId ( $db, $id) |
Get count of revisions per page...not very efficient. | |
static | countByTitle ( $db, $title) |
Get count of revisions per page...not very efficient. | |
static | decompressRevisionText ( $text, $flags) |
Re-converts revision text according to it's flags. | |
static | fetchRevision (LinkTarget $title) |
Return a wrapper for a series of database rows to fetch all of a given page's revisions in turn. | |
static | getArchiveQueryInfo () |
Return the tables, fields, and join conditions to be selected to create a new archived revision object. | |
static | getParentLengths ( $db, array $revIds) |
Do a batched query to get the parent revision lengths. | |
static | getQueryInfo ( $options=[]) |
Return the tables, fields, and join conditions to be selected to create a new revision object. | |
static | getRevisionText ( $row, $prefix='old_', $wiki=false) |
Get revision text associated with an old or archive row. | |
static | getTimestampFromId ( $title, $id, $flags=0) |
Get rev_timestamp from rev_id, without loading the rest of the row. | |
static | loadFromId ( $db, $id) |
Load a page revision from a given revision ID number. | |
static | loadFromPageId ( $db, $pageid, $id=0) |
Load either the current, or a specified, revision that's attached to a given page. | |
static | loadFromTimestamp ( $db, $title, $timestamp) |
Load the revision for the given title with the given timestamp. | |
static | loadFromTitle ( $db, $title, $id=0) |
Load either the current, or a specified, revision that's attached to a given page. | |
static | newFromArchiveRow ( $row, $overrides=[]) |
Make a fake revision object from an archive table row. | |
static | newFromId ( $id, $flags=0) |
Load a page revision from a given revision ID number. | |
static | newFromPageId ( $pageId, $revId=0, $flags=0) |
Load either the current, or a specified, revision that's attached to a given page ID. | |
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. | |
static | newKnownCurrent (IDatabase $db, $pageIdOrTitle, $revId=0) |
Load a revision based on a known page ID and current revision ID from the DB. | |
static | newNullRevision ( $dbw, $pageId, $summary, $minor, $user=null) |
Create a new null-revision for insertion into a page's history. | |
static | pageJoinCond () |
Return the value of a select() page conds array for the page table. | |
static | selectArchiveFields () |
Return the list of revision fields that should be selected to create a new revision from an archive row. | |
static | selectFields () |
Return the list of revision fields that should be selected to create a new revision. | |
static | selectPageFields () |
Return the list of page fields that should be selected from page table. | |
static | selectTextFields () |
Return the list of text fields that should be selected to read the revision text. | |
static | selectUserFields () |
Return the list of user fields that should be selected from user table. | |
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. | |
static | userJoinCond () |
Return the value of a select() JOIN conds array for the user table. | |
static | userWasLastToEdit ( $db, $pageId, $userId, $since) |
Check if no edits were made by other users since the time a user started editing the page. | |
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) | |
const | READ_NONE = -1 |
Static Protected Member Functions | |
static | getBlobStore ( $wiki=false) |
static | getRevisionFactory () |
static | getRevisionLookup () |
static | getRevisionStore () |
Protected Attributes | |
RevisionRecord | $mRecord |
Private Member Functions | |
ensureTitle ( $row, $queryFlags, $title=null) | |
Make sure we have some Title object for use by the constructor. | |
getMainSlotRaw () | |
Definition at line 41 of file Revision.php.
Revision::__construct | ( | $row, | |
$queryFlags = 0, | |||
Title | $title = null ) |
object | array | RevisionRecord | $row | Either a database row or an array |
int | $queryFlags | |
Title | null | $title |
Definition at line 559 of file Revision.php.
References ensureTitle(), and getRevisionFactory().
|
static |
Get the base 36 SHA-1 value for a string of text.
string | $text |
Definition at line 1151 of file Revision.php.
Referenced by RevisionDbTestBase\provideGetSha1(), PopulateRevisionSha1\upgradeLegacyArchiveRow(), and PopulateRevisionSha1\upgradeRow().
|
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.
mixed | &$text | Reference to a text |
Definition at line 1094 of file Revision.php.
References getBlobStore().
Referenced by MigrateArchiveText\doDBUpdates(), CheckStorage\importRevision(), RevisionTest\testCompressRevisionTextUtf8(), and RevisionTest\testCompressRevisionTextUtf8Gzip().
|
static |
Get count of revisions per page...not very efficient.
IDatabase | $db | |
int | $id | Page id |
Definition at line 1247 of file Revision.php.
References getRevisionStore().
|
static |
Get count of revisions per page...not very efficient.
IDatabase | $db | |
Title | $title |
Definition at line 1258 of file Revision.php.
References getRevisionStore().
|
static |
Re-converts revision text according to it's flags.
mixed | $text | Reference to a text |
array | $flags | Compression flags |
Definition at line 1105 of file Revision.php.
References getBlobStore().
Referenced by RevisionTest\testDecompressRevisionText().
|
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.
array | object | $row | |
int | $queryFlags | |
Title | null | $title |
Definition at line 599 of file Revision.php.
References $title, getRevisionStore(), NS_SPECIAL, and wfLogWarning().
Referenced by __construct().
|
static |
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.
LinkTarget | $title |
Definition at line 305 of file Revision.php.
References wfDeprecated().
Referenced by RevisionDbTestBase\testFetchRevision().
|
static |
Return the tables, fields, and join conditions to be selected to create a new archived revision object.
Definition at line 535 of file Revision.php.
References getRevisionStore().
Referenced by DifferenceEngine\deletedLink(), PopulateRevisionLength\doDBUpdates(), PopulateRevisionSha1\doDBUpdates(), RevDelArchiveList\doQuery(), RevDelRevisionList\doQuery(), PopulateRevisionSha1\doSha1LegacyUpdates(), RevisionDbTestBase\testNewFromArchiveRow(), RevisionDbTestBase\testNewFromArchiveRowOverrides(), MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionGetArchiveQueryInfo(), and PageArchiveTestBase\testUndeleteRevisions().
|
staticprotected |
bool | string | $wiki | The ID of the target wiki database. Use false for the local wiki. |
Definition at line 87 of file Revision.php.
Referenced by compressRevisionText(), decompressRevisionText(), getRevisionText(), and getTextId().
Revision::getComment | ( | $audience = self::FOR_PUBLIC, | |
User | $user = null ) |
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.
int | $audience | One 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 | $user | User object to check for, only if FOR_THIS_USER is passed to the $audience parameter |
Definition at line 854 of file Revision.php.
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.
int | $audience | One 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 | $user | User object to check for, only if FOR_THIS_USER is passed to the $audience parameter |
Definition at line 924 of file Revision.php.
References $e.
Referenced by BenchmarkParse\runParser().
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.
Definition at line 979 of file Revision.php.
References getContentHandler(), and getMainSlotRaw().
Referenced by RevisionDbTestBase\assertRevEquals().
Revision::getContentHandler | ( | ) |
Returns the content handler appropriate for this revision's content model.
MWException |
Definition at line 996 of file Revision.php.
References getContentModel().
Referenced by getContentFormat(), and WikiPage\getUndoContent().
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.
Definition at line 964 of file Revision.php.
References getMainSlotRaw().
Referenced by RevisionDbTestBase\assertRevEquals(), and getContentHandler().
Revision::getId | ( | ) |
Get revision ID.
Definition at line 646 of file Revision.php.
Referenced by RevisionDbTestBase\assertRevEquals(), CategoryMembershipChange\notifyCategorization(), and BenchmarkParse\runParser().
|
private |
Definition at line 696 of file Revision.php.
Referenced by getContentFormat(), getContentModel(), getSerializedData(), and getTextId().
Revision::getNext | ( | ) |
Get next revision for this title.
Definition at line 1030 of file Revision.php.
References getRevisionLookup(), and getTitle().
Revision::getPage | ( | ) |
Get the page ID.
Definition at line 790 of file Revision.php.
Referenced by RevisionDbTestBase\assertRevEquals().
Revision::getParentId | ( | ) |
Get parent revision ID (the original previous page revision)
Definition at line 725 of file Revision.php.
|
static |
Do a batched query to get the parent revision lengths.
IDatabase | $db | |
array | $revIds |
Definition at line 548 of file Revision.php.
References getRevisionStore().
Referenced by HistoryPager\doBatchLookups(), ContribsPager\doBatchLookups(), RevisionDbTestBase\testGetParentLengths_multipleRevIds(), RevisionDbTestBase\testGetParentLengths_noRevIds(), and RevisionDbTestBase\testGetParentLengths_oneRevId().
Revision::getPrevious | ( | ) |
Get previous revision for this title.
Definition at line 1019 of file Revision.php.
References getRevisionLookup(), and getTitle().
|
static |
Return the tables, fields, and join conditions to be selected to create a new revision object.
array | $options | Any combination of the following strings
|
Definition at line 521 of file Revision.php.
References $options, and getRevisionStore().
Referenced by WikiPage\archiveRevisions(), WikiExporter\do_list_authors(), PopulateRevisionLength\doDBUpdates(), PopulateRevisionSha1\doDBUpdates(), ChangeTagsRevisionList\doQuery(), RevDelRevisionList\doQuery(), RevisionList\doQuery(), WikiExporter\dumpPages(), HistoryAction\fetchRevisions(), BaseBlacklist\getArticleText(), Title\getAuthorsBetween(), ContentHandler\getAutoDeleteReason(), Title\getFirstRevision(), HistoryPager\getQueryInfo(), ContribsPager\getQueryInfo(), MergeHistoryPager\getQueryInfo(), Linker\getRollbackEditCount(), RebuildTextIndex\populateSearchIndex(), CategoryMembershipChangeJob\run(), RevisionDbTestBase\testNewFromRow(), MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionGetQueryInfo(), PageArchiveTestBase\testUndeleteRevisions(), ImportTest\testUnknownUserHandling(), and RevisionDbTestBase\testUserWasLastToEdit().
Revision::getRecentChange | ( | $flags = 0 | ) |
Get the RC object belonging to the current revision, if there's one.
int | $flags | (optional) $flags include: Revision::READ_LATEST : Select the data from the master |
Definition at line 888 of file Revision.php.
References getRevisionStore().
|
staticprotected |
Definition at line 78 of file Revision.php.
Referenced by __construct(), newFromArchiveRow(), and newFromRow().
|
staticprotected |
Definition at line 71 of file Revision.php.
Referenced by getNext(), getPrevious(), newFromId(), newFromPageId(), newFromTitle(), and newKnownCurrent().
Revision::getRevisionRecord | ( | ) |
Definition at line 637 of file Revision.php.
References $mRecord.
Referenced by WikiPage\doEditUpdates().
|
staticprotected |
Definition at line 64 of file Revision.php.
Referenced by countByPageId(), countByTitle(), ensureTitle(), getArchiveQueryInfo(), getParentLengths(), getQueryInfo(), getRecentChange(), getTimestampFromId(), insertOn(), isUnpatrolled(), loadFromId(), loadFromPageId(), loadFromTimestamp(), loadFromTitle(), newNullRevision(), and userWasLastToEdit().
|
static |
Get revision text associated with an old or archive row.
Both the flags and the text field must be included. Including the old_id field will activate cache usage as long as the $wiki parameter is not set.
stdClass | $row | The text data |
string | $prefix | Table prefix (default 'old_') |
string | bool | $wiki | The 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. |
Definition at line 1050 of file Revision.php.
References getBlobStore(), and wfLogWarning().
Referenced by CompressOld\compressWithConcat(), MigrateArchiveText\doDBUpdates(), FetchText\doGetText(), RecompressTracked\doOrphanList(), RecompressTracked\doPage(), ApiQueryDeletedrevs\execute(), TextPassDumper\getTextDb(), MessageCache\loadFromDB(), RevisionTest\testCompressRevisionTextUtf8(), RevisionTest\testCompressRevisionTextUtf8Gzip(), RevisionTest\testGetRevisionText(), RevisionTest\testGetRevisionText_external_noOldId(), RevisionTest\testGetRevisionText_external_oldId(), RevisionTest\testGetRevisionText_external_returnsFalseWhenNotEnoughUrlParts(), RevisionTest\testGetRevisionText_returnsDecompressedTextFieldWhenNotExternal(), RevisionTest\testGetRevisionText_returnsFalseWhenNoTextField(), RevisionTest\testGetRevisionWithZlibExtension_badData(), and XmlDumpWriter\writeRevision().
Revision::getSerializedData | ( | ) |
Get original serialized data (without checking view restrictions)
Definition at line 947 of file Revision.php.
References getMainSlotRaw().
Revision::getSha1 | ( | ) |
Returns the base36 sha1 of the content in this revision, or null if unknown.
Definition at line 747 of file Revision.php.
Referenced by RevisionDbTestBase\assertRevEquals().
Revision::getSize | ( | ) |
Returns the length of the text in this revision, or null if unknown.
Definition at line 734 of file Revision.php.
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.
Definition at line 712 of file Revision.php.
References getBlobStore(), and getMainSlotRaw().
Revision::getTimestamp | ( | ) |
Definition at line 1003 of file Revision.php.
Referenced by CategoryMembershipChange\__construct(), RevisionDbTestBase\assertRevEquals(), and WikiPage\setLastEdit().
|
static |
Get rev_timestamp from rev_id, without loading the rest of the row.
Title | $title | |
int | $id | |
int | $flags |
Definition at line 1236 of file Revision.php.
References getRevisionStore().
Referenced by Skin\lastModified().
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.
Definition at line 763 of file Revision.php.
Referenced by MediaWiki\Tests\Revision\RevisionStoreDbTestBase\assertRevisionRecordMatchesRevision(), getNext(), getPrevious(), and BenchmarkParse\runParser().
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.
int | $audience | One 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 | $user | User object to check for, only if FOR_THIS_USER is passed to the $audience parameter |
Definition at line 807 of file Revision.php.
Referenced by RevisionDbTestBase\assertRevEquals().
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.
int | $audience | One 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 | $user | User object to check for, only if FOR_THIS_USER is passed to the $audience parameter |
Definition at line 831 of file Revision.php.
Revision::getVisibility | ( | ) |
Get the deletion bitfield of the revision.
Definition at line 906 of file Revision.php.
Referenced by CategoryMembershipChange\notifyCategorization(), and userCan().
Revision::insertOn | ( | $dbw | ) |
Insert a new revision into the database, returning the new revision ID number on success and dies horribly on failure.
IDatabase | $dbw | (master connection) |
MWException |
Definition at line 1122 of file Revision.php.
References getRevisionStore().
Revision::isCurrent | ( | ) |
Definition at line 1010 of file Revision.php.
Referenced by DifferenceEngine\getRevisionHeader().
Revision::isDeleted | ( | $field | ) |
int | $field | One of DELETED_* bitfield constants |
Definition at line 897 of file Revision.php.
Revision::isMinor | ( | ) |
Definition at line 868 of file Revision.php.
Revision::isUnpatrolled | ( | ) |
Definition at line 875 of file Revision.php.
References getRevisionStore().
|
static |
Load a page revision from a given revision ID number.
Returns null if no such revision can be found.
IDatabase | $db | |
int | $id |
Definition at line 238 of file Revision.php.
References getRevisionStore(), and wfDeprecated().
Referenced by RevisionDbTestBase\testLoadFromId().
|
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.
IDatabase | $db | |
int | $pageid | |
int | $id |
Definition at line 256 of file Revision.php.
References getRevisionStore().
Referenced by Cleanup\execute(), RevisionDbTestBase\testLoadFromPageId(), RevisionDbTestBase\testLoadFromPageIdWithLatestRevId(), RevisionDbTestBase\testLoadFromPageIdWithNotLatestRevId(), and Maintenance\updateSearchIndexForPage().
|
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.
IDatabase | $db | |
Title | $title | |
string | $timestamp |
Definition at line 291 of file Revision.php.
References getRevisionStore().
Referenced by AttachLatest\execute(), EditPage\getBaseRevision(), User\getNewMessageLinks(), WikiPage\replaceSectionContent(), and RevisionDbTestBase\testLoadFromTimestamp().
|
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.
IDatabase | $db | |
Title | $title | |
int | $id |
Definition at line 273 of file Revision.php.
References getRevisionStore().
Referenced by EditPage\mergeChangesIntoContent(), RevisionDbTestBase\testLoadFromTitle(), RevisionTest\testLoadFromTitle(), RevisionDbTestBase\testLoadFromTitleWithLatestRevId(), and RevisionDbTestBase\testLoadFromTitleWithNotLatestRevId().
|
static |
Make a fake revision object from an archive table row.
This is queried for permissions or even inserted (as in Special:Undelete)
object | $row | |
array | $overrides |
MWException |
Definition at line 167 of file Revision.php.
References getRevisionFactory().
Referenced by DifferenceEngine\deletedLink(), SpecialUndelete\formatRevisionRow(), DeletedContribsPager\formatRow(), RevDelArchiveItem\initRevision(), RevisionDbTestBase\testNewFromArchiveRow(), RevisionDbTestBase\testNewFromArchiveRowOverrides(), PopulateRevisionSha1\upgradeLegacyArchiveRow(), PopulateRevisionLength\upgradeRow(), and PopulateRevisionSha1\upgradeRow().
|
static |
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
int | $id | |
int | $flags | (optional) |
Definition at line 114 of file Revision.php.
References getRevisionLookup().
Referenced by SpecialComparePages\checkExistingRevision(), Orphans\checkSeparation(), User\clearNotification(), EditPage\edit(), ApiEditPage\execute(), ApiParse\execute(), BenchmarkParse\execute(), CheckBadRedirects\execute(), ImportTextFiles\execute(), SpecialNewpages\feedItemDesc(), Article\fetchRevisionRecord(), FeedUtils\formatDiffRow(), EditPage\getBaseRevision(), EditPage\getContentObject(), Article\getOldIDFromRequest(), CategoryMembershipChange\getPreviousRevisionTimestamp(), Parser\getRevisionObject(), DifferenceEngine\loadRevisionData(), CategoryMembershipChangeJob\notifyUpdatesForRevision(), MediaWiki\parseTitle(), WikiPage\replaceSectionAtRev(), MediaWikiTestCase\revisionDelete(), Article\setOldSubtitle(), SpecialComparePages\showDiff(), Parser\statelessFetchTemplate(), RevDelRevisionList\suggestTarget(), CategoryMembershipChangeTest\testChangeAddedWithRev(), CategoryMembershipChangeTest\testChangeRemovedWithRev(), RevisionDbTestBase\testGetPage(), ApiRevisionDeleteTest\testHidingRevisions(), RevisionDbTestBase\testIsCurrent(), RevisionDbTestBase\testNewFromId(), and ChangeTags\updateTagsWithChecks().
|
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
int | $pageId | |
int | $revId | (optional) |
int | $flags | Bitfield (optional) |
Definition at line 152 of file Revision.php.
References getRevisionLookup().
Referenced by NamespaceDupes\canMerge(), ApiStashEdit\execute(), WikiPage\loadLastEdit(), RevisionDbTestBase\testNewFromPageId(), RevisionDbTestBase\testNewFromPageIdWithLatestId(), and RevisionDbTestBase\testNewFromPageIdWithNotLatestId().
|
static |
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.
object | array | $row |
Definition at line 218 of file Revision.php.
References getRevisionFactory().
Referenced by BaseBlacklist\getArticleText(), CategoryMembershipChangeJob\run(), and RevisionDbTestBase\testNewFromRow().
|
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.
$flags include: Revision::READ_LATEST : Select the data from the master Revision::READ_LOCKING : Select & lock the data from the master
LinkTarget | $linkTarget | |
int | $id | (optional) |
int | $flags | Bitfield (optional) |
Definition at line 133 of file Revision.php.
References getRevisionLookup().
Referenced by ApiMoveTest\assertMoved(), NamespaceDupes\canMerge(), CleanupSpam\cleanupArticle(), Title\countRevisionsBetween(), ApiEditPage\execute(), BenchmarkParse\execute(), GetTextMaint\execute(), MediaWikiGadgetsDefinitionRepo\fetchStructuredList(), Title\getAuthorsBetween(), ContentHandler\getAutoDeleteReason(), GadgetDefinitionNamespaceRepo\getGadget(), Skin\getNewtalks(), RawAction\getRawText(), FixDefaultJsonContentPages\handleRow(), SearchResult\initFromTitle(), InfoAction\invalidateCache(), Title\isValidMoveTarget(), MovePage\isValidMoveTarget(), DifferenceEngine\loadRevisionData(), SimpleCaptcha\loadText(), LanguageConverter\parseCachedTable(), DoubleRedirectJob\run(), SpecialCiteThisPage\showCitations(), SpecialBookSources\showList(), Parser\statelessFetchTemplate(), ApiQueryRecentChangesIntegrationTest\testCategorizeTypeParameter(), ApiQueryWatchlistIntegrationTest\testCategorizeTypeParameter(), RevisionDbTestBase\testNewFromTitle_withBadId(), RevisionDbTestBase\testNewFromTitle_withId(), RevisionDbTestBase\testNewFromTitle_withoutId(), and SpecialChangeContentModel\validateTitle().
|
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.
IDatabase | $db | ignored! |
int | Title | $pageIdOrTitle | Page ID or Title object |
int | $revId | Known current revision of this page. Determined automatically if not given. |
Definition at line 1299 of file Revision.php.
References getRevisionLookup().
Referenced by ResourceLoaderWikiModule\getContentObj(), MessageCache\loadCachedMessagePageEntry(), WikiPage\loadLastEdit(), Parser\statelessFetchRevision(), RevisionDbTestBase\testNewKnownCurrent(), RevisionDbTestBase\testNewKnownCurrent_returnsFalseWhenTitleDoesntExist(), and RevisionDbTestBase\testNewKnownCurrent_withPageId().
|
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.
IDatabase | $dbw | |
int | $pageId | ID number of the page to read from |
string | $summary | Revision's summary |
bool | $minor | Whether the revision should be considered as minor |
User | null | $user | User object to use or null for $wgUser |
Definition at line 1170 of file Revision.php.
References getRevisionStore().
Referenced by WikiPage\insertProtectNullRevision(), MovePage\moveToInternal(), LocalFile\recordUpload2(), ImportReporter\reportPage(), RevisionDbTestBase\testNewNullRevision(), and RevisionDbTestBase\testNewNullRevision_badPage().
|
static |
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.
Definition at line 341 of file Revision.php.
References wfDeprecated().
Referenced by MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionPageJoinCond().
|
static |
Return the list of revision fields that should be selected to create a new revision from an archive row.
Definition at line 412 of file Revision.php.
References $wgActorTableSchemaMigrationStage, $wgContentHandlerUseDB, $wgMultiContentRevisionSchemaMigrationStage, SCHEMA_COMPAT_READ_NEW, SCHEMA_COMPAT_WRITE_OLD, and wfDeprecated().
Referenced by MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionSelectArchiveFields().
|
static |
Return the list of revision fields that should be selected to create a new revision.
Definition at line 352 of file Revision.php.
References $wgActorTableSchemaMigrationStage, $wgContentHandlerUseDB, $wgMultiContentRevisionSchemaMigrationStage, SCHEMA_COMPAT_READ_NEW, SCHEMA_COMPAT_WRITE_OLD, and wfDeprecated().
Referenced by BaseBlacklist\getArticleText(), and MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionSelectFields().
|
static |
Return the list of page fields that should be selected from page table.
Definition at line 485 of file Revision.php.
References wfDeprecated().
Referenced by BaseBlacklist\getArticleText(), and MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionSelectPageFields().
|
static |
Return the list of text fields that should be selected to read the revision text.
Definition at line 472 of file Revision.php.
References wfDeprecated().
Referenced by BaseBlacklist\getArticleText(), and MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionSelectTextFields().
|
static |
Return the list of user fields that should be selected from user table.
Definition at line 502 of file Revision.php.
References wfDeprecated().
Referenced by MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionSelectUserFields().
Revision::setId | ( | $id | ) |
Set the revision ID.
This should only be used for proposed revisions that turn out to be null edits.
int | string | $id |
MWException |
Definition at line 662 of file Revision.php.
Revision::setTitle | ( | $title | ) |
Set the title of the revision.
Title | $title |
Definition at line 775 of file Revision.php.
Revision::setUserIdAndName | ( | $id, | |
$name ) |
Set the user ID/name.
This should only be used for proposed revisions that turn out to be null edits
MWException |
Definition at line 684 of file Revision.php.
References User\newFromAnyId().
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.
int | $field | One of self::DELETED_TEXT, self::DELETED_COMMENT, self::DELETED_USER |
User | null | $user | User object to check, or null to use $wgUser |
Definition at line 1198 of file Revision.php.
References getVisibility(), and userCanBitfield().
|
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.
int | $bitfield | Current field |
int | $field | One of self::DELETED_TEXT = File::DELETED_FILE, self::DELETED_COMMENT = File::DELETED_COMMENT, self::DELETED_USER = File::DELETED_USER |
User | null | $user | User object to check, or null to use $wgUser |
Title | null | $title | A Title object to check for per-page restrictions on, instead of just plain userrights |
Definition at line 1216 of file Revision.php.
Referenced by ApiQueryDeletedrevs\execute(), RevisionDbTestBase\testUserCanBitfield(), ArchivedFile\userCan(), OldLocalFile\userCan(), userCan(), and ChangesList\userCan().
|
static |
Return the value of a select() JOIN conds array for the user table.
This will get user table rows for logged-in users.
Definition at line 317 of file Revision.php.
References $wgActorTableSchemaMigrationStage, SCHEMA_COMPAT_READ_NEW, and wfDeprecated().
Referenced by MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionUserJoinCond().
|
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.
IDatabase | int | $db | The Database to perform the check on. May be given as a Database object or a database identifier usable with wfGetDB. |
int | $pageId | The ID of the page in question |
int | $userId | The ID of the user in question |
string | $since | Look at edits since this time |
Definition at line 1278 of file Revision.php.
References getRevisionStore(), and wfGetDB().
Referenced by EditPage\internalAttemptSave(), and RevisionDbTestBase\testUserWasLastToEdit().
|
protected |
Definition at line 44 of file Revision.php.
Referenced by getRevisionRecord().
const Revision::DELETED_COMMENT = RevisionRecord::DELETED_COMMENT |
Definition at line 48 of file Revision.php.
Referenced by ApiComparePagesTest\addDBDataOnce(), SpecialRevisionDelete\execute(), ApiQueryDeletedrevs\execute(), FeedUtils\formatDiff(), RevDelArchivedFileItem\getApiData(), RevDelFileItem\getApiData(), RevDelRevisionItem\getApiData(), RevisionDeleter\getChanges(), DeleteLogFormatter\getParametersForApi(), ChangesList\insertComment(), RevisionDbTestBase\provideUserCan(), RevisionDbTestBase\provideUserCanBitfield(), Linker\revComment(), RevisionDbTestBase\testIsDeleted_nothingDeleted(), and XmlDumpWriter\writeRevision().
const Revision::DELETED_RESTRICTED = RevisionRecord::DELETED_RESTRICTED |
Definition at line 50 of file Revision.php.
Referenced by ApiComparePagesTest\addDBDataOnce(), ApiParseTest\addDBDataOnce(), SpecialRevisionDelete\buildCheckBoxes(), RevDelLogItem\canView(), RevDelRevisionItem\canView(), RevisionItem\canView(), SpecialRevisionDelete\execute(), ApiQueryDeletedrevs\execute(), SpecialRevisionDelete\extractBitParams(), RevisionDeleter\getChanges(), DeleteLogFormatter\getParametersForApi(), ApiParse\getParsedContent(), Linker\getRevDeleteLink(), RevDelLogList\getSuppressBit(), RevDelRevisionList\getSuppressBit(), WatchedItemQueryService\getUserRelatedConds(), HistoryPager\historyLine(), RevisionDbTestBase\provideUserCan(), RevisionDbTestBase\provideUserCanBitfield(), RevisionDeleteUser\setUsernameBitfields(), RevDelList\setVisibility(), Article\showDeletedRevisionHeader(), DifferenceEngine\showDiffPage(), SpecialUndelete\showRevision(), SpecialRevisionDelete\submit(), RevisionDbTestBase\testIsDeleted_nothingDeleted(), and WatchedItemQueryServiceUnitTest\userPermissionRelatedExtraChecksProvider().
const Revision::DELETED_TEXT = RevisionRecord::DELETED_TEXT |
Definition at line 47 of file Revision.php.
Referenced by ApiComparePagesTest\addDBDataOnce(), ApiParseTest\addDBDataOnce(), RevDelRevisionItem\canViewContent(), RevisionItem\canViewContent(), CleanupSpam\cleanupArticle(), HistoryPager\curLink(), HistoryPager\diffButtons(), ApiEditPage\execute(), ApiParse\execute(), ApiQueryDeletedrevs\execute(), Article\fetchRevisionRecord(), DeletedContribsPager\formatRevisionRow(), SpecialMergeHistory\formatRevisionRow(), SpecialUndelete\formatRevisionRow(), ContribsPager\formatRow(), RevDelRevisionItem\getApiData(), ChangesList\getArticleLink(), RevisionDeleter\getChanges(), EditPage\getContentObject(), DifferenceEngine\getDiffBody(), EnhancedChangesList\getLineData(), EnhancedChangesList\getLogText(), SpecialUndelete\getPageLink(), DeleteLogFormatter\getParametersForApi(), ApiParse\getParsedContent(), RevDelRevisionList\getRevdelConstant(), DifferenceEngine\getRevisionHeader(), Linker\getRollbackEditCount(), HistoryPager\historyLine(), ChangesList\insertDiffHist(), RevDelRevisionItem\isDeleted(), RevisionItem\isDeleted(), RevDelRevisionItem\isHideCurrentOp(), HistoryPager\lastLink(), RevisionTest\provideConstructFromRow(), RevisionDbTestBase\provideUserCan(), RevisionDbTestBase\provideUserCanBitfield(), HistoryPager\revLink(), Article\showDeletedRevisionHeader(), RCCacheEntryFactory\showDiffLinks(), DifferenceEngine\showDiffPage(), EditPage\showHeader(), SpecialUndelete\showRevision(), RevisionDbTestBase\testIsDeleted_nothingDeleted(), ApiEditPageTest\testUndoAfterToHiddenRev(), and XmlDumpWriter\writeRevision().
const Revision::DELETED_USER = RevisionRecord::DELETED_USER |
Definition at line 49 of file Revision.php.
Referenced by ApiComparePagesTest\addDBDataOnce(), ChangesFeed\buildItems(), WikiExporter\do_list_authors(), SpecialRevisionDelete\execute(), ApiQueryDeletedrevs\execute(), DeletedContribsPager\formatRevisionRow(), ContribsPager\formatRow(), RevDelArchivedFileItem\getApiData(), RevDelFileItem\getApiData(), RevDelRevisionItem\getApiData(), ContentHandler\getAutoDeleteReason(), RevisionDeleter\getChanges(), DeleteLogFormatter\getParametersForApi(), ContribsPager\getQueryInfo(), DeletedContribsPager\getQueryInfo(), Linker\getRollbackEditCount(), RCCacheEntryFactory\getUserLink(), WatchedItemQueryService\getUserRelatedConds(), RevDelFileItem\getUserTools(), ChangesList\insertUserRelatedLinks(), RCCacheEntryFactory\newFromRecentChange(), RevisionDbTestBase\provideUserCan(), RevisionDbTestBase\provideUserCanBitfield(), Linker\revUserLink(), Linker\revUserTools(), RevisionDeleteUser\setUsernameBitfields(), RevisionDbTestBase\testIsDeleted_nothingDeleted(), WatchedItemQueryServiceUnitTest\userPermissionRelatedExtraChecksProvider(), and XmlDumpWriter\writeRevision().
const Revision::FOR_PUBLIC = RevisionRecord::FOR_PUBLIC |
Definition at line 55 of file Revision.php.
Referenced by GetTextMaint\execute(), RevisionDbTestBase\provideGetContent(), WikiPageDbTestBase\testDoDeleteArticleReal_suppress(), and ApiRevisionDeleteTest\testHidingRevisions().
const Revision::FOR_THIS_USER = RevisionRecord::FOR_THIS_USER |
Definition at line 56 of file Revision.php.
Referenced by ApiEditPage\execute(), Article\fetchRevisionRecord(), RevDelRevisionItem\getApiData(), EditPage\getOriginalContent(), ApiParse\getParsedContent(), DifferenceEngine\loadNewText(), DifferenceEngine\loadText(), RollbackAction\onView(), InfoAction\pageInfo(), Linker\revComment(), Linker\revUserLink(), Linker\revUserTools(), SpecialUndelete\showDiff(), and WikiPageDbTestBase\testDoDeleteArticleReal_suppress().
const Revision::RAW = RevisionRecord::RAW |
Definition at line 57 of file Revision.php.
Referenced by ParserTestRunner\addArticle(), CategoryMembershipChangeTest\addDBDataOnce(), CleanupSpam\cleanupArticle(), WikiPage\doDeleteArticleBatched(), GetTextMaint\execute(), ViewCLI\execute(), RefreshLinks\fixRedirect(), Title\getAuthorsBetween(), ResourceLoaderWikiModule\getContentObj(), EditPage\getContentObject(), EditPage\getCurrentContent(), WikiPage\getDeletionUpdates(), DifferenceEngine\getMultiNotice(), EditPage\getPreloadedContent(), Linker\getRollbackEditCount(), CategoryMembershipChange\getUser(), FixDefaultJsonContentPages\handleRow(), CheckStorage\importRevision(), LanguageConverter\parseCachedTable(), PreprocessDump\processRevision(), Linker\revComment(), ApiEditPageTest\testEditNewSection(), ApiEditPageTest\testEditSection(), RevisionDbTestBase\testGetContentClone(), RevisionDbTestBase\testGetContentUncloned(), RevisionTest\testSetUserIdAndName(), and PopulateRevisionLength\upgradeRow().
const Revision::SUPPRESSED_ALL = RevisionRecord::SUPPRESSED_ALL |
Definition at line 52 of file Revision.php.
Referenced by WikiPage\archiveRevisions(), ChangeTagsLogItem\canView(), and LocalFileDeleteBatch\doDBInserts().
const Revision::SUPPRESSED_USER = RevisionRecord::SUPPRESSED_USER |
Definition at line 51 of file Revision.php.
Referenced by ContribsPager\getQueryInfo(), DeletedContribsPager\getQueryInfo(), and CategoryMembershipChange\notifyCategorization().
const Revision::TEXT_CACHE_GROUP = SqlBlobStore::TEXT_CACHE_GROUP |
Definition at line 59 of file Revision.php.