|
MediaWiki master
|
Service for looking up page revisions. More...
Inherits MediaWiki\Revision\RevisionFactory, MediaWiki\Revision\RevisionLookup, and LoggerAwareInterface.

Public Member Functions | ||||
| __construct (ILoadBalancer $loadBalancer, SqlBlobStore $blobStore, WANObjectCache $cache, BagOStuff $localCache, CommentStore $commentStore, NameTableStore $contentModelStore, NameTableStore $slotRoleStore, SlotRoleRegistry $slotRoleRegistry, ActorStore $actorStore, IContentHandlerFactory $contentHandlerFactory, PageStore $pageStore, TitleFactory $titleFactory, HookContainer $hookContainer, $wikiId=WikiAwareEntity::LOCAL) | ||||
| countAuthorsBetween ( $pageId, ?RevisionRecord $old=null, ?RevisionRecord $new=null, ?Authority $performer=null, $max=null, $options=[]) | ||||
| Get the number of authors between the given revisions. | ||||
| countRevisionsBetween ( $pageId, ?RevisionRecord $old=null, ?RevisionRecord $new=null, $max=null, $options=[]) | ||||
| Get the number of revisions between the given revisions. | ||||
| countRevisionsByPageId (IReadableDatabase $db, $id) | ||||
| Get count of revisions per page...not very efficient. | ||||
| countRevisionsByTitle (IReadableDatabase $db, PageIdentity $page) | ||||
| Get count of revisions per page...not very efficient. | ||||
| findIdenticalRevision (RevisionRecord $revision, int $searchLimit) | ||||
| Tries to find a revision identical to $revision in $searchLimit most recent revisions of this page. | ||||
| getArchiveQueryInfo () | ||||
| Return the tables, fields, and join conditions to be selected to create a new RevisionArchiveRecord object. | ||||
| getAuthorsBetween ( $pageId, ?RevisionRecord $old=null, ?RevisionRecord $new=null, ?Authority $performer=null, $max=null, $options=[]) | ||||
| Get the authors between the given revisions or revisions. | ||||
| getContentBlobsForBatch ( $rowsOrIds, $slots=null, $queryFlags=0) | ||||
| Gets raw (serialized) content blobs for the given set of revisions. | ||||
| getFirstRevision ( $page, int $flags=IDBAccessObject::READ_NORMAL) | ||||
| Get the first revision of a given page. | ||||
| getKnownCurrentRevision (PageIdentity $page, $revId=0) | ||||
| getKnownLatestRevision (PageIdentity $page, $revId=0) | ||||
| Load a revision based on a known page ID and latest revision ID from the DB. | ||||
| getNextRevision (RevisionRecord $rev, $flags=IDBAccessObject::READ_NORMAL) | ||||
| Get the revision after $rev in the page's history, if any. | ||||
| getPreviousRevision (RevisionRecord $rev, $flags=IDBAccessObject::READ_NORMAL) | ||||
| Get the revision before $rev in the page's history, if any. | ||||
| getQueryInfo ( $options=[]) | ||||
| Return the tables, fields, and join conditions to be selected to create a new RevisionStoreRecord object. | ||||
| getRcIdIfUnpatrolled (RevisionRecord $rev) | ||||
| MCR migration note: this replaced Revision::isUnpatrolled. | ||||
| getRecentChange (RevisionRecord $rev, $flags=0) | ||||
| Get the RC object belonging to the latest revision, if there's one. | ||||
| getRevisionById ( $id, $flags=0, ?PageIdentity $page=null) | ||||
| Load a page revision from a given revision ID number. | ||||
| getRevisionByPageId ( $pageId, $revId=0, $flags=0) | ||||
| Load either the current, or a specified, revision that's attached to a given page ID. | ||||
| getRevisionByTimestamp ( $page, string $timestamp, int $flags=IDBAccessObject::READ_NORMAL) | ||||
| Load the revision for the given title with the given timestamp. | ||||
| getRevisionByTitle ( $page, $revId=0, $flags=0) | ||||
| Load either the current, or a specified, revision that's attached to a given link target. | ||||
| 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. | ||||
| getRevisionsByIds (array $ids, int $flags=0, ?PageIdentity $page=null) | ||||
| Load page revisions by revision ID. | ||||
| getRevisionSizes (array $revIds) | ||||
| Do a batched query for the sizes of a set of revisions. | ||||
| getSlotsQueryInfo ( $options=[]) | ||||
| Return the tables, fields, and join conditions to be selected to create a new SlotRecord. | ||||
| getTimestampFromId ( $id, $flags=0) | ||||
| Get rev_timestamp from rev_id, without loading the rest of the row. | ||||
| getTitle ( $pageId, $revId, $queryFlags=IDBAccessObject::READ_NORMAL) | ||||
| Determines the page Title based on the available information. | ||||
| getWikiId () | ||||
| Get the ID of the wiki this revision belongs to. | ||||
| insertRevisionOn (RevisionRecord $rev, IDatabase $dbw) | ||||
| Insert a new revision into the database, returning the new revision record on success and dies horribly on failure. | ||||
| isReadOnly () | ||||
| isRevisionRow ( $row, string $table='') | ||||
| Determine whether the parameter is a row containing all the fields that RevisionStore needs to create a RevisionRecord from the row. | ||||
| newArchiveSelectQueryBuilder (IReadableDatabase $dbr) | ||||
Return a SelectQueryBuilder to allow querying archive table.
| ||||
| newNullRevision (IDatabase $dbw, PageIdentity $page, CommentStoreComment $comment, $minor, UserIdentity $user) | ||||
| Create a new dummy revision for insertion into a page's history. | ||||
| newRevisionFromArchiveRow ( $row, $queryFlags=0, ?PageIdentity $page=null, array $overrides=[]) | ||||
| Make a fake RevisionRecord object from an archive table row. | ||||
| newRevisionFromArchiveRowAndSlots (stdClass $row, $slots, int $queryFlags=0, ?PageIdentity $page=null, array $overrides=[]) | ||||
| newRevisionFromRow ( $row, $queryFlags=0, ?PageIdentity $page=null, $fromCache=false) | ||||
| newRevisionFromRowAndSlots (stdClass $row, $slots, int $queryFlags=0, ?PageIdentity $page=null, bool $fromCache=false) | ||||
| newRevisionsFromBatch ( $rows, array $options=[], $queryFlags=0, ?PageIdentity $page=null) | ||||
| Construct a RevisionRecord instance for each row in $rows, and return them as an associative array indexed by revision ID. | ||||
| newSelectQueryBuilder (IReadableDatabase $dbr) | ||||
Return a SelectQueryBuilder to allow querying revision store.
| ||||
| setLogger (LoggerInterface $logger) | ||||
| updateSlotsOn (RevisionRecord $revision, RevisionSlotsUpdate $revisionSlotsUpdate, IDatabase $dbw) | ||||
| Update derived slots in an existing revision into the database, returning the modified slots on success. | ||||
| userWasLastToEdit (IReadableDatabase $db, $pageId, $userId, $since) | ||||
| Check if no edits were made by other users since the time a user started editing the page. | ||||
| Public Member Functions inherited from MediaWiki\Revision\RevisionFactory | ||||
| newRevisionFromRow ( $row, $queryFlags=IDBAccessObject::READ_NORMAL, ?PageIdentity $page=null) | ||||
| Constructs a RevisionRecord given a database row and content slots. | ||||
Public Attributes | |
| const | INCLUDE_BOTH = 'include_both' |
| const | INCLUDE_DELETED_REVISIONS = 'include_deleted_revisions' |
| 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' |
Service for looking up page revisions.
Definition at line 79 of file RevisionStore.php.
| MediaWiki\Revision\RevisionStore::__construct | ( | ILoadBalancer | $loadBalancer, |
| SqlBlobStore | $blobStore, | ||
| WANObjectCache | $cache, | ||
| BagOStuff | $localCache, | ||
| CommentStore | $commentStore, | ||
| NameTableStore | $contentModelStore, | ||
| NameTableStore | $slotRoleStore, | ||
| SlotRoleRegistry | $slotRoleRegistry, | ||
| ActorStore | $actorStore, | ||
| IContentHandlerFactory | $contentHandlerFactory, | ||
| PageStore | $pageStore, | ||
| TitleFactory | $titleFactory, | ||
| HookContainer | $hookContainer, | ||
| $wikiId = WikiAwareEntity::LOCAL ) |
| ILoadBalancer | $loadBalancer | |
| SqlBlobStore | $blobStore | |
| WANObjectCache | $cache | A cache for caching revision rows. This can be the local wiki's default instance even if $wikiId 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. |
| BagOStuff | $localCache | Another layer of cache, best to use APCu here. |
| CommentStore | $commentStore | |
| NameTableStore | $contentModelStore | |
| NameTableStore | $slotRoleStore | |
| SlotRoleRegistry | $slotRoleRegistry | |
| ActorStore | $actorStore | |
| IContentHandlerFactory | $contentHandlerFactory | |
| PageStore | $pageStore | |
| TitleFactory | $titleFactory | |
| HookContainer | $hookContainer | |
| false | string | $wikiId | Relevant wiki id or WikiAwareEntity::LOCAL for the current one |
Definition at line 141 of file RevisionStore.php.
| MediaWiki\Revision\RevisionStore::countAuthorsBetween | ( | $pageId, | |
| ?RevisionRecord | $old = null, | ||
| ?RevisionRecord | $new = null, | ||
| ?Authority | $performer = 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). |
| Authority | null | $performer | the user whose 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:
|
| 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 3338 of file RevisionStore.php.
References getAuthorsBetween().
| MediaWiki\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:
|
| InvalidArgumentException | in case either revision is unsaved or the revisions do not belong to the same page. |
Definition at line 3374 of file RevisionStore.php.
References MediaWiki\Revision\RevisionRecord\DELETED_TEXT.
| MediaWiki\Revision\RevisionStore::countRevisionsByPageId | ( | IReadableDatabase | $db, |
| $id ) |
Get count of revisions per page...not very efficient.
MCR migration note: this replaced Revision::countByPageId
| IReadableDatabase | $db | |
| int | $id | Page id |
Definition at line 2862 of file RevisionStore.php.
References Wikimedia\Rdbms\IReadableDatabase\newSelectQueryBuilder().
Referenced by countRevisionsByTitle().
| MediaWiki\Revision\RevisionStore::countRevisionsByTitle | ( | IReadableDatabase | $db, |
| PageIdentity | $page ) |
Get count of revisions per page...not very efficient.
MCR migration note: this replaced Revision::countByTitle
| IReadableDatabase | $db | |
| PageIdentity | $page |
Definition at line 2881 of file RevisionStore.php.
References countRevisionsByPageId().
| MediaWiki\Revision\RevisionStore::findIdenticalRevision | ( | RevisionRecord | $revision, |
| int | $searchLimit ) |
Tries to find a revision identical to $revision in $searchLimit most recent revisions of this page.
The comparison is based on SHA1s of these revisions.
| RevisionRecord | $revision | which revision to compare to |
| int | $searchLimit | How many recent revisions should be checked |
Definition at line 3423 of file RevisionStore.php.
| MediaWiki\Revision\RevisionStore::getArchiveQueryInfo | ( | ) |
Return the tables, fields, and join conditions to be selected to create a new RevisionArchiveRecord object.
Since 1.34, ar_user and ar_user_text have not been present in the database, but they continue to be available in query results as aliases.
MCR migration note: this replaced Revision::getArchiveQueryInfo
Implements MediaWiki\Revision\RevisionFactory.
Definition at line 2624 of file RevisionStore.php.
Referenced by isRevisionRow().
| MediaWiki\Revision\RevisionStore::getAuthorsBetween | ( | $pageId, | |
| ?RevisionRecord | $old = null, | ||
| ?RevisionRecord | $new = null, | ||
| ?Authority | $performer = 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). |
| Authority | null | $performer | the user whose 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:
|
| 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 3259 of file RevisionStore.php.
References MediaWiki\Revision\RevisionRecord\DELETED_USER, and MediaWiki\Revision\RevisionRecord\FOR_THIS_USER.
Referenced by countAuthorsBetween().
| MediaWiki\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. |
| string[] | null | $slots | the role names for which to get slots. |
| int | $queryFlags |
Definition at line 2269 of file RevisionStore.php.
| MediaWiki\Revision\RevisionStore::getFirstRevision | ( | $page, | |
| int | $flags = IDBAccessObject::READ_NORMAL ) |
Get the first revision of a given page.
| LinkTarget | PageReference | $page | Calling with LinkTarget is deprecated since 1.36 |
| int | $flags |
Implements MediaWiki\Revision\RevisionLookup.
Definition at line 3023 of file RevisionStore.php.
| MediaWiki\Revision\RevisionStore::getKnownCurrentRevision | ( | PageIdentity | $page, |
| $revId = 0 ) |
| PageIdentity | $page | the associated page |
| int | $revId | Latest revision of this page |
Implements MediaWiki\Revision\RevisionLookup.
Definition at line 3011 of file RevisionStore.php.
References getKnownLatestRevision().
| MediaWiki\Revision\RevisionStore::getKnownLatestRevision | ( | PageIdentity | $page, |
| $revId = 0 ) |
Load a revision based on a known page ID and latest 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 replaced Revision::newKnownCurrent
| PageIdentity | $page | the associated page |
| int | $revId | Latest revision of this page. Defaults to $title->getLatestRevID(). |
Implements MediaWiki\Revision\RevisionLookup.
Definition at line 2944 of file RevisionStore.php.
References MediaWiki\Page\PageReference\__toString(), getWikiId(), and newRevisionFromRow().
Referenced by getKnownCurrentRevision().
| MediaWiki\Revision\RevisionStore::getNextRevision | ( | RevisionRecord | $rev, |
| $flags = IDBAccessObject::READ_NORMAL ) |
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 replaced Revision::getNext
| RevisionRecord | $rev | |
| int | $flags | (optional) $flags include:
|
Implements MediaWiki\Revision\RevisionLookup.
Definition at line 2773 of file RevisionStore.php.
| MediaWiki\Revision\RevisionStore::getPreviousRevision | ( | RevisionRecord | $rev, |
| $flags = IDBAccessObject::READ_NORMAL ) |
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 replaced Revision::getPrevious
| RevisionRecord | $rev | |
| int | $flags | (optional) $flags include:
|
Implements MediaWiki\Revision\RevisionLookup.
Definition at line 2758 of file RevisionStore.php.
| MediaWiki\Revision\RevisionStore::getQueryInfo | ( | $options = [] | ) |
Return the tables, fields, and join conditions to be selected to create a new RevisionStoreRecord object.
MCR migration note: this replaced 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
|
Implements MediaWiki\Revision\RevisionFactory.
Definition at line 2440 of file RevisionStore.php.
Referenced by isRevisionRow().
| MediaWiki\Revision\RevisionStore::getRcIdIfUnpatrolled | ( | RevisionRecord | $rev | ) |
MCR migration note: this replaced Revision::isUnpatrolled.
| RevisionRecord | $rev |
Definition at line 1050 of file RevisionStore.php.
References MediaWiki\MediaWikiServices\getInstance(), and MediaWiki\DAO\WikiAwareEntity\LOCAL.
| MediaWiki\Revision\RevisionStore::getRecentChange | ( | RevisionRecord | $rev, |
| $flags = 0 ) |
Get the RC object belonging to the latest revision, if there's one.
MCR migration note: this replaced Revision::getRecentChange
| RevisionRecord | $rev | |
| int | $flags | (optional) $flags include:
|
Definition at line 1078 of file RevisionStore.php.
References MediaWiki\MediaWikiServices\getInstance(), MediaWiki\DAO\WikiAwareEntity\LOCAL, and wfDeprecated().
| MediaWiki\Revision\RevisionStore::getRevisionById | ( | $id, | |
| $flags = 0, | |||
| ?PageIdentity | $page = null ) |
Load a page revision from a given revision ID number.
MCR migration note: this replaced Revision::newFromId
| int | $id | |
| int | $flags | (optional)
|
| PageIdentity | null | $page | The page the revision belongs to. Providing the page may improve performance. |
Implements MediaWiki\Revision\RevisionLookup.
Definition at line 1193 of file RevisionStore.php.
| MediaWiki\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 replaced Revision::newFromPageId
$flags include:
| int | $pageId | |
| int | $revId | (optional) |
| int | $flags | Bitfield (optional) |
Implements MediaWiki\Revision\RevisionLookup.
Definition at line 1337 of file RevisionStore.php.
| MediaWiki\Revision\RevisionStore::getRevisionByTimestamp | ( | $page, | |
| 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 replaced Revision::loadFromTimestamp
| LinkTarget | PageReference | $page | Calling with LinkTarget is deprecated since 1.36 |
| string | $timestamp | |
| int | $flags | Bitfield (optional) include:
|
Implements MediaWiki\Revision\RevisionLookup.
Definition at line 1376 of file RevisionStore.php.
| MediaWiki\Revision\RevisionStore::getRevisionByTitle | ( | $page, | |
| $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 replaced Revision::newFromTitle
$flags include:
| LinkTarget | PageReference | $page | Calling with LinkTarget is deprecated since 1.36 |
| int | $revId | (optional) |
| int | $flags | Bitfield (optional) |
Implements MediaWiki\Revision\RevisionLookup.
Definition at line 1289 of file RevisionStore.php.
References wfDeprecated().
| MediaWiki\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:
|
| 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 3189 of file RevisionStore.php.
| MediaWiki\Revision\RevisionStore::getRevisionsByIds | ( | array | $ids, |
| int | $flags = 0, | ||
| ?PageIdentity | $page = null ) |
Load page revisions by revision ID.
Unless $flags has READ_LATEST set, this method will first try to find revisions on a replica before looking up any missing revisions on the primary database.
| (int|string)[] | $ids Revision IDs to load. Passing numbers as strings is allowed for convenient passing of results from DB queries. | |
| int | $flags | Supports IDBAccessObject::READ_LATEST to use the primary DB. |
| PageIdentity | null | $page | The page all revisions belong to. Providing the page may improve performance. |
Definition at line 1213 of file RevisionStore.php.
| MediaWiki\Revision\RevisionStore::getRevisionSizes | ( | array | $revIds | ) |
Do a batched query for the sizes of a set of revisions.
MCR migration note: this replaced Revision::getParentLengths
| int[] | $revIds |
Definition at line 2663 of file RevisionStore.php.
References if.
| MediaWiki\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
|
Definition at line 2534 of file RevisionStore.php.
| MediaWiki\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 replaced Revision::getTimestampFromId
| int | $id | |
| int | $flags |
Implements MediaWiki\Revision\RevisionLookup.
Definition at line 2825 of file RevisionStore.php.
References Wikimedia\Rdbms\IReadableDatabase\newSelectQueryBuilder().
| MediaWiki\Revision\RevisionStore::getTitle | ( | $pageId, | |
| $revId, | |||
| $queryFlags = IDBAccessObject::READ_NORMAL ) |
Determines the page Title based on the available information.
MCR migration note: this corresponded to Revision::getTitle
| int | null | $pageId | |
| int | null | $revId | |
| int | $queryFlags |
| RevisionAccessException |
Definition at line 239 of file RevisionStore.php.
References wfDeprecatedMsg().
| MediaWiki\Revision\RevisionStore::getWikiId | ( | ) |
Get the ID of the wiki this revision belongs to.
Definition at line 192 of file RevisionStore.php.
Referenced by getKnownLatestRevision().
| MediaWiki\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.
This should be followed up by a WikiPage::updateRevisionOn on call to update page_latest on the page the revision is added to.
MCR migration note: this replaced Revision::insertOn
| RevisionRecord | $rev | |
| IDatabase | $dbw | (primary connection) |
Definition at line 374 of file RevisionStore.php.
References Wikimedia\Rdbms\IDatabase\doAtomicSection(), MediaWiki\Revision\RevisionRecord\getComment(), MediaWiki\Revision\RevisionRecord\getId(), MediaWiki\Revision\RevisionRecord\getPage(), MediaWiki\Revision\RevisionRecord\getPageId(), MediaWiki\Revision\RevisionRecord\getParentId(), MediaWiki\Revision\RevisionRecord\getSize(), MediaWiki\Revision\RevisionRecord\getSlot(), MediaWiki\Revision\RevisionRecord\getSlotRoles(), MediaWiki\Revision\RevisionRecord\getTimestamp(), MediaWiki\Revision\RevisionRecord\getUser(), MediaWiki\Revision\RevisionRecord\isReadyForInsertion(), MediaWiki\Revision\SlotRecord\MAIN, and MediaWiki\Revision\RevisionRecord\RAW.
| MediaWiki\Revision\RevisionStore::isReadOnly | ( | ) |
Definition at line 183 of file RevisionStore.php.
| MediaWiki\Revision\RevisionStore::isRevisionRow | ( | $row, | |
| string | $table = '' ) |
Determine whether the parameter is a row containing all the fields that RevisionStore needs to create a RevisionRecord from the row.
| mixed | $row | |
| string | $table | 'archive' or empty |
Implements MediaWiki\Revision\RevisionFactory.
Definition at line 2591 of file RevisionStore.php.
References getArchiveQueryInfo(), and getQueryInfo().
| MediaWiki\Revision\RevisionStore::newArchiveSelectQueryBuilder | ( | IReadableDatabase | $dbr | ) |
Return a SelectQueryBuilder to allow querying archive table.
| IReadableDatabase | $dbr | A db object to do the query on. |
Implements MediaWiki\Revision\RevisionFactory.
Definition at line 2509 of file RevisionStore.php.
References return.
| MediaWiki\Revision\RevisionStore::newNullRevision | ( | IDatabase | $dbw, |
| PageIdentity | $page, | ||
| CommentStoreComment | $comment, | ||
| $minor, | |||
| UserIdentity | $user ) |
Create a new dummy 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 replaced Revision::newNullRevision
| IDatabase | $dbw | used for obtaining the lock on the page table row |
| PageIdentity | $page | the page to read from |
| CommentStoreComment | $comment | RevisionRecord's summary |
| bool | $minor | Whether the revision should be considered as minor |
| UserIdentity | $user | The user to attribute the revision to |
Definition at line 980 of file RevisionStore.php.
References MediaWiki\Revision\MutableRevisionRecord\newFromParentRevision(), and Wikimedia\Rdbms\IReadableDatabase\newSelectQueryBuilder().
| MediaWiki\Revision\RevisionStore::newRevisionFromArchiveRow | ( | $row, | |
| $queryFlags = 0, | |||
| ?PageIdentity | $page = null, | ||
| array | $overrides = [] ) |
Make a fake RevisionRecord object from an archive table row.
This is queried for permissions or even inserted (as in Special:Undelete)
The user ID and user name may optionally be supplied using the aliases ar_user and ar_user_text (the names of fields which existed before MW 1.34).
MCR migration note: this replaced Revision::newFromArchiveRow
| \\stdClass | $row | |
| int | $queryFlags | |
| PageIdentity | null | $page | |
| 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. |
Implements MediaWiki\Revision\RevisionFactory.
Definition at line 1602 of file RevisionStore.php.
References newRevisionFromArchiveRowAndSlots().
| MediaWiki\Revision\RevisionStore::newRevisionFromArchiveRowAndSlots | ( | stdClass | $row, |
| $slots, | |||
| int | $queryFlags = 0, | ||
| ?PageIdentity | $page = null, | ||
| array | $overrides = [] ) |
| stdClass | $row | |
| null | stdClass[] | RevisionSlots | $slots | Database rows generated from a query based on getSlotsQueryInfo with the 'content' flag set, or a RevisionSlots instance |
| int | $queryFlags | |
| PageIdentity | null | $page | |
| 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. |
Definition at line 1648 of file RevisionStore.php.
Referenced by newRevisionFromArchiveRow(), and newRevisionsFromBatch().
| MediaWiki\Revision\RevisionStore::newRevisionFromRow | ( | $row, | |
| $queryFlags = 0, | |||
| ?PageIdentity | $page = null, | ||
| $fromCache = false ) |
MCR migration note: this replaced Revision::newFromRow
| \\stdClass | $row | A database row generated from a query based on RevisionSelectQueryBuilder |
| int | $queryFlags | |
| PageIdentity | null | $page | Preloaded page object |
| 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 1623 of file RevisionStore.php.
References newRevisionFromRowAndSlots().
Referenced by getKnownLatestRevision().
| MediaWiki\Revision\RevisionStore::newRevisionFromRowAndSlots | ( | stdClass | $row, |
| $slots, | |||
| int | $queryFlags = 0, | ||
| ?PageIdentity | $page = null, | ||
| bool | $fromCache = false ) |
| stdClass | $row | A database row generated from a query based on RevisionSelectQueryBuilder |
| null | stdClass[] | RevisionSlots | $slots | Database rows generated from a query based on getSlotsQueryInfo with the 'content' flag set, or a RevisionSlots instance |
| int | $queryFlags | |
| PageIdentity | null | $page | |
| bool | $fromCache | if true, the returned RevisionRecord will ensure that no stale data is returned from getters, by querying the database as needed |
| RevisionAccessException |
Definition at line 1722 of file RevisionStore.php.
Referenced by newRevisionFromRow(), and newRevisionsFromBatch().
| MediaWiki\Revision\RevisionStore::newRevisionsFromBatch | ( | $rows, | |
| array | $options = [], | ||
| $queryFlags = 0, | |||
| ?PageIdentity | $page = null ) |
Construct a RevisionRecord instance for each row in $rows, and return them as an associative array indexed by revision ID.
Use RevisionSelectQueryBuilder 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:
|
| int | $queryFlags | |
| PageIdentity | null | $page | The page to which all the revision rows belong, if there is such a page 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 Article Id associated with the page, an InvalidArgumentException is thrown. |
Definition at line 1934 of file RevisionStore.php.
References MediaWiki\Page\PageReference\getDBkey(), MediaWiki\Page\PageReference\getNamespace(), MediaWiki\Revision\SlotRecord\MAIN, MediaWiki\Deferred\LinksUpdate\GenericPageLinksTable\makeTitle(), newRevisionFromArchiveRowAndSlots(), and newRevisionFromRowAndSlots().
| MediaWiki\Revision\RevisionStore::newSelectQueryBuilder | ( | IReadableDatabase | $dbr | ) |
Return a SelectQueryBuilder to allow querying revision store.
| IReadableDatabase | $dbr | A db object to do the query on. |
Implements MediaWiki\Revision\RevisionFactory.
Definition at line 2502 of file RevisionStore.php.
References return.
Referenced by userWasLastToEdit().
| MediaWiki\Revision\RevisionStore::setLogger | ( | LoggerInterface | $logger | ) |
Definition at line 176 of file RevisionStore.php.
| MediaWiki\Revision\RevisionStore::updateSlotsOn | ( | RevisionRecord | $revision, |
| RevisionSlotsUpdate | $revisionSlotsUpdate, | ||
| IDatabase | $dbw ) |
Update derived slots in an existing revision into the database, returning the modified slots on success.
| RevisionRecord | $revision | After this method returns, the $revision object will be obsolete in that it does not have the new slots. |
| RevisionSlotsUpdate | $revisionSlotsUpdate | |
| IDatabase | $dbw | (primary connection) |
Definition at line 485 of file RevisionStore.php.
| MediaWiki\Revision\RevisionStore::userWasLastToEdit | ( | IReadableDatabase | $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 replaced Revision::userWasLastToEdit
| IReadableDatabase | $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 2907 of file RevisionStore.php.
References Wikimedia\Rdbms\IReadableDatabase\expr(), newSelectQueryBuilder(), and Wikimedia\Rdbms\Platform\ISQLPlatform\timestamp().
| const MediaWiki\Revision\RevisionStore::INCLUDE_BOTH = 'include_both' |
Definition at line 91 of file RevisionStore.php.
| const MediaWiki\Revision\RevisionStore::INCLUDE_DELETED_REVISIONS = 'include_deleted_revisions' |
Definition at line 92 of file RevisionStore.php.
| const MediaWiki\Revision\RevisionStore::INCLUDE_NEW = 'include_new' |
Definition at line 90 of file RevisionStore.php.
| const MediaWiki\Revision\RevisionStore::INCLUDE_OLD = 'include_old' |
Definition at line 89 of file RevisionStore.php.
| const MediaWiki\Revision\RevisionStore::ORDER_NEWEST_TO_OLDEST = 'DESC' |
Definition at line 86 of file RevisionStore.php.
| const MediaWiki\Revision\RevisionStore::ORDER_OLDEST_TO_NEWEST = 'ASC' |
Definition at line 85 of file RevisionStore.php.
| const MediaWiki\Revision\RevisionStore::ROW_CACHE_KEY = 'revision-row-1.29' |
Definition at line 83 of file RevisionStore.php.