MediaWiki
master
|
Service for looking up page revisions. More...
Public Member Functions | |
__construct (ILoadBalancer $loadBalancer, SqlBlobStore $blobStore, WANObjectCache $cache, CommentStore $commentStore, NameTableStore $contentModelStore, NameTableStore $slotRoleStore, SlotRoleRegistry $slotRoleRegistry, ActorMigration $actorMigration, IContentHandlerFactory $contentHandlerFactory, HookContainer $hookContainer, $dbDomain=false) | |
countAuthorsBetween ( $pageId, RevisionRecord $old=null, RevisionRecord $new=null, User $user=null, $max=null, $options=[]) | |
Get the number of authors between the given revisions. More... | |
countRevisionsBetween ( $pageId, RevisionRecord $old=null, RevisionRecord $new=null, $max=null, $options=[]) | |
Get the number of revisions between the given revisions. More... | |
countRevisionsByPageId (IDatabase $db, $id) | |
Get count of revisions per page...not very efficient. More... | |
countRevisionsByTitle (IDatabase $db, $title) | |
Get count of revisions per page...not very efficient. More... | |
getArchiveQueryInfo () | |
Return the tables, fields, and join conditions to be selected to create a new RevisionArchiveRecord object. More... | |
getAuthorsBetween ( $pageId, RevisionRecord $old=null, RevisionRecord $new=null, User $user=null, $max=null, $options=[]) | |
Get the authors between the given revisions or revisions. More... | |
getContentBlobsForBatch ( $rowsOrIds, $slots=null, $queryFlags=0) | |
Gets raw (serialized) content blobs for the given set of revisions. More... | |
getFirstRevision (LinkTarget $title, int $flags=IDBAccessObject::READ_NORMAL) | |
Get the first revision of a given page. More... | |
getKnownCurrentRevision (Title $title, $revId=0) | |
Load a revision based on a known page ID and current revision ID from the DB. More... | |
getNextRevision (RevisionRecord $rev, $flags=0) | |
Get the revision after $rev in the page's history, if any. More... | |
getPreviousRevision (RevisionRecord $rev, $flags=0) | |
Get the revision before $rev in the page's history, if any. More... | |
getQueryInfo ( $options=[]) | |
Return the tables, fields, and join conditions to be selected to create a new RevisionStoreRecord object. More... | |
getRcIdIfUnpatrolled (RevisionRecord $rev) | |
MCR migration note: this replaces Revision::isUnpatrolled. More... | |
getRecentChange (RevisionRecord $rev, $flags=0) | |
Get the RC object belonging to the current revision, if there's one. More... | |
getRevisionById ( $id, $flags=0) | |
Load a page revision from a given revision ID number. More... | |
getRevisionByPageId ( $pageId, $revId=0, $flags=0) | |
Load either the current, or a specified, revision that's attached to a given page ID. More... | |
getRevisionByTimestamp (LinkTarget $title, string $timestamp, int $flags=IDBAccessObject::READ_NORMAL) | |
Load the revision for the given title with the given timestamp. More... | |
getRevisionByTitle (LinkTarget $linkTarget, $revId=0, $flags=0) | |
Load either the current, or a specified, revision that's attached to a given link target. More... | |
getRevisionIdsBetween (int $pageId, RevisionRecord $old=null, RevisionRecord $new=null, ?int $max=null, $options=[], ?string $order=null, int $flags=IDBAccessObject::READ_NORMAL) | |
Get IDs of revisions between the given revisions. More... | |
getRevisionSizes (array $revIds) | |
Do a batched query for the sizes of a set of revisions. More... | |
getSlotsQueryInfo ( $options=[]) | |
Return the tables, fields, and join conditions to be selected to create a new SlotRecord. More... | |
getTimestampFromId ( $id, $flags=0) | |
Get rev_timestamp from rev_id, without loading the rest of the row. More... | |
getTitle ( $pageId, $revId, $queryFlags=self::READ_NORMAL) | |
Determines the page Title based on the available information. More... | |
insertRevisionOn (RevisionRecord $rev, IDatabase $dbw) | |
Insert a new revision into the database, returning the new revision record on success and dies horribly on failure. More... | |
isReadOnly () | |
listRevisionSizes (IDatabase $db, array $revIds) | |
Do a batched query for the sizes of a set of revisions. More... | |
loadRevisionFromPageId (IDatabase $db, $pageid, $id=0) | |
Load either the current, or a specified, revision that's attached to a given page. More... | |
loadRevisionFromTimestamp (IDatabase $db, $title, $timestamp) | |
Load the revision for the given title with the given timestamp. More... | |
loadRevisionFromTitle (IDatabase $db, $title, $id=0) | |
Load either the current, or a specified, revision that's attached to a given page. More... | |
newMutableRevisionFromArray (array $fields, $queryFlags=0, Title $title=null) | |
Constructs a new MutableRevisionRecord based on the given associative array following the MW1.29 convention for the Revision constructor. More... | |
newNullRevision (IDatabase $dbw, Title $title, CommentStoreComment $comment, $minor, User $user) | |
Create a new null-revision for insertion into a page's history. More... | |
newRevisionFromArchiveRow ( $row, $queryFlags=0, Title $title=null, array $overrides=[]) | |
Make a fake revision object from an archive table row. More... | |
newRevisionFromArchiveRowAndSlots ( $row, $slots, $queryFlags=0, Title $title=null, array $overrides=[]) | |
newRevisionFromRow ( $row, $queryFlags=0, Title $title=null, $fromCache=false) | |
newRevisionFromRowAndSlots ( $row, $slots, $queryFlags=0, Title $title=null, $fromCache=false) | |
newRevisionsFromBatch ( $rows, array $options=[], $queryFlags=0, Title $title=null) | |
Construct a RevisionRecord instance for each row in $rows, and return them as an associative array indexed by revision ID. More... | |
setLogger (LoggerInterface $logger) | |
userWasLastToEdit (IDatabase $db, $pageId, $userId, $since) | |
Check if no edits were made by other users since the time a user started editing the page. More... | |
![]() | |
newRevisionFromRow ( $row, $queryFlags=self::READ_NORMAL, Title $title=null) | |
Constructs a RevisionRecord given a database row and content slots. More... | |
Public Attributes | |
const | INCLUDE_BOTH = 'include_both' |
const | INCLUDE_NEW = 'include_new' |
const | INCLUDE_OLD = 'include_old' |
const | ORDER_NEWEST_TO_OLDEST = 'DESC' |
const | ORDER_OLDEST_TO_NEWEST = 'ASC' |
const | ROW_CACHE_KEY = 'revision-row-1.29' |
![]() | |
const | READ_NONE = -1 |
Constants for object loading bitfield flags (higher => higher QoS) More... | |
Private Member Functions | |
assertRevisionParameter ( $paramName, $pageId, RevisionRecord $rev=null) | |
Asserts that if revision is provided, it's saved and belongs to the page with provided pageId. More... | |
checkContent (Content $content, Title $title, $role) | |
MCR migration note: this corresponds to Revision::checkContentModel. More... | |
checkDatabaseDomain (IDatabase $db) | |
Throws an exception if the given database connection does not belong to the wiki this RevisionStore is bound to. More... | |
constructSlotRecords ( $revId, $slotRows, $queryFlags, Title $title, $slotContents=null) | |
Factory method for SlotRecords based on known slot rows. More... | |
ensureRevisionRowMatchesTitle ( $row, Title $title, $context=[]) | |
Check that the given row matches the given Title object. More... | |
failOnEmpty ( $value, $name) | |
failOnNull ( $value, $name) | |
fetchRevisionRowFromConds (IDatabase $db, array $conditions, int $flags=IDBAccessObject::READ_NORMAL, array $options=[]) | |
Given a set of conditions, return a row with the fields necessary to build RevisionRecord objects. More... | |
getBaseRevisionRow (IDatabase $dbw, RevisionRecord $rev, Title $title, $parentId) | |
getDBConnectionRef ( $mode, $groups=[]) | |
getDBConnectionRefForQueryFlags ( $queryFlags) | |
getDBLoadBalancer () | |
getPreviousRevisionId (IDatabase $db, RevisionRecord $rev) | |
Get previous revision Id for this page_id This is used to populate rev_parent_id on save. More... | |
getRelativeRevision (RevisionRecord $rev, $flags, $dir) | |
Implementation of getPreviousRevision and getNextRevision. More... | |
getRevisionLimitConditions (IDatabase $dbr, RevisionRecord $old=null, RevisionRecord $new=null, $options=[]) | |
Converts revision limits to query conditions. More... | |
getRevisionRowCacheKey (IDatabase $db, $pageId, $revId) | |
Get a cache key for use with a row as selected with getQueryInfo( [ 'page', 'user' ] ) Caching rows without 'page' or 'user' could lead to issues. More... | |
getSlotRowsForBatch ( $rowsOrIds, array $options=[], $queryFlags=0) | |
Gets the slot rows associated with a batch of revisions. More... | |
initializeMutableRevisionFromArray (MutableRevisionRecord $record, array $fields) | |
insertContentRowOn (SlotRecord $slot, IDatabase $dbw, $blobAddress) | |
insertIpChangesRow (IDatabase $dbw, User $user, RevisionRecord $rev, $revisionId) | |
Insert IP revision into ip_changes for use when querying for a range. More... | |
insertRevisionInternal (RevisionRecord $rev, IDatabase $dbw, User $user, CommentStoreComment $comment, Title $title, $pageId, $parentId) | |
insertRevisionRowOn (IDatabase $dbw, RevisionRecord $rev, Title $title, $parentId) | |
insertSlotOn (IDatabase $dbw, $revisionId, SlotRecord $protoSlot, Title $title, array $blobHints=[]) | |
insertSlotRowOn (SlotRecord $slot, IDatabase $dbw, $revisionId, $contentId) | |
loadRevisionFromConds (IDatabase $db, array $conditions, int $flags=IDBAccessObject::READ_NORMAL, Title $title=null, array $options=[]) | |
Given a set of conditions, fetch a revision from the given database connection. More... | |
loadSlotContent (SlotRecord $slot, $blobData=null, $blobFlags=null, $blobFormat=null, $queryFlags=0) | |
Loads a Content object based on a slot row. More... | |
loadSlotRecords ( $revId, $queryFlags, Title $title) | |
newRevisionFromConds (array $conditions, int $flags=IDBAccessObject::READ_NORMAL, Title $title=null, array $options=[]) | |
Given a set of conditions, fetch a revision. More... | |
newRevisionSlots ( $revId, $revisionRow, $slotRows, $queryFlags, Title $title) | |
Factory method for RevisionSlots based on a revision ID. More... | |
storeContentBlob (SlotRecord $slot, Title $title, array $blobHints=[]) | |
Private Attributes | |
ActorMigration | $actorMigration |
SqlBlobStore | $blobStore |
WANObjectCache | $cache |
CommentStore | $commentStore |
IContentHandlerFactory | $contentHandlerFactory |
NameTableStore | $contentModelStore |
bool string | $dbDomain |
HookContainer | $hookContainer |
HookRunner | $hookRunner |
ILoadBalancer | $loadBalancer |
LoggerInterface | $logger |
SlotRoleRegistry | $slotRoleRegistry |
NameTableStore | $slotRoleStore |
Service for looking up page revisions.
Definition at line 79 of file RevisionStore.php.
Revision\RevisionStore::__construct | ( | ILoadBalancer | $loadBalancer, |
SqlBlobStore | $blobStore, | ||
WANObjectCache | $cache, | ||
CommentStore | $commentStore, | ||
NameTableStore | $contentModelStore, | ||
NameTableStore | $slotRoleStore, | ||
SlotRoleRegistry | $slotRoleRegistry, | ||
ActorMigration | $actorMigration, | ||
IContentHandlerFactory | $contentHandlerFactory, | ||
HookContainer | $hookContainer, | ||
$dbDomain = false |
|||
) |
ILoadBalancer | $loadBalancer | |
SqlBlobStore | $blobStore | |
WANObjectCache | $cache | A cache for caching revision rows. This can be the local wiki's default instance even if $dbDomain refers to a different wiki, since makeGlobalKey() is used to constructed a key that allows cached revision rows from the same database to be re-used between wikis. For example, enwiki and frwiki will use the same cache keys for revision rows from the wikidatawiki database, regardless of the cache's default key space. |
CommentStore | $commentStore | |
NameTableStore | $contentModelStore | |
NameTableStore | $slotRoleStore | |
SlotRoleRegistry | $slotRoleRegistry | |
ActorMigration | $actorMigration | |
IContentHandlerFactory | $contentHandlerFactory | |
HookContainer | $hookContainer | |
bool | string | $dbDomain | DB domain of the relevant wiki or false for the current one |
Definition at line 169 of file RevisionStore.php.
References Revision\RevisionStore\$actorMigration, Revision\RevisionStore\$blobStore, Revision\RevisionStore\$cache, Revision\RevisionStore\$commentStore, Revision\RevisionStore\$contentHandlerFactory, Revision\RevisionStore\$contentModelStore, Revision\RevisionStore\$dbDomain, Revision\RevisionStore\$hookContainer, Revision\RevisionStore\$loadBalancer, Revision\RevisionStore\$slotRoleRegistry, and Revision\RevisionStore\$slotRoleStore.
|
private |
Asserts that if revision is provided, it's saved and belongs to the page with provided pageId.
string | $paramName | |
int | $pageId | |
RevisionRecord | null | $rev |
InvalidArgumentException |
Definition at line 3033 of file RevisionStore.php.
Referenced by Revision\RevisionStore\countRevisionsBetween(), Revision\RevisionStore\getAuthorsBetween(), and Revision\RevisionStore\getRevisionIdsBetween().
MCR migration note: this corresponds to Revision::checkContentModel.
MWException | |
MWUnknownContentModelException |
Definition at line 844 of file RevisionStore.php.
References $content.
Referenced by Revision\RevisionStore\storeContentBlob().
|
private |
Throws an exception if the given database connection does not belong to the wiki this RevisionStore is bound to.
IDatabase | $db |
MWException |
Definition at line 2375 of file RevisionStore.php.
References Revision\RevisionStore\$dbDomain.
Referenced by Revision\RevisionStore\countRevisionsByPageId(), Revision\RevisionStore\fetchRevisionRowFromConds(), Revision\RevisionStore\getPreviousRevisionId(), Revision\RevisionStore\insertRevisionOn(), Revision\RevisionStore\newNullRevision(), and Revision\RevisionStore\userWasLastToEdit().
|
private |
Factory method for SlotRecords based on known slot rows.
int | $revId | The revision to load slots for. |
\\stdClass[] | IResultWrapper | $slotRows | |
int | $queryFlags | |
Title | $title | |
array | null | $slotContents | a map from blobAddress to slot content blob or Content object. |
Definition at line 1270 of file RevisionStore.php.
References $blob, $title, Revision\RevisionStore\loadSlotContent(), Revision\SlotRecord\MAIN, and wfBacktrace().
Referenced by Revision\RevisionStore\loadSlotRecords(), and Revision\RevisionStore\newRevisionSlots().
Revision\RevisionStore::countAuthorsBetween | ( | $pageId, | |
RevisionRecord | $old = null , |
||
RevisionRecord | $new = null , |
||
User | $user = null , |
||
$max = null , |
|||
$options = [] |
|||
) |
Get the number of authors between the given revisions.
Used for diffs and other things that really need it.
int | $pageId | The id of the page |
RevisionRecord | null | $old | Old revision . If null is provided, count starting from the first revision (inclusive). |
RevisionRecord | null | $new | New revision. If null is provided, count until the last revision (inclusive). |
User | null | $user | the user who's access rights to apply |
int | null | $max | Limit of Revisions to count, will be incremented to detect truncations. |
string | array | $options | Single option, or an array of options: RevisionStore::INCLUDE_OLD Include $old in the range; $new is excluded. RevisionStore::INCLUDE_NEW Include $new in the range; $old is excluded. RevisionStore::INCLUDE_BOTH Include both $old and $new in the range. |
InvalidArgumentException | in case either revision is unsaved or the revisions do not belong to the same page or unknown option is passed. |
Definition at line 3265 of file RevisionStore.php.
References Revision\RevisionStore\getAuthorsBetween().
Revision\RevisionStore::countRevisionsBetween | ( | $pageId, | |
RevisionRecord | $old = null , |
||
RevisionRecord | $new = null , |
||
$max = null , |
|||
$options = [] |
|||
) |
Get the number of revisions between the given revisions.
Used for diffs and other things that really need it.
int | $pageId | The id of the page |
RevisionRecord | null | $old | Old revision. If null is provided, count starting from the first revision (inclusive). |
RevisionRecord | null | $new | New revision. If null is provided, count until the last revision (inclusive). |
int | null | $max | Limit of Revisions to count, will be incremented to detect truncations. |
string | array | $options | Single option, or an array of options: RevisionStore::INCLUDE_OLD Include $old in the range; $new is excluded. RevisionStore::INCLUDE_NEW Include $new in the range; $old is excluded. RevisionStore::INCLUDE_BOTH Include both $old and $new in the range. |
InvalidArgumentException | in case either revision is unsaved or the revisions do not belong to the same page. |
Definition at line 3298 of file RevisionStore.php.
References $dbr, Revision\RevisionStore\assertRevisionParameter(), DB_REPLICA, Revision\RevisionRecord\DELETED_TEXT, and Revision\RevisionStore\getDBConnectionRef().
Revision\RevisionStore::countRevisionsByPageId | ( | IDatabase | $db, |
$id | |||
) |
Get count of revisions per page...not very efficient.
MCR migration note: this replaces Revision::countByPageId
IDatabase | $db | |
int | $id | Page id |
Definition at line 2831 of file RevisionStore.php.
References Revision\RevisionStore\checkDatabaseDomain().
Referenced by Revision\RevisionStore\countRevisionsByTitle().
Revision\RevisionStore::countRevisionsByTitle | ( | IDatabase | $db, |
$title | |||
) |
Get count of revisions per page...not very efficient.
MCR migration note: this replaces Revision::countByTitle
IDatabase | $db | |
Title | $title |
Definition at line 2854 of file RevisionStore.php.
References $title, and Revision\RevisionStore\countRevisionsByPageId().
|
private |
Check that the given row matches the given Title object.
When a mismatch is detected, this tries to re-load the title from master, to avoid spurious errors during page moves.
\\stdClass | $row | |
Title | $title | |
array | $context |
Definition at line 1608 of file RevisionStore.php.
References MediaWiki\$context, $title, and wfBacktrace().
Referenced by Revision\RevisionStore\getKnownCurrentRevision(), and Revision\RevisionStore\newRevisionFromRowAndSlots().
|
private |
mixed | $value | |
string | $name |
IncompleteRevisionException | if $value is empty |
Definition at line 344 of file RevisionStore.php.
Referenced by Revision\RevisionStore\insertRevisionOn().
|
private |
mixed | $value | |
string | $name |
IncompleteRevisionException | if $value is null |
Definition at line 327 of file RevisionStore.php.
Referenced by Revision\RevisionStore\insertRevisionOn().
|
private |
Given a set of conditions, return a row with the fields necessary to build RevisionRecord objects.
MCR migration note: this corresponds to Revision::fetchFromConds
IDatabase | $db | |
array | $conditions | |
int | $flags | (optional) |
array | $options | (optional) additional query options |
Definition at line 2398 of file RevisionStore.php.
References $revQuery, Revision\RevisionStore\checkDatabaseDomain(), and Revision\RevisionStore\getQueryInfo().
Referenced by Revision\RevisionStore\getKnownCurrentRevision(), Revision\RevisionStore\loadRevisionFromConds(), and Revision\RevisionStore\newRevisionFromRowAndSlots().
Revision\RevisionStore::getArchiveQueryInfo | ( | ) |
Return the tables, fields, and join conditions to be selected to create a new RevisionArchiveRecord object.
MCR migration note: this replaces Revision::getArchiveQueryInfo
$table
to IDatabase->select()
$vars
to IDatabase->select()
$join_conds
to IDatabase->select()
Definition at line 2586 of file RevisionStore.php.
Revision\RevisionStore::getAuthorsBetween | ( | $pageId, | |
RevisionRecord | $old = null , |
||
RevisionRecord | $new = null , |
||
User | $user = null , |
||
$max = null , |
|||
$options = [] |
|||
) |
Get the authors between the given revisions or revisions.
Used for diffs and other things that really need it.
int | $pageId | The id of the page |
RevisionRecord | null | $old | Old revision. If null is provided, count starting from the first revision (inclusive). |
RevisionRecord | null | $new | New revision. If null is provided, count until the last revision (inclusive). |
User | null | $user | the user who's access rights to apply |
int | null | $max | Limit of Revisions to count, will be incremented to detect truncations. |
string | array | $options | Single option, or an array of options: RevisionStore::INCLUDE_OLD Include $old in the range; $new is excluded. RevisionStore::INCLUDE_NEW Include $new in the range; $old is excluded. RevisionStore::INCLUDE_BOTH Include both $old and $new in the range. |
InvalidArgumentException | in case either revision is unsaved or the revisions do not belong to the same page or unknown option is passed. |
Definition at line 3194 of file RevisionStore.php.
References $dbr, Revision\RevisionStore\assertRevisionParameter(), DB_REPLICA, Revision\RevisionRecord\DELETED_USER, Revision\RevisionRecord\FOR_PUBLIC, and Revision\RevisionStore\getDBConnectionRef().
Referenced by Revision\RevisionStore\countAuthorsBetween().
|
private |
IDatabase | $dbw | |
RevisionRecord | $rev | |
Title | $title | |
int | $parentId |
Definition at line 738 of file RevisionStore.php.
References Revision\RevisionRecord\getId(), Revision\RevisionRecord\getPageId(), Revision\RevisionRecord\getSha1(), Revision\RevisionRecord\getSize(), Revision\RevisionRecord\getTimestamp(), Revision\RevisionRecord\getVisibility(), and Revision\RevisionRecord\isMinor().
Referenced by Revision\RevisionStore\insertRevisionRowOn().
Revision\RevisionStore::getContentBlobsForBatch | ( | $rowsOrIds, | |
$slots = null , |
|||
$queryFlags = 0 |
|||
) |
Gets raw (serialized) content blobs for the given set of revisions.
Callers are responsible for unserializing and interpreting the content blobs based on the model_name field and the slot role.
This method is intended for bulk operations in maintenance scripts. It may be chosen over newRevisionsFromBatch by code that are only interested in raw content, as opposed to meta data. Code that needs to access meta data of revisions, slots, or content objects should use newRevisionsFromBatch() instead.
Traversable | array | $rowsOrIds | list of revision ids, or revision rows from a db query. |
array | null | $slots | the role names for which to get slots. |
int | $queryFlags |
Definition at line 1990 of file RevisionStore.php.
References Revision\RevisionStore\getSlotRowsForBatch().
|
private |
int | $mode | DB_MASTER or DB_REPLICA |
array | $groups |
Definition at line 233 of file RevisionStore.php.
References Revision\RevisionStore\getDBLoadBalancer().
Referenced by Revision\RevisionStore\countRevisionsBetween(), Revision\RevisionStore\getAuthorsBetween(), Revision\RevisionStore\getDBConnectionRefForQueryFlags(), Revision\RevisionStore\getKnownCurrentRevision(), Revision\RevisionStore\getRelativeRevision(), Revision\RevisionStore\getRevisionSizes(), Revision\RevisionStore\getTitle(), Revision\RevisionStore\loadSlotRecords(), and Revision\RevisionStore\newRevisionFromConds().
|
private |
int | $queryFlags | a bit field composed of READ_XXX flags |
Definition at line 222 of file RevisionStore.php.
References Revision\RevisionStore\getDBConnectionRef(), and DBAccessObjectUtils\getDBOptions().
Referenced by Revision\RevisionStore\getRevisionByPageId(), Revision\RevisionStore\getRevisionByTimestamp(), Revision\RevisionStore\getRevisionByTitle(), Revision\RevisionStore\getRevisionIdsBetween(), Revision\RevisionStore\getSlotRowsForBatch(), Revision\RevisionStore\getTimestampFromId(), Revision\RevisionStore\newRevisionFromArchiveRowAndSlots(), Revision\RevisionStore\newRevisionFromConds(), and Revision\RevisionStore\newRevisionFromRowAndSlots().
|
private |
Definition at line 213 of file RevisionStore.php.
References Revision\RevisionStore\$loadBalancer.
Referenced by Revision\RevisionStore\getDBConnectionRef(), and Revision\RevisionStore\newRevisionFromConds().
Revision\RevisionStore::getFirstRevision | ( | LinkTarget | $title, |
int | $flags = IDBAccessObject::READ_NORMAL |
||
) |
Get the first revision of a given page.
LinkTarget | $title | |
int | $flags |
Implements Revision\RevisionLookup.
Definition at line 2987 of file RevisionStore.php.
References $title, Title\newFromLinkTarget(), and Revision\RevisionStore\newRevisionFromConds().
Revision\RevisionStore::getKnownCurrentRevision | ( | Title | $title, |
$revId = 0 |
|||
) |
Load a revision based on a known page ID and current revision ID from the DB.
This method allows for the use of caching, though accessing anything that normally requires permission checks (aside from the text) will trigger a small DB lookup.
MCR migration note: this replaces Revision::newKnownCurrent
Title | $title | the associated page title |
int | $revId | current revision of this page. Defaults to $title->getLatestRevID(). |
Implements Revision\RevisionLookup.
Definition at line 2922 of file RevisionStore.php.
References $title, DB_REPLICA, Revision\RevisionStore\ensureRevisionRowMatchesTitle(), Revision\RevisionStore\fetchRevisionRowFromConds(), Wikimedia\Rdbms\Database\getCacheSetOptions(), Revision\RevisionStore\getDBConnectionRef(), Revision\RevisionStore\getRevisionRowCacheKey(), Revision\RevisionStore\newRevisionFromRow(), and wfWarn().
Revision\RevisionStore::getNextRevision | ( | RevisionRecord | $rev, |
$flags = 0 |
|||
) |
Get the revision after $rev in the page's history, if any.
Will return null for the latest revision but also for deleted or unsaved revisions.
MCR migration note: this replaces Revision::getNext
RevisionRecord | $rev | |
int | $flags | (optional) $flags include: IDBAccessObject::READ_LATEST: Select the data from the master |
Implements Revision\RevisionLookup.
Definition at line 2751 of file RevisionStore.php.
References Revision\RevisionStore\getRelativeRevision(), and wfDeprecated().
Revision\RevisionStore::getPreviousRevision | ( | RevisionRecord | $rev, |
$flags = 0 |
|||
) |
Get the revision before $rev in the page's history, if any.
Will return null for the first revision but also for deleted or unsaved revisions.
MCR migration note: this replaces Revision::getPrevious
RevisionRecord | $rev | |
int | $flags | (optional) $flags include: IDBAccessObject::READ_LATEST: Select the data from the master |
Implements Revision\RevisionLookup.
Definition at line 2728 of file RevisionStore.php.
References Revision\RevisionStore\getRelativeRevision(), and wfDeprecated().
|
private |
Get previous revision Id for this page_id This is used to populate rev_parent_id on save.
MCR migration note: this corresponds to Revision::getPreviousRevisionId
IDatabase | $db | |
RevisionRecord | $rev |
Definition at line 2772 of file RevisionStore.php.
References Revision\RevisionStore\checkDatabaseDomain(), Revision\RevisionRecord\getId(), and Revision\RevisionRecord\getPageId().
Referenced by Revision\RevisionStore\insertRevisionOn().
Revision\RevisionStore::getQueryInfo | ( | $options = [] | ) |
Return the tables, fields, and join conditions to be selected to create a new RevisionStoreRecord object.
MCR migration note: this replaces Revision::getQueryInfo
If the format of fields returned changes in any way then the cache key provided by self::getRevisionRowCacheKey should be updated.
array | $options | Any combination of the following strings
|
$table
to IDatabase->select()
$vars
to IDatabase->select()
$join_conds
to IDatabase->select()
-return array{tables:string[],fields:string[],joins:array} Definition at line 2441 of file RevisionStore.php.
Referenced by Revision\RevisionStore\fetchRevisionRowFromConds(), and Revision\RevisionStore\userWasLastToEdit().
Revision\RevisionStore::getRcIdIfUnpatrolled | ( | RevisionRecord | $rev | ) |
MCR migration note: this replaces Revision::isUnpatrolled.
RevisionRecord | $rev |
Definition at line 961 of file RevisionStore.php.
References Revision\RevisionStore\getRecentChange(), and RecentChange\PRC_UNPATROLLED.
Revision\RevisionStore::getRecentChange | ( | RevisionRecord | $rev, |
$flags = 0 |
|||
) |
Get the RC object belonging to the current revision, if there's one.
MCR migration note: this replaces Revision::getRecentChange
RevisionRecord | $rev | |
int | $flags | (optional) $flags include: IDBAccessObject::READ_LATEST: Select the data from the master |
Definition at line 983 of file RevisionStore.php.
References DBAccessObjectUtils\getDBOptions(), Revision\RevisionRecord\getId(), and RecentChange\newFromConds().
Referenced by Revision\RevisionStore\getRcIdIfUnpatrolled().
|
private |
Implementation of getPreviousRevision and getNextRevision.
RevisionRecord | $rev | |
int | $flags | |
string | $dir | 'next' or 'prev' |
Definition at line 2665 of file RevisionStore.php.
References Revision\RevisionStore\getDBConnectionRef(), DBAccessObjectUtils\getDBOptions(), Revision\RevisionRecord\getId(), Revision\RevisionRecord\getPageId(), Revision\RevisionStore\getRevisionById(), and Revision\RevisionStore\getTimestampFromId().
Referenced by Revision\RevisionStore\getNextRevision(), and Revision\RevisionStore\getPreviousRevision().
Revision\RevisionStore::getRevisionById | ( | $id, | |
$flags = 0 |
|||
) |
Load a page revision from a given revision ID number.
Returns null if no such revision can be found.
MCR migration note: this replaces Revision::newFromId
$flags include: IDBAccessObject::READ_LATEST: Select the data from the master IDBAccessObject::READ_LOCKING : Select & lock the data from the master
int | $id | |
int | $flags | (optional) |
Implements Revision\RevisionLookup.
Definition at line 1091 of file RevisionStore.php.
References Revision\RevisionStore\newRevisionFromConds().
Referenced by Revision\RevisionStore\getRelativeRevision().
Revision\RevisionStore::getRevisionByPageId | ( | $pageId, | |
$revId = 0 , |
|||
$flags = 0 |
|||
) |
Load either the current, or a specified, revision that's attached to a given page ID.
Returns null if no such revision can be found.
MCR migration note: this replaces Revision::newFromPageId
$flags include: IDBAccessObject::READ_LATEST: Select the data from the master (since 1.20) IDBAccessObject::READ_LOCKING : Select & lock the data from the master
int | $pageId | |
int | $revId | (optional) |
int | $flags | Bitfield (optional) |
Implements Revision\RevisionLookup.
Definition at line 1159 of file RevisionStore.php.
References Revision\RevisionStore\getDBConnectionRefForQueryFlags(), Revision\RevisionStore\loadRevisionFromConds(), and Revision\RevisionStore\newRevisionFromConds().
Revision\RevisionStore::getRevisionByTimestamp | ( | LinkTarget | $title, |
string | $timestamp, | ||
int | $flags = IDBAccessObject::READ_NORMAL |
||
) |
Load the revision for the given title with the given timestamp.
WARNING: Timestamps may in some circumstances not be unique, so this isn't the best key to use.
MCR migration note: this replaces Revision::loadFromTimestamp
LinkTarget | $title | |
string | $timestamp | |
int | $flags | Bitfield (optional) include: IDBAccessObject::READ_LATEST: Select the data from the master IDBAccessObject::READ_LOCKING: Select & lock the data from the master Default: IDBAccessObject::READ_NORMAL |
Implements Revision\RevisionLookup.
Definition at line 1198 of file RevisionStore.php.
References $title, Revision\RevisionStore\getDBConnectionRefForQueryFlags(), Title\newFromLinkTarget(), and Revision\RevisionStore\newRevisionFromConds().
Revision\RevisionStore::getRevisionByTitle | ( | LinkTarget | $linkTarget, |
$revId = 0 , |
|||
$flags = 0 |
|||
) |
Load either the current, or a specified, revision that's attached to a given link target.
If not attached to that link target, will return null.
MCR migration note: this replaces Revision::newFromTitle
$flags include: IDBAccessObject::READ_LATEST: Select the data from the master IDBAccessObject::READ_LOCKING : Select & lock the data from the master
LinkTarget | $linkTarget | |
int | $revId | (optional) |
int | $flags | Bitfield (optional) |
Implements Revision\RevisionLookup.
Definition at line 1111 of file RevisionStore.php.
References $title, Revision\RevisionStore\getDBConnectionRefForQueryFlags(), Revision\RevisionStore\loadRevisionFromConds(), Title\newFromLinkTarget(), and Revision\RevisionStore\newRevisionFromConds().
Revision\RevisionStore::getRevisionIdsBetween | ( | int | $pageId, |
RevisionRecord | $old = null , |
||
RevisionRecord | $new = null , |
||
?int | $max = null , |
||
$options = [] , |
|||
?string | $order = null , |
||
int | $flags = IDBAccessObject::READ_NORMAL |
||
) |
Get IDs of revisions between the given revisions.
int | $pageId | The id of the page |
RevisionRecord | null | $old | Old revision. If null is provided, count starting from the first revision (inclusive). |
RevisionRecord | null | $new | New revision. If null is provided, count until the last revision (inclusive). |
int | null | $max | Limit of Revisions to count, will be incremented by one to detect truncations. |
string | array | $options | Single option, or an array of options: RevisionStore::INCLUDE_OLD Include $old in the range; $new is excluded. RevisionStore::INCLUDE_NEW Include $new in the range; $old is excluded. RevisionStore::INCLUDE_BOTH Include both $old and $new in the range. |
string | null | $order | The direction in which the revisions should be sorted. Possible values:
|
int | $flags |
InvalidArgumentException | in case either revision is unsaved or the revisions do not belong to the same page or unknown option is passed. |
Definition at line 3120 of file RevisionStore.php.
References Revision\RevisionStore\assertRevisionParameter(), Revision\RevisionRecord\DELETED_TEXT, and Revision\RevisionStore\getDBConnectionRefForQueryFlags().
|
private |
Converts revision limits to query conditions.
IDatabase | $dbr | |
RevisionRecord | null | $old | Old revision. If null is provided, count starting from the first revision (inclusive). |
RevisionRecord | null | $new | New revision. If null is provided, count until the last revision (inclusive). |
string | array | $options | Single option, or an array of options: RevisionStore::INCLUDE_OLD Include $old in the range; $new is excluded. RevisionStore::INCLUDE_NEW Include $new in the range; $old is excluded. RevisionStore::INCLUDE_BOTH Include both $old and $new in the range. |
Definition at line 3060 of file RevisionStore.php.
References $dbr.
|
private |
Get a cache key for use with a row as selected with getQueryInfo( [ 'page', 'user' ] ) Caching rows without 'page' or 'user' could lead to issues.
If the format of the rows returned by the query provided by getQueryInfo changes the cache key should be updated to avoid conflicts.
IDatabase | $db | |
int | $pageId | |
int | $revId |
Definition at line 3017 of file RevisionStore.php.
Referenced by Revision\RevisionStore\getKnownCurrentRevision().
Revision\RevisionStore::getRevisionSizes | ( | array | $revIds | ) |
Do a batched query for the sizes of a set of revisions.
MCR migration note: this replaces Revision::getParentLengths
int[] | $revIds |
Definition at line 2619 of file RevisionStore.php.
References $dbr, $res, DB_REPLICA, and Revision\RevisionStore\getDBConnectionRef().
Referenced by Revision\RevisionStore\listRevisionSizes().
|
private |
Gets the slot rows associated with a batch of revisions.
The serialized content of each slot can be included by setting the 'blobs' option. Callers are responsible for unserializing and interpreting the content blobs based on the model_name and role_name fields.
Traversable | array | $rowsOrIds | list of revision ids, or revision or archive rows from a db query. |
array | $options | Supports the following options: 'slots' - a list of slot role names to fetch. If omitted or true or null, all slots are fetched 'blobs' - whether the serialized content of each slot should be loaded. If true, the serialiezd content will be present in the slot row in the blob_data field. |
int | $queryFlags |
Definition at line 1874 of file RevisionStore.php.
References Revision\RevisionStore\getDBConnectionRefForQueryFlags(), and Revision\RevisionStore\getSlotsQueryInfo().
Referenced by Revision\RevisionStore\getContentBlobsForBatch(), and Revision\RevisionStore\newRevisionsFromBatch().
Revision\RevisionStore::getSlotsQueryInfo | ( | $options = [] | ) |
Return the tables, fields, and join conditions to be selected to create a new SlotRecord.
array | $options | Any combination of the following strings
|
$table
to IDatabase->select()
$vars
to IDatabase->select()
$join_conds
to IDatabase->select()
Definition at line 2521 of file RevisionStore.php.
Referenced by Revision\RevisionStore\getSlotRowsForBatch(), and Revision\RevisionStore\loadSlotRecords().
Revision\RevisionStore::getTimestampFromId | ( | $id, | |
$flags = 0 |
|||
) |
Get rev_timestamp from rev_id, without loading the rest of the row.
Historically, there was an extra Title parameter that was passed before $id. This is no longer needed and is deprecated in 1.34.
MCR migration note: this replaces Revision::getTimestampFromId
int | $id | |
int | $flags |
Implements Revision\RevisionLookup.
Definition at line 2808 of file RevisionStore.php.
References Revision\RevisionStore\getDBConnectionRefForQueryFlags().
Referenced by Revision\RevisionStore\getRelativeRevision().
Revision\RevisionStore::getTitle | ( | $pageId, | |
$revId, | |||
$queryFlags = self::READ_NORMAL |
|||
) |
Determines the page Title based on the available information.
MCR migration note: this corresponds to Revision::getTitle
int | null | $pageId | |
int | null | $revId | |
int | $queryFlags |
RevisionAccessException |
Definition at line 252 of file RevisionStore.php.
References $dbr, $title, DB_MASTER, Revision\RevisionStore\getDBConnectionRef(), DBAccessObjectUtils\getDBOptions(), DBAccessObjectUtils\hasFlags(), Title\newFromID(), Title\newFromRow(), and wfBacktrace().
Referenced by Revision\RevisionStore\newMutableRevisionFromArray(), and Revision\RevisionStore\newRevisionFromRowAndSlots().
|
private |
MutableRevisionRecord | $record | |
array | $fields |
Definition at line 2131 of file RevisionStore.php.
References User\newFromAnyId(), Revision\MutableRevisionRecord\setComment(), Revision\MutableRevisionRecord\setId(), Revision\MutableRevisionRecord\setMinorEdit(), Revision\MutableRevisionRecord\setPageId(), Revision\MutableRevisionRecord\setParentId(), Revision\MutableRevisionRecord\setSha1(), Revision\MutableRevisionRecord\setSize(), Revision\MutableRevisionRecord\setTimestamp(), Revision\MutableRevisionRecord\setUser(), and Revision\MutableRevisionRecord\setVisibility().
Referenced by Revision\RevisionStore\newMutableRevisionFromArray().
|
private |
SlotRecord | $slot | |
IDatabase | $dbw | |
string | $blobAddress |
Definition at line 823 of file RevisionStore.php.
References Revision\SlotRecord\getModel(), Revision\SlotRecord\getSha1(), and Revision\SlotRecord\getSize().
Referenced by Revision\RevisionStore\insertSlotOn().
|
private |
Insert IP revision into ip_changes for use when querying for a range.
IDatabase | $dbw | |
User | $user | |
RevisionRecord | $rev | |
int | $revisionId |
Definition at line 595 of file RevisionStore.php.
References User\getId(), User\getName(), and Revision\RevisionRecord\getTimestamp().
Referenced by Revision\RevisionStore\insertRevisionInternal().
|
private |
Definition at line 480 of file RevisionStore.php.
References $title, Revision\RevisionRecord\getSlot(), Revision\RevisionRecord\getSlotRoles(), Revision\RevisionStore\insertIpChangesRow(), Revision\RevisionStore\insertRevisionRowOn(), Revision\RevisionStore\insertSlotOn(), MediaWiki\Storage\BlobStore\PAGE_HINT, MediaWiki\Storage\BlobStore\PARENT_HINT, Revision\RevisionRecord\RAW, and MediaWiki\Storage\BlobStore\REVISION_HINT.
Referenced by Revision\RevisionStore\insertRevisionOn().
Revision\RevisionStore::insertRevisionOn | ( | RevisionRecord | $rev, |
IDatabase | $dbw | ||
) |
Insert a new revision into the database, returning the new revision record on success and dies horribly on failure.
MCR migration note: this replaces Revision::insertOn
RevisionRecord | $rev | |
IDatabase | $dbw | (master connection) |
Definition at line 365 of file RevisionStore.php.
References $title, Revision\RevisionStore\checkDatabaseDomain(), Revision\RevisionStore\failOnEmpty(), Revision\RevisionStore\failOnNull(), Revision\RevisionRecord\getComment(), Revision\RevisionRecord\getId(), Revision\RevisionRecord\getPageAsLinkTarget(), Revision\RevisionRecord\getPageId(), Revision\RevisionRecord\getParentId(), Revision\RevisionStore\getPreviousRevisionId(), Revision\RevisionRecord\getSha1(), Revision\RevisionRecord\getSize(), Revision\RevisionRecord\getSlot(), Revision\RevisionRecord\getSlotRoles(), Revision\RevisionRecord\getTimestamp(), Revision\RevisionRecord\getUser(), Revision\RevisionStore\insertRevisionInternal(), Revision\RevisionRecord\isReadyForInsertion(), Revision\SlotRecord\MAIN, Title\newFromLinkTarget(), and Revision\RevisionRecord\RAW.
|
private |
IDatabase | $dbw | |
RevisionRecord | $rev | |
Title | $title | |
int | $parentId |
MWException | |
MWUnknownContentModelException |
Definition at line 622 of file RevisionStore.php.
References $title, Revision\RevisionStore\getBaseRevisionRow(), Revision\RevisionRecord\getComment(), Revision\RevisionRecord\getUser(), and Revision\RevisionRecord\RAW.
Referenced by Revision\RevisionStore\insertRevisionInternal().
|
private |
IDatabase | $dbw | |
int | $revisionId | |
SlotRecord | $protoSlot | |
Title | $title | |
array | $blobHints | See the BlobStore::XXX_HINT constants |
Definition at line 557 of file RevisionStore.php.
References $title, Revision\SlotRecord\getAddress(), Revision\SlotRecord\getContentId(), Revision\SlotRecord\hasAddress(), Revision\SlotRecord\hasContentId(), Revision\RevisionStore\insertContentRowOn(), Revision\RevisionStore\insertSlotRowOn(), Revision\SlotRecord\newSaved(), and Revision\RevisionStore\storeContentBlob().
Referenced by Revision\RevisionStore\insertRevisionInternal().
|
private |
SlotRecord | $slot | |
IDatabase | $dbw | |
int | $revisionId | |
int | $contentId |
Definition at line 805 of file RevisionStore.php.
References Revision\SlotRecord\getOrigin(), Revision\SlotRecord\getRole(), and Revision\SlotRecord\hasOrigin().
Referenced by Revision\RevisionStore\insertSlotOn().
Revision\RevisionStore::isReadOnly | ( | ) |
Definition at line 206 of file RevisionStore.php.
Revision\RevisionStore::listRevisionSizes | ( | IDatabase | $db, |
array | $revIds | ||
) |
Do a batched query for the sizes of a set of revisions.
MCR migration note: this replaces Revision::getParentLengths
IDatabase | $db | |
int[] | $revIds |
Definition at line 2652 of file RevisionStore.php.
References Revision\RevisionStore\getRevisionSizes(), and wfDeprecated().
|
private |
Given a set of conditions, fetch a revision from the given database connection.
MCR migration note: this corresponds to Revision::loadFromConds
IDatabase | $db | |
array | $conditions | |
int | $flags | (optional) |
Title | null | $title | (optional) additional query options |
array | $options | (optional) additional query options |
Definition at line 2353 of file RevisionStore.php.
References $title, Revision\RevisionStore\fetchRevisionRowFromConds(), and Revision\RevisionStore\newRevisionFromRow().
Referenced by Revision\RevisionStore\getRevisionByPageId(), Revision\RevisionStore\getRevisionByTitle(), Revision\RevisionStore\loadRevisionFromPageId(), Revision\RevisionStore\loadRevisionFromTimestamp(), Revision\RevisionStore\loadRevisionFromTitle(), Revision\RevisionStore\newNullRevision(), and Revision\RevisionStore\newRevisionFromConds().
Revision\RevisionStore::loadRevisionFromPageId | ( | IDatabase | $db, |
$pageid, | |||
$id = 0 |
|||
) |
Load either the current, or a specified, revision that's attached to a given page.
If not attached to that page, will return null.
MCR migration note: this replaces Revision::loadFromPageId
IDatabase | $db | |
int | $pageid | |
int | $id |
Definition at line 2222 of file RevisionStore.php.
References Revision\RevisionStore\loadRevisionFromConds(), and wfDeprecated().
Revision\RevisionStore::loadRevisionFromTimestamp | ( | IDatabase | $db, |
$title, | |||
$timestamp | |||
) |
Load the revision for the given title with the given timestamp.
WARNING: Timestamps may in some circumstances not be unique, so this isn't the best key to use.
MCR migration note: this replaces Revision::loadFromTimestamp
IDatabase | $db | |
Title | $title | |
string | $timestamp |
Definition at line 2284 of file RevisionStore.php.
References $title, Revision\RevisionStore\loadRevisionFromConds(), and wfDeprecated().
Revision\RevisionStore::loadRevisionFromTitle | ( | IDatabase | $db, |
$title, | |||
$id = 0 |
|||
) |
Load either the current, or a specified, revision that's attached to a given page.
If not attached to that page, will return null.
MCR migration note: this replaces Revision::loadFromTitle
IDatabase | $db | |
Title | $title | |
int | $id |
Definition at line 2250 of file RevisionStore.php.
References $title, Revision\RevisionStore\loadRevisionFromConds(), and wfDeprecated().
|
private |
Loads a Content object based on a slot row.
This method does not call $slot->getContent(), and may be used as a callback called by $slot->getContent().
MCR migration note: this roughly corresponds to Revision::getContentInternal
SlotRecord | $slot | The SlotRecord to load content for |
string | null | $blobData | The content blob, in the form indicated by $blobFlags |
string | null | $blobFlags | Flags indicating how $blobData needs to be processed. Use null if no processing should happen. That is in constrast to the empty string, which causes the blob to be decoded according to the configured legacy encoding. |
string | null | $blobFormat | MIME type indicating how $dataBlob is encoded |
int | $queryFlags |
RevisionAccessException |
Definition at line 1015 of file RevisionStore.php.
References Revision\SlotRecord\getAddress(), Revision\SlotRecord\getModel(), Revision\SlotRecord\getRevision(), Revision\SlotRecord\getRole(), Revision\SlotRecord\hasAddress(), and wfBacktrace().
Referenced by Revision\RevisionStore\constructSlotRecords().
|
private |
int | $revId | The revision to load slots for. |
int | $queryFlags | |
Title | $title |
Definition at line 1222 of file RevisionStore.php.
References $res, $revQuery, $title, Revision\RevisionStore\constructSlotRecords(), Revision\RevisionStore\getDBConnectionRef(), DBAccessObjectUtils\getDBOptions(), Revision\RevisionStore\getSlotsQueryInfo(), and wfBacktrace().
Referenced by Revision\RevisionStore\newRevisionSlots().
Revision\RevisionStore::newMutableRevisionFromArray | ( | array | $fields, |
$queryFlags = 0 , |
|||
Title | $title = null |
||
) |
Constructs a new MutableRevisionRecord based on the given associative array following the MW1.29 convention for the Revision constructor.
MCR migration note: this replaces Revision::newFromRow
array | $fields | |
int | $queryFlags | |
Title | null | $title |
MWException | |
RevisionAccessException |
Implements Revision\RevisionFactory.
Definition at line 2037 of file RevisionStore.php.
References $content, $title, Revision\RevisionStore\getTitle(), Revision\RevisionStore\initializeMutableRevisionFromArray(), Revision\SlotRecord\MAIN, and CommentStoreComment\newUnsavedComment().
Revision\RevisionStore::newNullRevision | ( | IDatabase | $dbw, |
Title | $title, | ||
CommentStoreComment | $comment, | ||
$minor, | |||
User | $user | ||
) |
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.
MCR migration note: this replaces Revision::newNullRevision
IDatabase | $dbw | used for obtaining the lock on the page table row |
Title | $title | Title of the page to read from |
CommentStoreComment | $comment | RevisionRecord's summary |
bool | $minor | Whether the revision should be considered as minor |
User | $user | The user to attribute the revision to |
Definition at line 889 of file RevisionStore.php.
References $title, Revision\RevisionStore\checkDatabaseDomain(), Revision\RevisionStore\loadRevisionFromConds(), and Revision\MutableRevisionRecord\newFromParentRevision().
Revision\RevisionStore::newRevisionFromArchiveRow | ( | $row, | |
$queryFlags = 0 , |
|||
Title | $title = null , |
||
array | $overrides = [] |
||
) |
Make a fake revision object from an archive table row.
This is queried for permissions or even inserted (as in Special:Undelete)
MCR migration note: this replaces Revision::newFromArchiveRow
\\stdClass | $row | |
int | $queryFlags | |
Title | null | $title | |
array | $overrides | associative array with fields of $row to override. This may be used e.g. to force the parent revision ID or page ID. Keys in the array are fields names from the archive table without the 'ar_' prefix, i.e. use 'parent_id' to override ar_parent_id. |
MWException |
Implements Revision\RevisionFactory.
Definition at line 1388 of file RevisionStore.php.
References $title, and Revision\RevisionStore\newRevisionFromArchiveRowAndSlots().
Revision\RevisionStore::newRevisionFromArchiveRowAndSlots | ( | $row, | |
$slots, | |||
$queryFlags = 0 , |
|||
Title | $title = null , |
||
array | $overrides = [] |
||
) |
\\stdClass | $row | |
null | \\stdClass[] | RevisionSlots | $slots |
|
int | $queryFlags | |
Title | null | $title | |
array | $overrides | associative array with fields of $row to override. This may be used e.g. to force the parent revision ID or page ID. Keys in the array are fields names from the archive table without the 'ar_' prefix, i.e. use 'parent_id' to override ar_parent_id. |
MWException |
Definition at line 1438 of file RevisionStore.php.
References $title, Revision\RevisionStore\getDBConnectionRefForQueryFlags(), Title\makeTitle(), User\newFromAnyId(), Revision\RevisionStore\newRevisionSlots(), and wfWarn().
Referenced by Revision\RevisionStore\newRevisionFromArchiveRow().
|
private |
Given a set of conditions, fetch a revision.
This method should be used if we are pretty sure the revision exists. Unless $flags has READ_LATEST set, this method will first try to find the revision on a replica before hitting the master database.
MCR migration note: this corresponds to Revision::newFromConds
array | $conditions | |
int | $flags | (optional) |
Title | null | $title | (optional) |
array | $options | (optional) additional query options |
Definition at line 2313 of file RevisionStore.php.
References $title, DB_MASTER, Revision\RevisionStore\getDBConnectionRef(), Revision\RevisionStore\getDBConnectionRefForQueryFlags(), Revision\RevisionStore\getDBLoadBalancer(), and Revision\RevisionStore\loadRevisionFromConds().
Referenced by Revision\RevisionStore\getFirstRevision(), Revision\RevisionStore\getRevisionById(), Revision\RevisionStore\getRevisionByPageId(), Revision\RevisionStore\getRevisionByTimestamp(), and Revision\RevisionStore\getRevisionByTitle().
Revision\RevisionStore::newRevisionFromRow | ( | $row, | |
$queryFlags = 0 , |
|||
Title | $title = null , |
||
$fromCache = false |
|||
) |
MCR migration note: this replaces Revision::newFromRow
\\stdClass | $row | A database row generated from a query based on getQueryInfo() |
int | $queryFlags | |
Title | null | $title | Preloaded title object based on Title::newFromRow from database row when query was build with option 'page' on getQueryInfo |
bool | $fromCache | if true, the returned RevisionRecord will ensure that no stale data is returned from getters, by querying the database as needed |
Definition at line 1410 of file RevisionStore.php.
References $title, and Revision\RevisionStore\newRevisionFromRowAndSlots().
Referenced by Revision\RevisionStore\getKnownCurrentRevision(), and Revision\RevisionStore\loadRevisionFromConds().
Revision\RevisionStore::newRevisionFromRowAndSlots | ( | $row, | |
$slots, | |||
$queryFlags = 0 , |
|||
Title | $title = null , |
||
$fromCache = false |
|||
) |
\\stdClass | $row | A database row generated from a query based on getQueryInfo() |
null | \\stdClass[] | RevisionSlots | $slots |
|
int | $queryFlags | |
Title | null | $title | |
bool | $fromCache | if true, the returned RevisionRecord will ensure that no stale data is returned from getters, by querying the database as needed |
MWException |
Definition at line 1519 of file RevisionStore.php.
References Revision\RevisionStore\$dbDomain, $title, Revision\RevisionStore\ensureRevisionRowMatchesTitle(), Revision\RevisionStore\fetchRevisionRowFromConds(), Revision\RevisionStore\getDBConnectionRefForQueryFlags(), Revision\RevisionStore\getTitle(), User\newFromAnyId(), Revision\RevisionStore\newRevisionSlots(), wfBacktrace(), and wfWarn().
Referenced by Revision\RevisionStore\newRevisionFromRow().
Revision\RevisionStore::newRevisionsFromBatch | ( | $rows, | |
array | $options = [] , |
||
$queryFlags = 0 , |
|||
Title | $title = null |
||
) |
Construct a RevisionRecord instance for each row in $rows, and return them as an associative array indexed by revision ID.
Use getQueryInfo() or getArchiveQueryInfo() to construct the query that produces the rows.
IResultWrapper | \\stdClass[] | $rows | the rows to construct revision records from |
array | $options | Supports the following options: 'slots' - whether metadata about revision slots should be loaded immediately. Supports falsy or truthy value as well as an explicit list of slot role names. The main slot will always be loaded. 'content' - whether the actual content of the slots should be preloaded. 'archive' - whether the rows where generated using getArchiveQueryInfo(), rather than getQueryInfo. |
int | $queryFlags | |
Title | null | $title | The title to which all the revision rows belong, if there is such a title and the caller has it handy, so we don't have to look it up again. If this parameter is given and any of the rows has a rev_page_id that is different from $title->getArticleID(), an InvalidArgumentException is thrown. |
Definition at line 1663 of file RevisionStore.php.
References $t, $title, Revision\RevisionStore\getSlotRowsForBatch(), if, Revision\SlotRecord\MAIN, Title\makeTitle(), Title\newFromIDs(), and Title\newFromRow().
|
private |
Factory method for RevisionSlots based on a revision ID.
int | $revId | |
\\stdClass | $revisionRow | |
\\stdClass[] | null | $slotRows | |
int | $queryFlags | |
Title | $title |
MWException |
Definition at line 1348 of file RevisionStore.php.
References $title, Revision\RevisionStore\constructSlotRecords(), and Revision\RevisionStore\loadSlotRecords().
Referenced by Revision\RevisionStore\newRevisionFromArchiveRowAndSlots(), and Revision\RevisionStore\newRevisionFromRowAndSlots().
Revision\RevisionStore::setLogger | ( | LoggerInterface | $logger | ) |
Definition at line 199 of file RevisionStore.php.
References Revision\RevisionStore\$logger.
|
private |
SlotRecord | $slot | |
Title | $title | |
array | $blobHints | See the BlobStore::XXX_HINT constants |
MWException |
Definition at line 771 of file RevisionStore.php.
References $content, Revision\RevisionStore\checkContent(), MediaWiki\Storage\BlobStore\DESIGNATION_HINT, MediaWiki\Storage\BlobStore\FORMAT_HINT, Revision\SlotRecord\getContent(), Revision\SlotRecord\getRole(), Revision\SlotRecord\getSha1(), MediaWiki\Storage\BlobStore\MODEL_HINT, MediaWiki\Storage\BlobStore\ROLE_HINT, and MediaWiki\Storage\BlobStore\SHA1_HINT.
Referenced by Revision\RevisionStore\insertSlotOn().
Revision\RevisionStore::userWasLastToEdit | ( | IDatabase | $db, |
$pageId, | |||
$userId, | |||
$since | |||
) |
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.
MCR migration note: this replaces Revision::userWasLastToEdit
IDatabase | $db | The Database to perform the check on. |
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 2880 of file RevisionStore.php.
References $res, $revQuery, Revision\RevisionStore\checkDatabaseDomain(), and Revision\RevisionStore\getQueryInfo().
|
private |
Definition at line 120 of file RevisionStore.php.
Referenced by Revision\RevisionStore\__construct().
|
private |
Definition at line 95 of file RevisionStore.php.
Referenced by Revision\RevisionStore\__construct().
|
private |
Definition at line 110 of file RevisionStore.php.
Referenced by Revision\RevisionStore\__construct().
|
private |
Definition at line 115 of file RevisionStore.php.
Referenced by Revision\RevisionStore\__construct().
|
private |
Definition at line 141 of file RevisionStore.php.
Referenced by Revision\RevisionStore\__construct().
|
private |
Definition at line 130 of file RevisionStore.php.
Referenced by Revision\RevisionStore\__construct().
|
private |
Definition at line 100 of file RevisionStore.php.
Referenced by Revision\RevisionStore\__construct(), Revision\RevisionStore\checkDatabaseDomain(), and Revision\RevisionStore\newRevisionFromRowAndSlots().
|
private |
Definition at line 144 of file RevisionStore.php.
Referenced by Revision\RevisionStore\__construct().
|
private |
Definition at line 147 of file RevisionStore.php.
|
private |
Definition at line 105 of file RevisionStore.php.
Referenced by Revision\RevisionStore\__construct(), and Revision\RevisionStore\getDBLoadBalancer().
|
private |
Definition at line 125 of file RevisionStore.php.
Referenced by Revision\RevisionStore\setLogger().
|
private |
Definition at line 138 of file RevisionStore.php.
Referenced by Revision\RevisionStore\__construct().
|
private |
Definition at line 135 of file RevisionStore.php.
Referenced by Revision\RevisionStore\__construct().
const Revision\RevisionStore::INCLUDE_BOTH = 'include_both' |
Definition at line 90 of file RevisionStore.php.
Referenced by MediaWiki\Storage\RevertedTagUpdate\doUpdate().
const Revision\RevisionStore::INCLUDE_NEW = 'include_new' |
Definition at line 89 of file RevisionStore.php.
const Revision\RevisionStore::INCLUDE_OLD = 'include_old' |
Definition at line 88 of file RevisionStore.php.
const Revision\RevisionStore::ORDER_NEWEST_TO_OLDEST = 'DESC' |
Definition at line 85 of file RevisionStore.php.
const Revision\RevisionStore::ORDER_OLDEST_TO_NEWEST = 'ASC' |
Definition at line 84 of file RevisionStore.php.
const Revision\RevisionStore::ROW_CACHE_KEY = 'revision-row-1.29' |
Definition at line 82 of file RevisionStore.php.