38 use InvalidArgumentException;
60 use Psr\Log\LoggerAwareInterface;
61 use Psr\Log\LoggerInterface;
62 use Psr\Log\NullLogger;
71 use Wikimedia\Assert\Assert;
72 use Wikimedia\IPUtils;
211 $wikiId = WikiAwareEntity::LOCAL
213 Assert::parameterType(
'string|boolean',
$wikiId,
'$wikiId' );
226 $this->logger =
new NullLogger();
230 $this->hookRunner =
new HookRunner( $hookContainer );
241 return $this->blobStore->isReadOnly();
278 return $lb->getConnectionRef( $mode, $groups, $this->wikiId );
297 public function getTitle( $pageId, $revId, $queryFlags = self::READ_NORMAL ) {
299 if ( $this->wikiId !== WikiAwareEntity::LOCAL ) {
300 wfDeprecatedMsg(
'Using a Title object to refer to a page on another site.',
'1.36' );
303 $page = $this->
getPage( $pageId, $revId, $queryFlags );
305 return $this->titleFactory->castFromPageIdentity( $page );
318 private function getPage( ?
int $pageId, ?
int $revId,
int $queryFlags = self::READ_NORMAL ) {
319 if ( !$pageId && !$revId ) {
320 throw new InvalidArgumentException(
'$pageId and $revId cannot both be 0 or null' );
326 $queryFlags = self::READ_NORMAL;
330 if ( $pageId !==
null && $pageId > 0 ) {
331 $page = $this->pageStore->getPageById( $pageId, $queryFlags );
338 if ( $revId !==
null && $revId > 0 ) {
339 $pageQuery = $this->pageStore->newSelectQueryBuilder( $queryFlags )
340 ->join(
'revision',
null,
'page_id=rev_page' )
341 ->conds( [
'rev_id' => $revId ] )
342 ->caller( __METHOD__ );
344 $page = $pageQuery->fetchPageRecord();
351 if ( $queryFlags === self::READ_NORMAL ) {
352 $title = $this->
getPage( $pageId, $revId, self::READ_LATEST );
355 __METHOD__ .
' fell back to READ_LATEST and got a Title.',
356 [
'exception' =>
new RuntimeException() ]
363 'Could not determine title for page ID {page_id} and revision ID {rev_id}',
365 'page_id' => $pageId,
385 return $this->titleFactory->castFromPageIdentity( $page );
399 if ( $value ===
null ) {
401 "$name must not be " . var_export( $value,
true ) .
"!"
416 if ( $value ===
null || $value === 0 || $value ===
'' ) {
418 "$name must not be " . var_export( $value,
true ) .
"!"
438 $this->checkDatabaseDomain( $dbw );
445 'main slot must be provided'
450 $this->failOnNull( $rev->
getSize(),
'size field' );
451 $this->failOnEmpty( $rev->
getSha1(),
'sha1 field' );
452 $this->failOnEmpty( $rev->
getTimestamp(),
'timestamp field' );
455 $this->failOnNull( $user->getId(),
'user field' );
456 $this->failOnEmpty( $user->getName(),
'user_text field' );
468 Assert::precondition(
469 $mainSlot->getSize() === $rev->
getSize(),
470 'The revisions\'s size must match the main slot\'s size (see T239717)'
472 Assert::precondition(
473 $mainSlot->getSha1() === $rev->
getSha1(),
474 'The revisions\'s SHA1 hash must match the main slot\'s SHA1 hash (see T239717)'
478 $pageId = $this->failOnEmpty( $rev->
getPageId( $this->wikiId ),
'rev_page field' );
480 $parentId = $rev->
getParentId() ?? $this->getPreviousRevisionId( $dbw, $rev );
485 function (
IDatabase $dbw, $fname ) use (
492 return $this->insertRevisionInternal(
504 Assert::postcondition( $rev->
getId( $this->wikiId ) > 0,
'revision must have an ID' );
505 Assert::postcondition( $rev->
getPageId( $this->wikiId ) > 0,
'revision must have a page ID' );
506 Assert::postcondition(
508 'revision must have a comment'
510 Assert::postcondition(
512 'revision must have a user'
521 foreach ( $slotRoles as $role ) {
523 Assert::postcondition(
524 $slot->getContent() !==
null,
525 $role .
' slot must have content'
527 Assert::postcondition(
528 $slot->hasRevision(),
529 $role .
' slot must have a revision associated'
533 $this->hookRunner->onRevisionRecordInserted( $rev );
555 $this->checkDatabaseDomain( $dbw );
559 Assert::precondition(
560 $this->slotRoleRegistry->getRoleHandler( $role )->isDerived(),
561 'Trying to modify a slot that is not derived'
565 $isDerived = $this->slotRoleRegistry->getRoleHandler( $role )->isDerived();
566 Assert::precondition(
568 'Trying to remove a slot that is not derived'
570 throw new LogicException(
'Removing derived slots is not yet implemented. See T277394.' );
576 function ( IDatabase $dbw, $fname ) use (
580 return $this->updateSlotsInternal(
582 $revisionSlotsUpdate,
588 foreach ( $slotRecords as $role => $slot ) {
589 Assert::postcondition(
590 $slot->getContent() !==
null,
591 $role .
' slot must have content'
593 Assert::postcondition(
594 $slot->hasRevision(),
595 $role .
' slot must have a revision associated'
613 $page = $revision->getPage();
614 $revId = $revision->
getId( $this->wikiId );
616 BlobStore::PAGE_HINT => $page->
getId( $this->wikiId ),
617 BlobStore::REVISION_HINT => $revId,
618 BlobStore::PARENT_HINT => $revision->
getParentId( $this->wikiId ),
624 $newSlots[$role] = $this->insertSlotOn( $dbw, $revId, $slot, $page, $blobHints );
641 $revisionRow = $this->insertRevisionRowOn(
647 $revisionId = $revisionRow[
'rev_id'];
650 BlobStore::PAGE_HINT => $pageId,
651 BlobStore::REVISION_HINT => $revisionId,
652 BlobStore::PARENT_HINT => $parentId,
656 foreach ( $slotRoles as $role ) {
657 $slot = $rev->
getSlot( $role, RevisionRecord::RAW );
666 if ( $slot->hasRevision() && $slot->hasContentId() ) {
669 $slot->getRevision() === $revisionId,
670 'slot role ' . $slot->getRole(),
671 'Existing slot should belong to revision '
672 . $revisionId .
', but belongs to revision ' . $slot->getRevision() .
'!'
678 $newSlots[$role] = $slot;
680 $newSlots[$role] = $this->insertSlotOn( $dbw, $revisionId, $slot, $page, $blobHints );
684 $this->insertIpChangesRow( $dbw, $user, $rev, $revisionId );
690 (
object)$revisionRow,
711 array $blobHints = []
716 $blobAddress = $this->storeContentBlob( $protoSlot, $page, $blobHints );
724 $contentId = $this->insertContentRowOn( $protoSlot, $dbw, $blobAddress );
727 $this->insertSlotRowOn( $protoSlot, $dbw, $revisionId, $contentId );
729 return SlotRecord::newSaved(
750 if ( $user->
getId() === 0 && IPUtils::isValid( $user->
getName() ) ) {
752 'ipc_rev_id' => $revisionId,
754 'ipc_hex' => IPUtils::toHex( $user->
getName() ),
756 $dbw->
insert(
'ip_changes', $ipcRow, __METHOD__ );
775 $revisionRow = $this->getBaseRevisionRow( $dbw, $rev, $parentId );
777 list( $commentFields, $commentCallback ) =
778 $this->commentStore->insertWithTempTable(
783 $revisionRow += $commentFields;
785 list( $actorFields, $actorCallback ) =
786 $this->actorMigration->getInsertValuesWithTempTable(
789 $rev->
getUser( RevisionRecord::RAW )
791 $revisionRow += $actorFields;
793 $dbw->
insert(
'revision', $revisionRow, __METHOD__ );
795 if ( !isset( $revisionRow[
'rev_id'] ) ) {
797 $revisionRow[
'rev_id'] = intval( $dbw->
insertId() );
799 if ( $dbw->
getType() ===
'mysql' ) {
804 $maxRevId = intval( $dbw->
selectField(
'archive',
'MAX(ar_rev_id)',
'', __METHOD__ ) );
806 $maxRevId2 = intval( $dbw->
selectField(
'slots',
'MAX(slot_revision_id)',
'', __METHOD__ ) );
807 if ( $maxRevId2 >= $maxRevId ) {
808 $maxRevId = $maxRevId2;
812 if ( $maxRevId >= $revisionRow[
'rev_id'] ) {
813 $this->logger->debug(
814 '__METHOD__: Inserted revision {revid} but {table} has revisions up to {maxrevid}.'
815 .
' Trying to fix it.',
817 'revid' => $revisionRow[
'rev_id'],
819 'maxrevid' => $maxRevId,
823 if ( !$dbw->
lock(
'fix-for-T202032', __METHOD__ ) ) {
824 throw new MWException(
'Failed to get database lock for T202032' );
828 static function ( $trigger,
IDatabase $dbw ) use ( $fname ) {
829 $dbw->
unlock(
'fix-for-T202032', $fname );
834 $dbw->
delete(
'revision', [
'rev_id' => $revisionRow[
'rev_id'] ], __METHOD__ );
846 $dbw->
selectSQLText(
'archive', [
'v' =>
"MAX(ar_rev_id)" ],
'', __METHOD__ ) .
' FOR UPDATE',
851 $dbw->
selectSQLText(
'slots', [
'v' =>
"MAX(slot_revision_id)" ],
'', __METHOD__ )
858 $row1 ? intval( $row1->v ) : 0,
859 $row2 ? intval( $row2->v ) : 0
865 $revisionRow[
'rev_id'] = $maxRevId + 1;
866 $dbw->
insert(
'revision', $revisionRow, __METHOD__ );
871 $commentCallback( $revisionRow[
'rev_id'] );
872 $actorCallback( $revisionRow[
'rev_id'], $revisionRow );
891 'rev_page' => $rev->
getPageId( $this->wikiId ),
892 'rev_parent_id' => $parentId,
893 'rev_minor_edit' => $rev->
isMinor() ? 1 : 0,
900 if ( $rev->
getId( $this->wikiId ) !==
null ) {
902 $revisionRow[
'rev_id'] = $rev->
getId( $this->wikiId );
919 array $blobHints = []
922 $format =
$content->getDefaultFormat();
927 return $this->blobStore->storeBlob(
934 BlobStore::DESIGNATION_HINT =>
'page-content',
935 BlobStore::ROLE_HINT => $slot->
getRole(),
936 BlobStore::SHA1_HINT => $slot->
getSha1(),
937 BlobStore::MODEL_HINT => $model,
938 BlobStore::FORMAT_HINT => $format,
952 'slot_revision_id' => $revisionId,
953 'slot_role_id' => $this->slotRoleStore->acquireId( $slot->
getRole() ),
954 'slot_content_id' => $contentId,
959 $dbw->
insert(
'slots', $slotRow, __METHOD__ );
970 'content_size' => $slot->
getSize(),
971 'content_sha1' => $slot->
getSha1(),
972 'content_model' => $this->contentModelStore->acquireId( $slot->
getModel() ),
973 'content_address' => $blobAddress,
975 $dbw->
insert(
'content', $contentRow, __METHOD__ );
993 $format =
$content->getDefaultFormat();
994 $handler =
$content->getContentHandler();
996 if ( !$handler->isSupportedFormat( $format ) ) {
998 "Can't use format $format with content model $model on $page role $role"
1004 "New content for $page role $role is not valid! Content model is $model"
1041 $this->checkDatabaseDomain( $dbw );
1043 $pageId = $this->getArticleId( $page );
1051 [
'page_id' => $pageId ],
1056 if ( !$pageLatest ) {
1057 $msg =
'T235589: Failed to select table row during null revision creation' .
1058 " Page id '$pageId' does not exist.";
1059 $this->logger->error(
1061 [
'exception' =>
new RuntimeException( $msg ) ]
1068 $oldRevision = $this->loadRevisionFromConds(
1070 [
'rev_id' => intval( $pageLatest ) ],
1075 if ( !$oldRevision ) {
1076 $msg =
"Failed to load latest revision ID $pageLatest of page ID $pageId.";
1077 $this->logger->error(
1079 [
'exception' =>
new RuntimeException( $msg ) ]
1085 $timestamp = MWTimestamp::now( TS_MW );
1086 $newRevision = MutableRevisionRecord::newFromParentRevision( $oldRevision );
1088 $newRevision->setComment( $comment );
1089 $newRevision->setUser( $user );
1090 $newRevision->setTimestamp( $timestamp );
1091 $newRevision->setMinorEdit( $minor );
1093 return $newRevision;
1106 $rc = $this->getRecentChange( $rev );
1108 return $rc->getAttribute(
'rc_id' );
1131 [
'rc_this_oldid' => $rev->
getId( $this->wikiId ) ],
1161 ?
string $blobData =
null,
1162 ?
string $blobFlags =
null,
1163 ?
string $blobFormat =
null,
1166 if ( $blobData !==
null ) {
1169 if ( $blobFlags ===
null ) {
1173 $data = $this->blobStore->expandBlob( $blobData, $blobFlags, $cacheKey );
1174 if ( $data ===
false ) {
1176 'Failed to expand blob data using flags {flags} (key: {cache_key})',
1178 'flags' => $blobFlags,
1179 'cache_key' => $cacheKey,
1188 $data = $this->blobStore->getBlob( $address, $queryFlags );
1191 'Failed to load data blob from {address}'
1192 .
'If this problem persist, use the findBadBlobs maintenance script '
1193 .
'to investigate the issue and mark bad blobs.',
1194 [
'address' => $e->getMessage() ],
1204 if ( !$this->contentHandlerFactory->isDefinedModel( $model ) ) {
1205 $this->logger->warning(
1206 "Undefined content model '$model', falling back to UnknownContent",
1210 'role_name' => $slot->
getRole(),
1211 'model_name' => $model,
1212 'exception' =>
new RuntimeException()
1219 return $this->contentHandlerFactory
1220 ->getContentHandler( $model )
1221 ->unserializeContent( $data, $blobFormat );
1242 return $this->newRevisionFromConds( [
'rev_id' => intval( $id ) ], $flags, $page );
1278 $conds[
'rev_id'] = $revId;
1279 return $this->newRevisionFromConds( $conds, $flags, $page );
1286 $db = $this->getDBConnectionRefForQueryFlags( $flags );
1287 $conds[] =
'rev_id=page_latest';
1288 return $this->loadRevisionFromConds( $db, $conds, $flags, $page );
1309 $conds = [
'page_id' => $pageId ];
1316 $conds[
'rev_id'] = $revId;
1317 return $this->newRevisionFromConds( $conds, $flags );
1324 $db = $this->getDBConnectionRefForQueryFlags( $flags );
1326 $conds[] =
'rev_id=page_latest';
1328 return $this->loadRevisionFromConds( $db, $conds, $flags );
1350 int $flags = IDBAccessObject::READ_NORMAL
1356 $db = $this->getDBConnectionRefForQueryFlags( $flags );
1357 return $this->newRevisionFromConds(
1359 'rev_timestamp' => $db->timestamp( $timestamp ),
1378 $res = $this->loadSlotRecordsFromDb( $revId, $queryFlags, $page );
1379 return $this->constructSlotRecords( $revId,
$res, $queryFlags, $page );
1383 $res = $this->localCache->getWithSetCallback(
1384 $this->localCache->makeKey(
1390 $this->localCache::TTL_HOUR,
1391 function () use ( $revId, $queryFlags, $page ) {
1392 return $this->cache->getWithSetCallback(
1393 $this->cache->makeKey(
1399 WANObjectCache::TTL_DAY,
1400 function () use ( $revId, $queryFlags, $page ) {
1401 $res = $this->loadSlotRecordsFromDb( $revId, $queryFlags, $page );
1415 return $this->constructSlotRecords( $revId,
$res, $queryFlags, $page );
1419 $revQuery = $this->getSlotsQueryInfo( [
'content' ] );
1422 $db = $this->getDBConnectionRef( $dbMode );
1428 'slot_revision_id' => $revId,
1435 if ( !
$res->numRows() && !( $queryFlags & self::READ_LATEST ) ) {
1437 $this->logger->info(
1438 __METHOD__ .
' falling back to READ_LATEST.',
1441 'exception' =>
new RuntimeException(),
1444 return $this->loadSlotRecordsFromDb(
1446 $queryFlags | self::READ_LATEST,
1450 return iterator_to_array(
$res );
1470 $slotContents =
null
1474 foreach ( $slotRows as $row ) {
1476 if ( !isset( $row->role_name ) ) {
1477 $row->role_name = $this->slotRoleStore->getName( (
int)$row->slot_role_id );
1480 if ( !isset( $row->model_name ) ) {
1481 if ( isset( $row->content_model ) ) {
1482 $row->model_name = $this->contentModelStore->getName( (
int)$row->content_model );
1486 $slotRoleHandler = $this->slotRoleRegistry->getRoleHandler( $row->role_name );
1487 $row->model_name = $slotRoleHandler->getDefaultModel( $page );
1492 if ( isset( $row->blob_data ) ) {
1493 $slotContents[$row->content_address] = $row->blob_data;
1496 $contentCallback =
function (
SlotRecord $slot ) use ( $slotContents, $queryFlags ) {
1498 if ( isset( $slotContents[$slot->getAddress()] ) ) {
1499 $blob = $slotContents[$slot->getAddress()];
1504 return $this->loadSlotContent( $slot,
$blob,
null,
null, $queryFlags );
1507 $slots[$row->role_name] =
new SlotRecord( $row, $contentCallback );
1510 if ( !isset( $slots[SlotRecord::MAIN] ) ) {
1511 $this->logger->error(
1512 __METHOD__ .
': Main slot of revision not found in database. See T212428.',
1515 'queryFlags' => $queryFlags,
1516 'exception' =>
new RuntimeException(),
1521 'Main slot of revision not found in database. See T212428.'
1552 $this->constructSlotRecords( $revId, $slotRows, $queryFlags, $page )
1555 $slots =
new RevisionSlots(
function () use( $revId, $queryFlags, $page ) {
1556 return $this->loadSlotRecords( $revId, $queryFlags, $page );
1588 array $overrides = []
1590 return $this->newRevisionFromArchiveRowAndSlots( $row,
null, $queryFlags, $page, $overrides );
1611 return $this->newRevisionFromRowAndSlots( $row,
null, $queryFlags, $page, $fromCache );
1636 int $queryFlags = 0,
1638 array $overrides = []
1640 if ( !$page && isset( $overrides[
'title'] ) ) {
1641 if ( !( $overrides[
'title'] instanceof
PageIdentity ) ) {
1642 throw new MWException(
'title field override must contain a PageIdentity object.' );
1645 $page = $overrides[
'title'];
1648 if ( !isset( $page ) ) {
1649 if ( isset( $row->ar_namespace ) && isset( $row->ar_title ) ) {
1652 throw new InvalidArgumentException(
1653 'A Title or ar_namespace and ar_title must be given'
1658 foreach ( $overrides as $key => $value ) {
1660 $row->$field = $value;
1664 $user = $this->actorStore->newActorFromRowFields(
1665 $row->ar_user ??
null,
1666 $row->ar_user_text ??
null,
1667 $row->ar_actor ??
null
1669 }
catch ( InvalidArgumentException $ex ) {
1670 $this->logger->warning(
'Could not load user for archive revision {rev_id}', [
1671 'ar_rev_id' => $row->ar_rev_id,
1672 'ar_actor' => $row->ar_actor ??
'null',
1673 'ar_user_text' => $row->ar_user_text ??
'null',
1674 'ar_user' => $row->ar_user ??
'null',
1677 $user = $this->actorStore->getUnknownActor();
1680 $db = $this->getDBConnectionRefForQueryFlags( $queryFlags );
1682 $comment = $this->commentStore->getCommentLegacy( $db,
'ar_comment', $row,
true );
1685 $slots = $this->newRevisionSlots( $row->ar_rev_id, $row, $slots, $queryFlags, $page );
1711 int $queryFlags = 0,
1713 bool $fromCache =
false
1716 if ( isset( $row->page_id )
1717 && isset( $row->page_namespace )
1718 && isset( $row->page_title )
1722 (
int)$row->page_namespace,
1727 $page = $this->wrapPage( $page );
1729 $pageId = (int)( $row->rev_page ?? 0 );
1730 $revId = (int)( $row->rev_id ?? 0 );
1732 $page = $this->getPage( $pageId, $revId, $queryFlags );
1735 $page = $this->ensureRevisionRowMatchesPage( $row, $page );
1742 "Failed to determine page associated with revision {$row->rev_id}"
1747 $user = $this->actorStore->newActorFromRowFields(
1748 $row->rev_user ??
null,
1749 $row->rev_user_text ??
null,
1750 $row->rev_actor ??
null
1752 }
catch ( InvalidArgumentException $ex ) {
1753 $this->logger->warning(
'Could not load user for revision {rev_id}', [
1754 'rev_id' => $row->rev_id,
1755 'rev_actor' => $row->rev_actor ??
'null',
1756 'rev_user_text' => $row->rev_user_text ??
'null',
1757 'rev_user' => $row->rev_user ??
'null',
1760 $user = $this->actorStore->getUnknownActor();
1763 $db = $this->getDBConnectionRefForQueryFlags( $queryFlags );
1765 $comment = $this->commentStore->getCommentLegacy( $db,
'rev_comment', $row,
true );
1768 $slots = $this->newRevisionSlots( $row->rev_id, $row, $slots, $queryFlags, $page );
1774 function ( $revId ) use ( $queryFlags ) {
1775 $db = $this->getDBConnectionRefForQueryFlags( $queryFlags );
1776 $row = $this->fetchRevisionRowFromConds(
1778 [
'rev_id' => intval( $revId ) ]
1780 if ( !$row && !( $queryFlags & self::READ_LATEST ) ) {
1782 $this->logger->info(
1783 'RevisionStoreCacheRecord refresh callback falling back to READ_LATEST.',
1786 'exception' =>
new RuntimeException(),
1789 $dbw = $this->getDBConnectionRefForQueryFlags( self::READ_LATEST );
1790 $row = $this->fetchRevisionRowFromConds(
1792 [
'rev_id' => intval( $revId ) ]
1796 return [
null, null ];
1800 $this->actorStore->newActorFromRowFields(
1801 $row->rev_user ??
null,
1802 $row->rev_user_text ??
null,
1803 $row->rev_actor ??
null
1807 $page, $user, $comment, $row, $slots, $this->wikiId
1811 $page, $user, $comment, $row, $slots, $this->wikiId );
1828 $revId = (int)( $row->rev_id ?? 0 );
1829 $revPageId = (int)( $row->rev_page ?? 0 );
1830 $expectedPageId = $page->
getId( $this->wikiId );
1832 if ( $revPageId && $expectedPageId && $revPageId !== $expectedPageId ) {
1834 $pageRec = $this->pageStore->getPageByName(
1837 PageStore::READ_LATEST
1839 $masterPageId = $pageRec->getId( $this->wikiId );
1840 $masterLatest = $pageRec->getLatest( $this->wikiId );
1841 if ( $revPageId === $masterPageId ) {
1842 if ( $page instanceof
Title ) {
1845 $page->resetArticleID( $masterPageId );
1851 $this->logger->info(
1852 "Encountered stale Title object",
1854 'page_id_stale' => $expectedPageId,
1855 'page_id_reloaded' => $masterPageId,
1856 'page_latest' => $masterLatest,
1858 'exception' =>
new RuntimeException(),
1862 $expectedTitle = (string)$page;
1863 if ( $page instanceof
Title ) {
1865 $page = $this->titleFactory->newFromID( $revPageId );
1876 $this->logger->error(
1877 "Encountered mismatching Title object (see T259022, T268910, T279832, T263340)",
1879 'expected_page_id' => $masterPageId,
1880 'expected_page_title' => $expectedTitle,
1881 'rev_page' => $revPageId,
1882 'rev_page_title' => (
string)$page,
1883 'page_latest' => $masterLatest,
1885 'exception' =>
new RuntimeException(),
1922 array $options = [],
1927 $archiveMode = $options[
'archive'] ??
false;
1929 if ( $archiveMode ) {
1930 $revIdField =
'ar_rev_id';
1932 $revIdField =
'rev_id';
1936 $pageIdsToFetchTitles = [];
1937 $titlesByPageKey = [];
1938 foreach ( $rows as $row ) {
1939 if ( isset( $rowsByRevId[$row->$revIdField] ) ) {
1941 'internalerror_info',
1942 "Duplicate rows in newRevisionsFromBatch, $revIdField {$row->$revIdField}"
1948 $archiveMode ? $row->ar_namespace .
':' . $row->ar_title : $row->rev_page;
1951 if ( !$archiveMode && $row->rev_page != $this->getArticleId( $page ) ) {
1952 throw new InvalidArgumentException(
1953 "Revision {$row->$revIdField} doesn't belong to page "
1954 . $this->getArticleId( $page )
1960 || $row->ar_title !== $page->
getDBkey() )
1962 throw new InvalidArgumentException(
1963 "Revision {$row->$revIdField} doesn't belong to page "
1967 } elseif ( !isset( $titlesByPageKey[ $row->_page_key ] ) ) {
1968 if ( isset( $row->page_namespace ) && isset( $row->page_title )
1971 && isset( $row->page_id ) && isset( $row->rev_page )
1972 && $row->rev_page === $row->page_id
1975 } elseif ( $archiveMode ) {
1977 $titlesByPageKey[ $row->_page_key ] =
1980 $pageIdsToFetchTitles[] = $row->rev_page;
1983 $rowsByRevId[$row->$revIdField] = $row;
1986 if ( empty( $rowsByRevId ) ) {
1987 $result->setResult(
true, [] );
1994 $pageKey = $archiveMode
1996 : $this->getArticleId( $page );
1998 $titlesByPageKey[$pageKey] = $page;
1999 } elseif ( !empty( $pageIdsToFetchTitles ) ) {
2002 Assert::invariant( !$archiveMode,
'Titles are not loaded by ID in archive mode.' );
2004 $pageIdsToFetchTitles = array_unique( $pageIdsToFetchTitles );
2005 $pageRecords = $this->pageStore
2006 ->newSelectQueryBuilder()
2007 ->wherePageIds( $pageIdsToFetchTitles )
2008 ->caller( __METHOD__ )
2009 ->fetchPageRecordArray();
2011 $titlesByPageKey = $pageRecords + $titlesByPageKey;
2015 $newRevisionRecord = [
2017 $archiveMode ?
'newRevisionFromArchiveRowAndSlots' :
'newRevisionFromRowAndSlots'
2020 if ( !isset( $options[
'slots'] ) ) {
2024 static function ( $row )
2025 use ( $queryFlags, $titlesByPageKey, $result, $newRevisionRecord, $revIdField ) {
2027 if ( !isset( $titlesByPageKey[$row->_page_key] ) ) {
2029 'internalerror_info',
2030 "Couldn't find title for rev {$row->$revIdField} "
2031 .
"(page key {$row->_page_key})"
2035 return $newRevisionRecord( $row,
null, $queryFlags,
2036 $titlesByPageKey[ $row->_page_key ] );
2038 $result->warning(
'internalerror_info', $e->getMessage() );
2049 'slots' => $options[
'slots'] ??
true,
2050 'blobs' => $options[
'content'] ??
false,
2053 if ( is_array( $slotRowOptions[
'slots'] )
2054 && !in_array( SlotRecord::MAIN, $slotRowOptions[
'slots'] )
2057 $slotRowOptions[
'slots'][] = SlotRecord::MAIN;
2060 $slotRowsStatus = $this->getSlotRowsForBatch( $rowsByRevId, $slotRowOptions, $queryFlags );
2062 $result->merge( $slotRowsStatus );
2063 $slotRowsByRevId = $slotRowsStatus->getValue();
2069 use ( $slotRowsByRevId, $queryFlags, $titlesByPageKey, $result,
2070 $revIdField, $newRevisionRecord
2072 if ( !isset( $slotRowsByRevId[$row->$revIdField] ) ) {
2074 'internalerror_info',
2075 "Couldn't find slots for rev {$row->$revIdField}"
2079 if ( !isset( $titlesByPageKey[$row->_page_key] ) ) {
2081 'internalerror_info',
2082 "Couldn't find title for rev {$row->$revIdField} "
2083 .
"(page key {$row->_page_key})"
2088 return $newRevisionRecord(
2091 $this->constructSlotRecords(
2093 $slotRowsByRevId[$row->$revIdField],
2095 $titlesByPageKey[$row->_page_key]
2099 $titlesByPageKey[$row->_page_key]
2102 $result->warning(
'internalerror_info', $e->getMessage() );
2137 array $options = [],
2143 foreach ( $rowsOrIds as $row ) {
2144 if ( is_object( $row ) ) {
2145 $revIds[] = isset( $row->ar_rev_id ) ? (int)$row->ar_rev_id : (
int)$row->rev_id;
2147 $revIds[] = (int)$row;
2153 if ( empty( $revIds ) ) {
2154 $result->setResult(
true, [] );
2159 $slotQueryInfo = $this->getSlotsQueryInfo( [
'content' ] );
2160 $revIdField = $slotQueryInfo[
'keys'][
'rev_id'];
2161 $slotQueryConds = [ $revIdField => $revIds ];
2163 if ( isset( $options[
'slots'] ) && is_array( $options[
'slots'] ) ) {
2164 if ( empty( $options[
'slots'] ) ) {
2166 $result->setResult(
true, array_fill_keys( $revIds, [] ) );
2170 $roleIdField = $slotQueryInfo[
'keys'][
'role_id'];
2171 $slotQueryConds[$roleIdField] = array_map(
2172 [ $this->slotRoleStore,
'getId' ],
2177 $db = $this->getDBConnectionRefForQueryFlags( $queryFlags );
2178 $slotRows = $db->select(
2179 $slotQueryInfo[
'tables'],
2180 $slotQueryInfo[
'fields'],
2184 $slotQueryInfo[
'joins']
2187 $slotContents =
null;
2188 if ( $options[
'blobs'] ??
false ) {
2189 $blobAddresses = [];
2190 foreach ( $slotRows as $slotRow ) {
2191 $blobAddresses[] = $slotRow->content_address;
2193 $slotContentFetchStatus = $this->blobStore
2194 ->getBlobBatch( $blobAddresses, $queryFlags );
2195 foreach ( $slotContentFetchStatus->getErrors() as $error ) {
2196 $result->warning( $error[
'message'], ...$error[
'params'] );
2198 $slotContents = $slotContentFetchStatus->getValue();
2201 $slotRowsByRevId = [];
2202 foreach ( $slotRows as $slotRow ) {
2203 if ( $slotContents ===
null ) {
2205 } elseif ( isset( $slotContents[$slotRow->content_address] ) ) {
2206 $slotRow->blob_data = $slotContents[$slotRow->content_address];
2209 'internalerror_info',
2210 "Couldn't find blob data for rev {$slotRow->slot_revision_id}"
2212 $slotRow->blob_data =
null;
2216 if ( !isset( $slotRow->role_name ) && isset( $slotRow->slot_role_id ) ) {
2217 $slotRow->role_name = $this->slotRoleStore->getName( (
int)$slotRow->slot_role_id );
2221 if ( !isset( $slotRow->model_name ) && isset( $slotRow->content_model ) ) {
2222 $slotRow->model_name = $this->contentModelStore->getName( (
int)$slotRow->content_model );
2225 $slotRowsByRevId[$slotRow->slot_revision_id][$slotRow->role_name] = $slotRow;
2228 $result->setResult(
true, $slotRowsByRevId );
2257 $result = $this->getSlotRowsForBatch(
2259 [
'slots' => $slots,
'blobs' =>
true ],
2263 if ( $result->isOK() ) {
2265 foreach ( $result->value as $revId => $rowsByRole ) {
2266 foreach ( $rowsByRole as $role => $slotRow ) {
2267 if ( is_array( $slots ) && !in_array( $role, $slots ) ) {
2270 unset( $result->value[$revId][$role] );
2274 $result->value[$revId][$role] = (object)[
2275 'blob_data' => $slotRow->blob_data,
2276 'model_name' => $slotRow->model_name,
2303 int $flags = IDBAccessObject::READ_NORMAL,
2307 $db = $this->getDBConnectionRefForQueryFlags( $flags );
2308 $rev = $this->loadRevisionFromConds( $db, $conditions, $flags, $page, $options );
2310 $lb = $this->getDBLoadBalancer();
2315 && !( $flags & self::READ_LATEST )
2316 && $lb->hasStreamingReplicaServers()
2317 && $lb->hasOrMadeRecentPrimaryChanges()
2319 $flags = self::READ_LATEST;
2320 $dbw = $this->getDBConnectionRef(
DB_PRIMARY );
2321 $rev = $this->loadRevisionFromConds( $dbw, $conditions, $flags, $page, $options );
2344 int $flags = IDBAccessObject::READ_NORMAL,
2348 $row = $this->fetchRevisionRowFromConds( $db, $conditions, $flags, $options );
2350 return $this->newRevisionFromRow( $row, $flags, $page );
2365 $storeDomain = $this->loadBalancer->resolveDomainID( $this->wikiId );
2366 if ( $dbDomain === $storeDomain ) {
2370 throw new MWException(
"DB connection domain '$dbDomain' does not match '$storeDomain'" );
2389 int $flags = IDBAccessObject::READ_NORMAL,
2392 $this->checkDatabaseDomain( $db );
2394 $revQuery = $this->getQueryInfo( [
'page',
'user' ] );
2395 if ( ( $flags & self::READ_LOCKING ) == self::READ_LOCKING ) {
2396 $options[] =
'FOR UPDATE';
2436 $ret[
'tables'][] =
'revision';
2437 $ret[
'fields'] = array_merge( $ret[
'fields'], [
2448 $commentQuery = $this->commentStore->getJoin(
'rev_comment' );
2449 $ret[
'tables'] = array_merge( $ret[
'tables'], $commentQuery[
'tables'] );
2450 $ret[
'fields'] = array_merge( $ret[
'fields'], $commentQuery[
'fields'] );
2451 $ret[
'joins'] = array_merge( $ret[
'joins'], $commentQuery[
'joins'] );
2453 $actorQuery = $this->actorMigration->getJoin(
'rev_user' );
2454 $ret[
'tables'] = array_merge( $ret[
'tables'], $actorQuery[
'tables'] );
2455 $ret[
'fields'] = array_merge( $ret[
'fields'], $actorQuery[
'fields'] );
2456 $ret[
'joins'] = array_merge( $ret[
'joins'], $actorQuery[
'joins'] );
2458 if ( in_array(
'page', $options,
true ) ) {
2459 $ret[
'tables'][] =
'page';
2460 $ret[
'fields'] = array_merge( $ret[
'fields'], [
2468 $ret[
'joins'][
'page'] = [
'JOIN', [
'page_id = rev_page' ] ];
2471 if ( in_array(
'user', $options,
true ) ) {
2472 $ret[
'tables'][] =
'user';
2473 $ret[
'fields'] = array_merge( $ret[
'fields'], [
2476 $u = $actorQuery[
'fields'][
'rev_user'];
2477 $ret[
'joins'][
'user'] = [
'LEFT JOIN', [
"$u != 0",
"user_id = $u" ] ];
2480 if ( in_array(
'text', $options,
true ) ) {
2481 throw new InvalidArgumentException(
2482 'The `text` option is no longer supported in MediaWiki 1.35 and later.'
2517 $ret[
'keys'][
'rev_id'] =
'slot_revision_id';
2518 $ret[
'keys'][
'role_id'] =
'slot_role_id';
2520 $ret[
'tables'][] =
'slots';
2521 $ret[
'fields'] = array_merge( $ret[
'fields'], [
2528 if ( in_array(
'role', $options,
true ) ) {
2531 $ret[
'tables'][] =
'slot_roles';
2532 $ret[
'joins'][
'slot_roles'] = [
'LEFT JOIN', [
'slot_role_id = role_id' ] ];
2533 $ret[
'fields'][] =
'role_name';
2536 if ( in_array(
'content', $options,
true ) ) {
2537 $ret[
'keys'][
'model_id'] =
'content_model';
2539 $ret[
'tables'][] =
'content';
2540 $ret[
'fields'] = array_merge( $ret[
'fields'], [
2546 $ret[
'joins'][
'content'] = [
'JOIN', [
'slot_content_id = content_id' ] ];
2548 if ( in_array(
'model', $options,
true ) ) {
2551 $ret[
'tables'][] =
'content_models';
2552 $ret[
'joins'][
'content_models'] = [
'LEFT JOIN', [
'content_model = model_id' ] ];
2553 $ret[
'fields'][] =
'model_name';
2570 if ( !( $row instanceof stdClass ) ) {
2573 $queryInfo = $table ===
'archive' ? $this->getArchiveQueryInfo() : $this->getQueryInfo();
2574 foreach ( $queryInfo[
'fields'] as $alias => $field ) {
2575 $name = is_numeric( $alias ) ? $field : $alias;
2576 if ( !property_exists( $row, $name ) ) {
2601 $commentQuery = $this->commentStore->getJoin(
'ar_comment' );
2605 'archive_actor' =>
'actor'
2606 ] + $commentQuery[
'tables'],
2620 'ar_user' =>
'archive_actor.actor_user',
2621 'ar_user_text' =>
'archive_actor.actor_name',
2622 ] + $commentQuery[
'fields'],
2624 'archive_actor' => [
'JOIN',
'actor_id=ar_actor' ]
2625 ] + $commentQuery[
'joins'],
2649 [
'rev_id',
'rev_len' ],
2650 [
'rev_id' => $revIds ],
2654 foreach (
$res as $row ) {
2655 $revLens[$row->rev_id] = intval( $row->rev_len );
2670 $op = $dir ===
'next' ?
'>' :
'<';
2671 $sort = $dir ===
'next' ?
'ASC' :
'DESC';
2673 $revisionIdValue = $rev->
getId( $this->wikiId );
2675 if ( !$revisionIdValue || !$rev->
getPageId( $this->wikiId ) ) {
2686 $db = $this->getDBConnectionRef( $dbType, [
'contributions' ] );
2689 if ( $ts ===
null ) {
2690 $ts = $this->getTimestampFromId( $revisionIdValue, $flags );
2692 if ( $ts ===
false ) {
2694 $ts = $db->selectField(
'archive',
'ar_timestamp',
2695 [
'ar_rev_id' => $revisionIdValue ], __METHOD__ );
2696 if ( $ts ===
false ) {
2701 $dbts = $db->addQuotes( $db->timestamp( $ts ) );
2703 $revId = $db->selectField(
'revision',
'rev_id',
2705 'rev_page' => $rev->
getPageId( $this->wikiId ),
2706 "rev_timestamp $op $dbts OR (rev_timestamp = $dbts AND rev_id $op $revisionIdValue )"
2710 'ORDER BY' => [
"rev_timestamp $sort",
"rev_id $sort" ],
2711 'IGNORE INDEX' =>
'rev_timestamp',
2715 if ( $revId ===
false ) {
2719 return $this->getRevisionById( intval( $revId ), $flags );
2737 return $this->getRelativeRevision( $rev, $flags,
'prev' );
2752 return $this->getRelativeRevision( $rev, $flags,
'next' );
2767 $this->checkDatabaseDomain( $db );
2769 if ( $rev->
getPageId( $this->wikiId ) ===
null ) {
2772 # Use page_latest if ID is not given
2773 if ( !$rev->
getId( $this->wikiId ) ) {
2775 'page',
'page_latest',
2776 [
'page_id' => $rev->
getPageId( $this->wikiId ) ],
2781 'revision',
'rev_id',
2782 [
'rev_page' => $rev->
getPageId( $this->wikiId ),
'rev_id < ' . $rev->
getId( $this->wikiId ) ],
2784 [
'ORDER BY' =>
'rev_id DESC' ]
2787 return intval( $prevId );
2803 if ( $id instanceof
Title ) {
2806 $flags = func_num_args() > 2 ? func_get_arg( 2 ) : 0;
2814 if ( $id ===
null || $id <= 0 ) {
2818 $db = $this->getDBConnectionRefForQueryFlags( $flags );
2821 $db->selectField(
'revision',
'rev_timestamp', [
'rev_id' => $id ], __METHOD__ );
2823 return ( $timestamp !==
false ) ? MWTimestamp::convert( TS_MW, $timestamp ) :
false;
2836 $this->checkDatabaseDomain( $db );
2839 [
'revCount' =>
'COUNT(*)' ],
2840 [
'rev_page' => $id ],
2844 return intval( $row->revCount );
2859 $id = $this->getArticleId( $page );
2861 return $this->countRevisionsByPageId( $db, $id );
2885 $this->checkDatabaseDomain( $db );
2895 'rev_user' =>
$revQuery[
'fields'][
'rev_user'],
2898 'rev_page' => $pageId,
2902 [
'ORDER BY' =>
'rev_timestamp ASC',
'LIMIT' => 50 ],
2905 foreach (
$res as $row ) {
2906 if ( $row->rev_user != $userId ) {
2927 $db = $this->getDBConnectionRef(
DB_REPLICA );
2928 $revIdPassed = $revId;
2929 $pageId = $this->getArticleId( $page );
2935 if ( $page instanceof
Title ) {
2936 $revId = $page->getLatestRevID();
2938 $pageRecord = $this->pageStore->getPageByReference( $page );
2939 if ( $pageRecord ) {
2940 $revId = $pageRecord->getLatest( $this->getWikiId() );
2946 $this->logger->warning(
2947 'No latest revision known for page {page} even though it exists with page ID {page_id}', [
2949 'page_id' => $pageId,
2950 'wiki_id' => $this->getWikiId() ?:
'local',
2959 $row = $this->cache->getWithSetCallback(
2961 $this->getRevisionRowCacheKey( $db, $pageId, $revId ),
2962 WANObjectCache::TTL_WEEK,
2963 function ( $curValue, &$ttl, array &$setOpts ) use (
2964 $db, $revId, &$fromCache
2966 $setOpts += Database::getCacheSetOptions( $db );
2967 $row = $this->fetchRevisionRowFromConds( $db, [
'rev_id' => intval( $revId ) ] );
2977 $title = $this->ensureRevisionRowMatchesPage( $row, $page, [
2978 'from_cache_flag' => $fromCache,
2979 'page_id_initial' => $pageId,
2980 'rev_id_used' => $revId,
2981 'rev_id_requested' => $revIdPassed,
2984 return $this->newRevisionFromRow( $row, 0,
$title, $fromCache );
3000 int $flags = IDBAccessObject::READ_NORMAL
3006 return $this->newRevisionFromConds(
3014 'ORDER BY' => [
'rev_timestamp ASC',
'rev_id ASC' ],
3015 'IGNORE INDEX' => [
'revision' =>
'rev_timestamp' ],
3032 return $this->cache->makeGlobalKey(
3033 self::ROW_CACHE_KEY,
3049 if ( $rev->getId( $this->wikiId ) ===
null ) {
3050 throw new InvalidArgumentException(
"Unsaved {$paramName} revision passed" );
3052 if ( $rev->getPageId( $this->wikiId ) !== $pageId ) {
3053 throw new InvalidArgumentException(
3054 "Revision {$rev->getId( $this->wikiId )} doesn't belong to page {$pageId}"
3080 $options = (array)$options;
3083 if ( in_array( self::INCLUDE_OLD, $options ) ) {
3086 if ( in_array( self::INCLUDE_NEW, $options ) ) {
3089 if ( in_array( self::INCLUDE_BOTH, $options ) ) {
3096 $oldTs =
$dbr->addQuotes(
$dbr->timestamp( $old->getTimestamp() ) );
3097 $conds[] =
"(rev_timestamp = {$oldTs} AND rev_id {$oldCmp} {$old->getId( $this->wikiId )}) " .
3098 "OR rev_timestamp > {$oldTs}";
3101 $newTs =
$dbr->addQuotes(
$dbr->timestamp( $new->getTimestamp() ) );
3102 $conds[] =
"(rev_timestamp = {$newTs} AND rev_id {$newCmp} {$new->getId( $this->wikiId )}) " .
3103 "OR rev_timestamp < {$newTs}";
3140 ?
string $order =
null,
3141 int $flags = IDBAccessObject::READ_NORMAL
3143 $this->assertRevisionParameter(
'old', $pageId, $old );
3144 $this->assertRevisionParameter(
'new', $pageId, $new );
3146 $options = (array)$options;
3147 $includeOld = in_array( self::INCLUDE_OLD, $options ) ||
3148 in_array( self::INCLUDE_BOTH, $options );
3149 $includeNew = in_array( self::INCLUDE_NEW, $options ) ||
3150 in_array( self::INCLUDE_BOTH, $options );
3156 if ( $old && $new && $new->getId( $this->wikiId ) === $old->getId( $this->wikiId ) ) {
3157 return $includeOld || $includeNew ? [ $new->getId( $this->wikiId ) ] : [];
3160 $db = $this->getDBConnectionRefForQueryFlags( $flags );
3161 $conds = array_merge(
3163 'rev_page' => $pageId,
3164 $db->bitAnd(
'rev_deleted', RevisionRecord::DELETED_TEXT ) .
' = 0'
3166 $this->getRevisionLimitConditions( $db, $old, $new, $options )
3170 if ( $order !==
null ) {
3171 $queryOptions[
'ORDER BY'] = [
"rev_timestamp $order",
"rev_id $order" ];
3173 if ( $max !==
null ) {
3174 $queryOptions[
'LIMIT'] = $max + 1;
3177 $values = $db->selectFieldValues(
3184 return array_map(
'intval', $values );
3216 $this->assertRevisionParameter(
'old', $pageId, $old );
3217 $this->assertRevisionParameter(
'new', $pageId, $new );
3218 $options = (array)$options;
3224 if ( $old && $new && $new->getId( $this->wikiId ) === $old->getId( $this->wikiId ) ) {
3225 if ( empty( $options ) ) {
3227 } elseif ( $performer ) {
3228 return [ $new->getUser( RevisionRecord::FOR_THIS_USER, $performer ) ];
3230 return [ $new->getUser() ];
3235 $conds = array_merge(
3237 'rev_page' => $pageId,
3238 $dbr->bitAnd(
'rev_deleted', RevisionRecord::DELETED_USER ) .
" = 0"
3240 $this->getRevisionLimitConditions(
$dbr, $old, $new, $options )
3243 $queryOpts = [
'DISTINCT' ];
3244 if ( $max !==
null ) {
3245 $queryOpts[
'LIMIT'] = $max + 1;
3248 $actorQuery = $this->actorMigration->getJoin(
'rev_user' );
3249 return array_map(
function ( $row ) {
3250 return $this->actorStore->newActorFromRowFields(
3252 $row->rev_user_text,
3255 }, iterator_to_array(
$dbr->select(
3256 array_merge( [
'revision' ], $actorQuery[
'tables'] ),
3257 $actorQuery[
'fields'],
3260 $actorQuery[
'joins']
3295 return count( $this->getAuthorsBetween( $pageId, $old, $new, $performer, $max, $options ) );
3325 $this->assertRevisionParameter(
'old', $pageId, $old );
3326 $this->assertRevisionParameter(
'new', $pageId, $new );
3332 if ( $old && $new && $new->getId( $this->wikiId ) === $old->getId( $this->wikiId ) ) {
3337 $conds = array_merge(
3339 'rev_page' => $pageId,
3340 $dbr->bitAnd(
'rev_deleted', RevisionRecord::DELETED_TEXT ) .
" = 0"
3342 $this->getRevisionLimitConditions(
$dbr, $old, $new, $options )
3344 if ( $max !==
null ) {
3345 return $dbr->selectRowCount(
'revision',
'1',
3348 [
'LIMIT' => $max + 1 ]
3351 return (
int)
$dbr->selectField(
'revision',
'count(*)', $conds, __METHOD__ );
3371 $db = $this->getDBConnectionRef(
DB_REPLICA );
3373 $subquery = $db->buildSelectSubquery(
3376 [
'rev_page' => $revision->
getPageId( $this->wikiId ) ],
3380 'rev_timestamp DESC',
3384 'LIMIT' => $searchLimit,
3392 $revisionRow = $db->selectRow(
3393 [
'recent_revs' => $subquery ],
3395 [
'rev_sha1' => $revision->
getSha1() ],
3399 return $revisionRow ? $this->newRevisionFromRow( $revisionRow ) : null;
3409 class_alias( RevisionStore::class,
'MediaWiki\Storage\RevisionStore' );
wfDeprecatedMsg( $msg, $version=false, $component=false, $callerOffset=2)
Log a deprecation warning with arbitrary message text.
if(!defined('MW_SETUP_CALLBACK'))
The persistent session ID (if any) loaded at startup.
This is not intended to be a long-term part of MediaWiki; it will be deprecated and removed once acto...
Class representing a cache/ephemeral data store.
Helper class for DAO classes.
static getDBOptions( $bitfield)
Get an appropriate DB index, options, and fallback DB index for a query.
static hasFlags( $bitfield, $flags)
Content object implementation representing unknown content.
Library for creating and parsing MW-style timestamps.
Exception thrown when an unregistered content model is requested.
Immutable value object representing a page identity.
Utility class for creating new RC entries.
static newFromConds( $conds, $fname=__METHOD__, $dbType=DB_REPLICA)
Find the first recent change matching some specific conditions.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Represents a title within MediaWiki.
static castFromLinkTarget( $linkTarget)
Same as newFromLinkTarget, but if passed null, returns null.
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
static newFromRow( $row)
Make a Title object from a DB row.
Multi-datacenter aware caching interface.
Base interface for content objects.
Interface for database access objects.
Interface for objects (potentially) representing an editable wiki page.
getId( $wikiId=self::LOCAL)
Returns the page ID.
trait LegacyArticleIdAccess
Convenience trait for conversion to PageIdentity.