38use InvalidArgumentException;
45use MediaWiki\Page\LegacyArticleIdAccess;
60use Psr\Log\LoggerAwareInterface;
61use Psr\Log\LoggerInterface;
62use Psr\Log\NullLogger;
71use Wikimedia\Assert\Assert;
91 use LegacyArticleIdAccess;
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();
266 list( $mode, ) = DBAccessObjectUtils::getDBOptions( $queryFlags );
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 );
304 return $this->titleFactory->castFromPageIdentity( $page );
317 private function getPage( ?
int $pageId, ?
int $revId,
int $queryFlags = self::READ_NORMAL ) {
318 if ( !$pageId && !$revId ) {
319 throw new InvalidArgumentException(
'$pageId and $revId cannot both be 0 or null' );
324 if ( DBAccessObjectUtils::hasFlags( $queryFlags, self::READ_LATEST_IMMUTABLE ) ) {
325 $queryFlags = self::READ_NORMAL;
329 if ( $pageId !==
null && $pageId > 0 ) {
330 $page = $this->pageStore->getPageById( $pageId, $queryFlags );
337 if ( $revId !==
null && $revId > 0 ) {
338 $pageQuery = $this->pageStore->newSelectQueryBuilder( $queryFlags )
339 ->join(
'revision',
null,
'page_id=rev_page' )
340 ->conds( [
'rev_id' => $revId ] )
341 ->caller( __METHOD__ );
343 $page = $pageQuery->fetchPageRecord();
350 if ( $queryFlags === self::READ_NORMAL ) {
351 $title = $this->
getPage( $pageId, $revId, self::READ_LATEST );
354 __METHOD__ .
' fell back to READ_LATEST and got a Title.',
362 'Could not determine title for page ID {page_id} and revision ID {rev_id}',
364 'page_id' => $pageId,
383 return $this->titleFactory->castFromPageIdentity( $page );
397 if ( $value ===
null ) {
399 "$name must not be " . var_export( $value,
true ) .
"!"
414 if ( $value ===
null || $value === 0 || $value ===
'' ) {
416 "$name must not be " . var_export( $value,
true ) .
"!"
436 $this->checkDatabaseDomain( $dbw );
443 'main slot must be provided'
448 $this->failOnNull( $rev->
getSize(),
'size field' );
449 $this->failOnEmpty( $rev->
getSha1(),
'sha1 field' );
450 $this->failOnEmpty( $rev->
getTimestamp(),
'timestamp field' );
453 $this->failOnNull( $user->getId(),
'user field' );
454 $this->failOnEmpty( $user->getName(),
'user_text field' );
466 Assert::precondition(
467 $mainSlot->getSize() === $rev->
getSize(),
468 'The revisions\'s size must match the main slot\'s size (see T239717)'
470 Assert::precondition(
471 $mainSlot->getSha1() === $rev->
getSha1(),
472 'The revisions\'s SHA1 hash must match the main slot\'s SHA1 hash (see T239717)'
476 $pageId = $this->failOnEmpty( $rev->
getPageId( $this->wikiId ),
'rev_page field' );
478 $parentId = $rev->
getParentId() ?? $this->getPreviousRevisionId( $dbw, $rev );
483 function (
IDatabase $dbw, $fname ) use (
490 return $this->insertRevisionInternal(
502 Assert::postcondition( $rev->
getId( $this->wikiId ) > 0,
'revision must have an ID' );
503 Assert::postcondition( $rev->
getPageId( $this->wikiId ) > 0,
'revision must have a page ID' );
504 Assert::postcondition(
506 'revision must have a comment'
508 Assert::postcondition(
510 'revision must have a user'
519 foreach ( $slotRoles as $role ) {
521 Assert::postcondition(
522 $slot->getContent() !==
null,
523 $role .
' slot must have content'
525 Assert::postcondition(
526 $slot->hasRevision(),
527 $role .
' slot must have a revision associated'
531 $this->hookRunner->onRevisionRecordInserted( $rev );
553 $this->checkDatabaseDomain( $dbw );
557 Assert::precondition(
558 $this->slotRoleRegistry->getRoleHandler( $role )->isDerived(),
559 'Trying to modify a slot that is not derived'
563 $isDerived = $this->slotRoleRegistry->getRoleHandler( $role )->isDerived();
564 Assert::precondition(
566 'Trying to remove a slot that is not derived'
568 throw new LogicException(
'Removing derived slots is not yet implemented. See T277394.' );
574 function ( IDatabase $dbw, $fname ) use (
578 return $this->updateSlotsInternal(
580 $revisionSlotsUpdate,
586 foreach ( $slotRecords as $role => $slot ) {
587 Assert::postcondition(
588 $slot->getContent() !==
null,
589 $role .
' slot must have content'
591 Assert::postcondition(
592 $slot->hasRevision(),
593 $role .
' slot must have a revision associated'
611 $page = $revision->getPage();
612 $revId = $revision->
getId( $this->wikiId );
614 BlobStore::PAGE_HINT => $page->
getId( $this->wikiId ),
615 BlobStore::REVISION_HINT => $revId,
616 BlobStore::PARENT_HINT => $revision->
getParentId( $this->wikiId ),
622 $newSlots[$role] = $this->insertSlotOn( $dbw, $revId, $slot, $page, $blobHints );
639 $revisionRow = $this->insertRevisionRowOn(
645 $revisionId = $revisionRow[
'rev_id'];
648 BlobStore::PAGE_HINT => $pageId,
649 BlobStore::REVISION_HINT => $revisionId,
650 BlobStore::PARENT_HINT => $parentId,
654 foreach ( $slotRoles as $role ) {
655 $slot = $rev->
getSlot( $role, RevisionRecord::RAW );
664 if ( $slot->hasRevision() && $slot->hasContentId() ) {
667 $slot->getRevision() === $revisionId,
668 'slot role ' . $slot->getRole(),
669 'Existing slot should belong to revision '
670 . $revisionId .
', but belongs to revision ' . $slot->getRevision() .
'!'
676 $newSlots[$role] = $slot;
678 $newSlots[$role] = $this->insertSlotOn( $dbw, $revisionId, $slot, $page, $blobHints );
682 $this->insertIpChangesRow( $dbw, $user, $rev, $revisionId );
688 (
object)$revisionRow,
709 array $blobHints = []
714 $blobAddress = $this->storeContentBlob( $protoSlot, $page, $blobHints );
722 $contentId = $this->insertContentRowOn( $protoSlot, $dbw, $blobAddress );
725 $this->insertSlotRowOn( $protoSlot, $dbw, $revisionId, $contentId );
727 return SlotRecord::newSaved(
748 if ( $user->
getId() === 0 && IPUtils::isValid( $user->
getName() ) ) {
750 'ipc_rev_id' => $revisionId,
752 'ipc_hex' => IPUtils::toHex( $user->
getName() ),
754 $dbw->
insert(
'ip_changes', $ipcRow, __METHOD__ );
773 $revisionRow = $this->getBaseRevisionRow( $dbw, $rev, $parentId );
775 list( $commentFields, $commentCallback ) =
776 $this->commentStore->insertWithTempTable(
781 $revisionRow += $commentFields;
783 list( $actorFields, $actorCallback ) =
784 $this->actorMigration->getInsertValuesWithTempTable(
787 $rev->
getUser( RevisionRecord::RAW )
789 $revisionRow += $actorFields;
791 $dbw->
insert(
'revision', $revisionRow, __METHOD__ );
793 if ( !isset( $revisionRow[
'rev_id'] ) ) {
795 $revisionRow[
'rev_id'] = intval( $dbw->
insertId() );
797 if ( $dbw->
getType() ===
'mysql' ) {
802 $maxRevId = intval( $dbw->
selectField(
'archive',
'MAX(ar_rev_id)',
'', __METHOD__ ) );
804 $maxRevId2 = intval( $dbw->
selectField(
'slots',
'MAX(slot_revision_id)',
'', __METHOD__ ) );
805 if ( $maxRevId2 >= $maxRevId ) {
806 $maxRevId = $maxRevId2;
810 if ( $maxRevId >= $revisionRow[
'rev_id'] ) {
811 $this->logger->debug(
812 '__METHOD__: Inserted revision {revid} but {table} has revisions up to {maxrevid}.'
813 .
' Trying to fix it.',
815 'revid' => $revisionRow[
'rev_id'],
817 'maxrevid' => $maxRevId,
821 if ( !$dbw->
lock(
'fix-for-T202032', __METHOD__ ) ) {
822 throw new MWException(
'Failed to get database lock for T202032' );
826 static function ( $trigger,
IDatabase $dbw ) use ( $fname ) {
827 $dbw->
unlock(
'fix-for-T202032', $fname );
832 $dbw->
delete(
'revision', [
'rev_id' => $revisionRow[
'rev_id'] ], __METHOD__ );
844 $dbw->
selectSQLText(
'archive', [
'v' =>
"MAX(ar_rev_id)" ],
'', __METHOD__ ) .
' FOR UPDATE',
849 $dbw->
selectSQLText(
'slots', [
'v' =>
"MAX(slot_revision_id)" ],
'', __METHOD__ )
856 $row1 ? intval( $row1->v ) : 0,
857 $row2 ? intval( $row2->v ) : 0
863 $revisionRow[
'rev_id'] = $maxRevId + 1;
864 $dbw->
insert(
'revision', $revisionRow, __METHOD__ );
869 $commentCallback( $revisionRow[
'rev_id'] );
870 $actorCallback( $revisionRow[
'rev_id'], $revisionRow );
889 'rev_page' => $rev->
getPageId( $this->wikiId ),
890 'rev_parent_id' => $parentId,
891 'rev_minor_edit' => $rev->
isMinor() ? 1 : 0,
898 if ( $rev->
getId( $this->wikiId ) !==
null ) {
900 $revisionRow[
'rev_id'] = $rev->
getId( $this->wikiId );
917 array $blobHints = []
920 $format =
$content->getDefaultFormat();
925 return $this->blobStore->storeBlob(
932 BlobStore::DESIGNATION_HINT =>
'page-content',
933 BlobStore::ROLE_HINT => $slot->
getRole(),
934 BlobStore::SHA1_HINT => $slot->
getSha1(),
935 BlobStore::MODEL_HINT => $model,
936 BlobStore::FORMAT_HINT => $format,
950 'slot_revision_id' => $revisionId,
951 'slot_role_id' => $this->slotRoleStore->acquireId( $slot->
getRole() ),
952 'slot_content_id' => $contentId,
957 $dbw->
insert(
'slots', $slotRow, __METHOD__ );
968 'content_size' => $slot->
getSize(),
969 'content_sha1' => $slot->
getSha1(),
970 'content_model' => $this->contentModelStore->acquireId( $slot->
getModel() ),
971 'content_address' => $blobAddress,
973 $dbw->
insert(
'content', $contentRow, __METHOD__ );
991 $format =
$content->getDefaultFormat();
992 $handler =
$content->getContentHandler();
994 if ( !$handler->isSupportedFormat( $format ) ) {
996 "Can't use format $format with content model $model on $page role $role"
1002 "New content for $page role $role is not valid! Content model is $model"
1039 $this->checkDatabaseDomain( $dbw );
1041 $pageId = $this->getArticleId( $page );
1049 [
'page_id' => $pageId ],
1054 if ( !$pageLatest ) {
1055 $msg =
'T235589: Failed to select table row during null revision creation' .
1056 " Page id '$pageId' does not exist.";
1057 $this->logger->error(
1059 [
'exception' =>
new RuntimeException( $msg ) ]
1066 $oldRevision = $this->loadRevisionFromConds(
1068 [
'rev_id' => intval( $pageLatest ) ],
1073 if ( !$oldRevision ) {
1074 $msg =
"Failed to load latest revision ID $pageLatest of page ID $pageId.";
1075 $this->logger->error(
1077 [
'exception' =>
new RuntimeException( $msg ) ]
1083 $timestamp = MWTimestamp::now( TS_MW );
1084 $newRevision = MutableRevisionRecord::newFromParentRevision( $oldRevision );
1086 $newRevision->setComment( $comment );
1087 $newRevision->setUser( $user );
1088 $newRevision->setTimestamp( $timestamp );
1089 $newRevision->setMinorEdit( $minor );
1091 return $newRevision;
1104 $rc = $this->getRecentChange( $rev );
1105 if ( $rc && $rc->getAttribute(
'rc_patrolled' ) == RecentChange::PRC_UNPATROLLED ) {
1106 return $rc->getAttribute(
'rc_id' );
1126 list( $dbType, ) = DBAccessObjectUtils::getDBOptions( $flags );
1128 $rc = RecentChange::newFromConds(
1129 [
'rc_this_oldid' => $rev->
getId( $this->wikiId ) ],
1159 ?
string $blobData =
null,
1160 ?
string $blobFlags =
null,
1161 ?
string $blobFormat =
null,
1164 if ( $blobData !==
null ) {
1167 if ( $blobFlags ===
null ) {
1171 $data = $this->blobStore->expandBlob( $blobData, $blobFlags, $cacheKey );
1172 if ( $data ===
false ) {
1174 'Failed to expand blob data using flags {flags} (key: {cache_key})',
1176 'flags' => $blobFlags,
1177 'cache_key' => $cacheKey,
1186 $data = $this->blobStore->getBlob( $address, $queryFlags );
1189 'Failed to load data blob from {address}'
1190 .
'If this problem persist, use the findBadBlobs maintenance script '
1191 .
'to investigate the issue and mark bad blobs.',
1192 [
'address' => $e->getMessage() ],
1202 if ( !$this->contentHandlerFactory->isDefinedModel( $model ) ) {
1203 $this->logger->warning(
1204 "Undefined content model '$model', falling back to UnknownContent",
1208 'role_name' => $slot->
getRole(),
1209 'model_name' => $model,
1217 return $this->contentHandlerFactory
1218 ->getContentHandler( $model )
1219 ->unserializeContent( $data, $blobFormat );
1240 return $this->newRevisionFromConds( [
'rev_id' => intval( $id ) ], $flags, $page );
1267 $page = $this->wikiId === WikiAwareEntity::LOCAL ? Title::castFromLinkTarget( $page ) :
null;
1276 $conds[
'rev_id'] = $revId;
1277 return $this->newRevisionFromConds( $conds, $flags, $page );
1284 $db = $this->getDBConnectionRefForQueryFlags( $flags );
1285 $conds[] =
'rev_id=page_latest';
1286 return $this->loadRevisionFromConds( $db, $conds, $flags, $page );
1307 $conds = [
'page_id' => $pageId ];
1314 $conds[
'rev_id'] = $revId;
1315 return $this->newRevisionFromConds( $conds, $flags );
1322 $db = $this->getDBConnectionRefForQueryFlags( $flags );
1324 $conds[] =
'rev_id=page_latest';
1326 return $this->loadRevisionFromConds( $db, $conds, $flags );
1348 int $flags = IDBAccessObject::READ_NORMAL
1352 $page = $this->wikiId === WikiAwareEntity::LOCAL ? Title::castFromLinkTarget( $page ) :
null;
1354 $db = $this->getDBConnectionRefForQueryFlags( $flags );
1355 return $this->newRevisionFromConds(
1357 'rev_timestamp' => $db->timestamp( $timestamp ),
1376 $res = $this->loadSlotRecordsFromDb( $revId, $queryFlags, $page );
1377 return $this->constructSlotRecords( $revId,
$res, $queryFlags, $page );
1381 $res = $this->localCache->getWithSetCallback(
1382 $this->localCache->makeKey(
1388 $this->localCache::TTL_HOUR,
1389 function () use ( $revId, $queryFlags, $page ) {
1390 return $this->cache->getWithSetCallback(
1391 $this->cache->makeKey(
1397 WANObjectCache::TTL_DAY,
1398 function () use ( $revId, $queryFlags, $page ) {
1399 $res = $this->loadSlotRecordsFromDb( $revId, $queryFlags, $page );
1413 return $this->constructSlotRecords( $revId,
$res, $queryFlags, $page );
1417 $revQuery = $this->getSlotsQueryInfo( [
'content' ] );
1419 list( $dbMode, $dbOptions ) = DBAccessObjectUtils::getDBOptions( $queryFlags );
1420 $db = $this->getDBConnectionRef( $dbMode );
1426 'slot_revision_id' => $revId,
1433 if ( !
$res->numRows() && !( $queryFlags & self::READ_LATEST ) ) {
1435 $this->logger->info(
1436 __METHOD__ .
' falling back to READ_LATEST.',
1442 return $this->loadSlotRecordsFromDb(
1444 $queryFlags | self::READ_LATEST,
1448 return iterator_to_array(
$res );
1468 $slotContents =
null
1472 foreach ( $slotRows as $row ) {
1474 if ( !isset( $row->role_name ) ) {
1475 $row->role_name = $this->slotRoleStore->getName( (
int)$row->slot_role_id );
1478 if ( !isset( $row->model_name ) ) {
1479 if ( isset( $row->content_model ) ) {
1480 $row->model_name = $this->contentModelStore->getName( (
int)$row->content_model );
1484 $slotRoleHandler = $this->slotRoleRegistry->getRoleHandler( $row->role_name );
1485 $row->model_name = $slotRoleHandler->getDefaultModel( $page );
1490 if ( isset( $row->blob_data ) ) {
1491 $slotContents[$row->content_address] = $row->blob_data;
1494 $contentCallback =
function (
SlotRecord $slot ) use ( $slotContents, $queryFlags ) {
1496 if ( isset( $slotContents[$slot->getAddress()] ) ) {
1497 $blob = $slotContents[$slot->getAddress()];
1502 return $this->loadSlotContent( $slot,
$blob,
null,
null, $queryFlags );
1505 $slots[$row->role_name] =
new SlotRecord( $row, $contentCallback );
1508 if ( !isset( $slots[SlotRecord::MAIN] ) ) {
1509 $this->logger->error(
1510 __METHOD__ .
': Main slot of revision not found in database. See T212428.',
1513 'queryFlags' => $queryFlags,
1519 'Main slot of revision not found in database. See T212428.'
1550 $this->constructSlotRecords( $revId, $slotRows, $queryFlags, $page )
1553 $slots =
new RevisionSlots(
function () use( $revId, $queryFlags, $page ) {
1554 return $this->loadSlotRecords( $revId, $queryFlags, $page );
1586 array $overrides = []
1588 return $this->newRevisionFromArchiveRowAndSlots( $row,
null, $queryFlags, $page, $overrides );
1609 return $this->newRevisionFromRowAndSlots( $row,
null, $queryFlags, $page, $fromCache );
1634 int $queryFlags = 0,
1636 array $overrides = []
1638 if ( !$page && isset( $overrides[
'title'] ) ) {
1639 if ( !( $overrides[
'title'] instanceof
PageIdentity ) ) {
1640 throw new MWException(
'title field override must contain a PageIdentity object.' );
1643 $page = $overrides[
'title'];
1646 if ( !isset( $page ) ) {
1647 if ( isset( $row->ar_namespace ) && isset( $row->ar_title ) ) {
1648 $page = Title::makeTitle( $row->ar_namespace, $row->ar_title );
1650 throw new InvalidArgumentException(
1651 'A Title or ar_namespace and ar_title must be given'
1656 foreach ( $overrides as $key => $value ) {
1658 $row->$field = $value;
1662 $user = $this->actorStore->newActorFromRowFields(
1663 $row->ar_user ??
null,
1664 $row->ar_user_text ??
null,
1665 $row->ar_actor ??
null
1667 }
catch ( InvalidArgumentException $ex ) {
1668 $this->logger->warning(
'Could not load user for archive revision {rev_id}', [
1669 'ar_rev_id' => $row->ar_rev_id,
1670 'ar_actor' => $row->ar_actor ??
'null',
1671 'ar_user_text' => $row->ar_user_text ??
'null',
1672 'ar_user' => $row->ar_user ??
'null',
1675 $user = $this->actorStore->getUnknownActor();
1678 $db = $this->getDBConnectionRefForQueryFlags( $queryFlags );
1680 $comment = $this->commentStore->getCommentLegacy( $db,
'ar_comment', $row,
true );
1683 $slots = $this->newRevisionSlots( $row->ar_rev_id, $row, $slots, $queryFlags, $page );
1709 int $queryFlags = 0,
1711 bool $fromCache =
false
1714 if ( isset( $row->page_id )
1715 && isset( $row->page_namespace )
1716 && isset( $row->page_title )
1720 (
int)$row->page_namespace,
1725 $page = $this->wrapPage( $page );
1727 $pageId = (int)( $row->rev_page ?? 0 );
1728 $revId = (int)( $row->rev_id ?? 0 );
1730 $page = $this->getPage( $pageId, $revId, $queryFlags );
1733 $page = $this->ensureRevisionRowMatchesPage( $row, $page );
1740 "Failed to determine page associated with revision {$row->rev_id}"
1745 $user = $this->actorStore->newActorFromRowFields(
1746 $row->rev_user ??
null,
1747 $row->rev_user_text ??
null,
1748 $row->rev_actor ??
null
1750 }
catch ( InvalidArgumentException $ex ) {
1751 $this->logger->warning(
'Could not load user for revision {rev_id}', [
1752 'rev_id' => $row->rev_id,
1753 'rev_actor' => $row->rev_actor ??
'null',
1754 'rev_user_text' => $row->rev_user_text ??
'null',
1755 'rev_user' => $row->rev_user ??
'null',
1758 $user = $this->actorStore->getUnknownActor();
1761 $db = $this->getDBConnectionRefForQueryFlags( $queryFlags );
1763 $comment = $this->commentStore->getCommentLegacy( $db,
'rev_comment', $row,
true );
1766 $slots = $this->newRevisionSlots( $row->rev_id, $row, $slots, $queryFlags, $page );
1772 function ( $revId ) use ( $queryFlags ) {
1773 $db = $this->getDBConnectionRefForQueryFlags( $queryFlags );
1774 $row = $this->fetchRevisionRowFromConds(
1776 [
'rev_id' => intval( $revId ) ]
1778 if ( !$row && !( $queryFlags & self::READ_LATEST ) ) {
1780 $this->logger->info(
1781 'RevisionStoreCacheRecord refresh callback falling back to READ_LATEST.',
1787 $dbw = $this->getDBConnectionRefForQueryFlags( self::READ_LATEST );
1788 $row = $this->fetchRevisionRowFromConds(
1790 [
'rev_id' => intval( $revId ) ]
1794 return [
null, null ];
1798 $this->actorStore->newActorFromRowFields(
1799 $row->rev_user ??
null,
1800 $row->rev_user_text ??
null,
1801 $row->rev_actor ??
null
1805 $page, $user, $comment, $row, $slots, $this->wikiId
1809 $page, $user, $comment, $row, $slots, $this->wikiId );
1826 $revId = (int)( $row->rev_id ?? 0 );
1827 $revPageId = (int)( $row->rev_page ?? 0 );
1828 $expectedPageId = $page->
getId( $this->wikiId );
1830 if ( $revPageId && $expectedPageId && $revPageId !== $expectedPageId ) {
1832 $pageRec = $this->pageStore->getPageByName(
1835 PageStore::READ_LATEST
1837 $masterPageId = $pageRec->getId( $this->wikiId );
1838 $masterLatest = $pageRec->getLatest( $this->wikiId );
1839 if ( $revPageId === $masterPageId ) {
1840 if ( $page instanceof
Title ) {
1843 $page->resetArticleID( $masterPageId );
1849 $this->logger->info(
1850 "Encountered stale Title object",
1852 'page_id_stale' => $expectedPageId,
1853 'page_id_reloaded' => $masterPageId,
1854 'page_latest' => $masterLatest,
1860 $expectedTitle = (string)$page;
1861 if ( $page instanceof
Title ) {
1863 $page = $this->titleFactory->newFromID( $revPageId );
1874 $this->logger->error(
1875 "Encountered mismatching Title object (see T259022, T268910, T279832, T263340)",
1877 'expected_page_id' => $masterPageId,
1878 'expected_page_title' => $expectedTitle,
1879 'rev_page' => $revPageId,
1880 'rev_page_title' => (
string)$page,
1881 'page_latest' => $masterLatest,
1919 array $options = [],
1924 $archiveMode = $options[
'archive'] ??
false;
1926 if ( $archiveMode ) {
1927 $revIdField =
'ar_rev_id';
1929 $revIdField =
'rev_id';
1933 $pageIdsToFetchTitles = [];
1934 $titlesByPageKey = [];
1935 foreach ( $rows as $row ) {
1936 if ( isset( $rowsByRevId[$row->$revIdField] ) ) {
1938 'internalerror_info',
1939 "Duplicate rows in newRevisionsFromBatch, $revIdField {$row->$revIdField}"
1945 $archiveMode ? $row->ar_namespace .
':' . $row->ar_title : $row->rev_page;
1948 if ( !$archiveMode && $row->rev_page != $this->getArticleId( $page ) ) {
1949 throw new InvalidArgumentException(
1950 "Revision {$row->$revIdField} doesn't belong to page "
1951 . $this->getArticleId( $page )
1957 || $row->ar_title !== $page->
getDBkey() )
1959 throw new InvalidArgumentException(
1960 "Revision {$row->$revIdField} doesn't belong to page "
1964 } elseif ( !isset( $titlesByPageKey[ $row->_page_key ] ) ) {
1965 if ( isset( $row->page_namespace ) && isset( $row->page_title )
1968 && isset( $row->page_id ) && isset( $row->rev_page )
1969 && $row->rev_page === $row->page_id
1971 $titlesByPageKey[ $row->_page_key ] = Title::newFromRow( $row );
1972 } elseif ( $archiveMode ) {
1974 $titlesByPageKey[ $row->_page_key ] =
1975 Title::makeTitle( $row->ar_namespace, $row->ar_title );
1977 $pageIdsToFetchTitles[] = $row->rev_page;
1980 $rowsByRevId[$row->$revIdField] = $row;
1983 if ( empty( $rowsByRevId ) ) {
1984 $result->setResult(
true, [] );
1991 $pageKey = $archiveMode
1993 : $this->getArticleId( $page );
1995 $titlesByPageKey[$pageKey] = $page;
1996 } elseif ( !empty( $pageIdsToFetchTitles ) ) {
1999 Assert::invariant( !$archiveMode,
'Titles are not loaded by ID in archive mode.' );
2001 $pageIdsToFetchTitles = array_unique( $pageIdsToFetchTitles );
2002 $pageRecords = $this->pageStore
2003 ->newSelectQueryBuilder()
2004 ->wherePageIds( $pageIdsToFetchTitles )
2005 ->caller( __METHOD__ )
2006 ->fetchPageRecordArray();
2008 $titlesByPageKey = $pageRecords + $titlesByPageKey;
2012 $newRevisionRecord = [
2014 $archiveMode ?
'newRevisionFromArchiveRowAndSlots' :
'newRevisionFromRowAndSlots'
2017 if ( !isset( $options[
'slots'] ) ) {
2021 static function ( $row )
2022 use ( $queryFlags, $titlesByPageKey, $result, $newRevisionRecord, $revIdField ) {
2024 if ( !isset( $titlesByPageKey[$row->_page_key] ) ) {
2026 'internalerror_info',
2027 "Couldn't find title for rev {$row->$revIdField} "
2028 .
"(page key {$row->_page_key})"
2032 return $newRevisionRecord( $row,
null, $queryFlags,
2033 $titlesByPageKey[ $row->_page_key ] );
2035 $result->warning(
'internalerror_info', $e->getMessage() );
2046 'slots' => $options[
'slots'] ??
true,
2047 'blobs' => $options[
'content'] ??
false,
2050 if ( is_array( $slotRowOptions[
'slots'] )
2051 && !in_array( SlotRecord::MAIN, $slotRowOptions[
'slots'] )
2054 $slotRowOptions[
'slots'][] = SlotRecord::MAIN;
2057 $slotRowsStatus = $this->getSlotRowsForBatch( $rowsByRevId, $slotRowOptions, $queryFlags );
2059 $result->merge( $slotRowsStatus );
2060 $slotRowsByRevId = $slotRowsStatus->getValue();
2066 use ( $slotRowsByRevId, $queryFlags, $titlesByPageKey, $result,
2067 $revIdField, $newRevisionRecord
2069 if ( !isset( $slotRowsByRevId[$row->$revIdField] ) ) {
2071 'internalerror_info',
2072 "Couldn't find slots for rev {$row->$revIdField}"
2076 if ( !isset( $titlesByPageKey[$row->_page_key] ) ) {
2078 'internalerror_info',
2079 "Couldn't find title for rev {$row->$revIdField} "
2080 .
"(page key {$row->_page_key})"
2085 return $newRevisionRecord(
2088 $this->constructSlotRecords(
2090 $slotRowsByRevId[$row->$revIdField],
2092 $titlesByPageKey[$row->_page_key]
2096 $titlesByPageKey[$row->_page_key]
2099 $result->warning(
'internalerror_info', $e->getMessage() );
2134 array $options = [],
2140 foreach ( $rowsOrIds as $row ) {
2141 if ( is_object( $row ) ) {
2142 $revIds[] = isset( $row->ar_rev_id ) ? (int)$row->ar_rev_id : (int)$row->rev_id;
2144 $revIds[] = (int)$row;
2150 if ( empty( $revIds ) ) {
2151 $result->setResult(
true, [] );
2156 $slotQueryInfo = $this->getSlotsQueryInfo( [
'content' ] );
2157 $revIdField = $slotQueryInfo[
'keys'][
'rev_id'];
2158 $slotQueryConds = [ $revIdField => $revIds ];
2160 if ( isset( $options[
'slots'] ) && is_array( $options[
'slots'] ) ) {
2161 if ( empty( $options[
'slots'] ) ) {
2163 $result->setResult(
true, array_fill_keys( $revIds, [] ) );
2167 $roleIdField = $slotQueryInfo[
'keys'][
'role_id'];
2168 $slotQueryConds[$roleIdField] = array_map(
2169 [ $this->slotRoleStore,
'getId' ],
2174 $db = $this->getDBConnectionRefForQueryFlags( $queryFlags );
2175 $slotRows = $db->select(
2176 $slotQueryInfo[
'tables'],
2177 $slotQueryInfo[
'fields'],
2181 $slotQueryInfo[
'joins']
2184 $slotContents =
null;
2185 if ( $options[
'blobs'] ??
false ) {
2186 $blobAddresses = [];
2187 foreach ( $slotRows as $slotRow ) {
2188 $blobAddresses[] = $slotRow->content_address;
2190 $slotContentFetchStatus = $this->blobStore
2191 ->getBlobBatch( $blobAddresses, $queryFlags );
2192 foreach ( $slotContentFetchStatus->getErrors() as $error ) {
2193 $result->warning( $error[
'message'], ...$error[
'params'] );
2195 $slotContents = $slotContentFetchStatus->getValue();
2198 $slotRowsByRevId = [];
2199 foreach ( $slotRows as $slotRow ) {
2200 if ( $slotContents ===
null ) {
2202 } elseif ( isset( $slotContents[$slotRow->content_address] ) ) {
2203 $slotRow->blob_data = $slotContents[$slotRow->content_address];
2206 'internalerror_info',
2207 "Couldn't find blob data for rev {$slotRow->slot_revision_id}"
2209 $slotRow->blob_data =
null;
2213 if ( !isset( $slotRow->role_name ) && isset( $slotRow->slot_role_id ) ) {
2214 $slotRow->role_name = $this->slotRoleStore->getName( (
int)$slotRow->slot_role_id );
2218 if ( !isset( $slotRow->model_name ) && isset( $slotRow->content_model ) ) {
2219 $slotRow->model_name = $this->contentModelStore->getName( (
int)$slotRow->content_model );
2222 $slotRowsByRevId[$slotRow->slot_revision_id][$slotRow->role_name] = $slotRow;
2225 $result->setResult(
true, $slotRowsByRevId );
2254 $result = $this->getSlotRowsForBatch(
2256 [
'slots' => $slots,
'blobs' =>
true ],
2260 if ( $result->isOK() ) {
2262 foreach ( $result->value as $revId => $rowsByRole ) {
2263 foreach ( $rowsByRole as $role => $slotRow ) {
2264 if ( is_array( $slots ) && !in_array( $role, $slots ) ) {
2267 unset( $result->value[$revId][$role] );
2271 $result->value[$revId][$role] = (object)[
2272 'blob_data' => $slotRow->blob_data,
2273 'model_name' => $slotRow->model_name,
2300 int $flags = IDBAccessObject::READ_NORMAL,
2304 $db = $this->getDBConnectionRefForQueryFlags( $flags );
2305 $rev = $this->loadRevisionFromConds( $db, $conditions, $flags, $page, $options );
2307 $lb = $this->getDBLoadBalancer();
2312 && !( $flags & self::READ_LATEST )
2313 && $lb->hasStreamingReplicaServers()
2314 && $lb->hasOrMadeRecentPrimaryChanges()
2316 $flags = self::READ_LATEST;
2317 $dbw = $this->getDBConnectionRef(
DB_PRIMARY );
2318 $rev = $this->loadRevisionFromConds( $dbw, $conditions, $flags, $page, $options );
2341 int $flags = IDBAccessObject::READ_NORMAL,
2345 $row = $this->fetchRevisionRowFromConds( $db, $conditions, $flags, $options );
2347 return $this->newRevisionFromRow( $row, $flags, $page );
2362 $storeDomain = $this->loadBalancer->resolveDomainID( $this->wikiId );
2363 if ( $dbDomain === $storeDomain ) {
2367 throw new MWException(
"DB connection domain '$dbDomain' does not match '$storeDomain'" );
2386 int $flags = IDBAccessObject::READ_NORMAL,
2389 $this->checkDatabaseDomain( $db );
2391 $revQuery = $this->getQueryInfo( [
'page',
'user' ] );
2392 if ( ( $flags & self::READ_LOCKING ) == self::READ_LOCKING ) {
2393 $options[] =
'FOR UPDATE';
2433 $ret[
'tables'][] =
'revision';
2434 $ret[
'fields'] = array_merge( $ret[
'fields'], [
2445 $commentQuery = $this->commentStore->getJoin(
'rev_comment' );
2446 $ret[
'tables'] = array_merge( $ret[
'tables'], $commentQuery[
'tables'] );
2447 $ret[
'fields'] = array_merge( $ret[
'fields'], $commentQuery[
'fields'] );
2448 $ret[
'joins'] = array_merge( $ret[
'joins'], $commentQuery[
'joins'] );
2450 $actorQuery = $this->actorMigration->getJoin(
'rev_user' );
2451 $ret[
'tables'] = array_merge( $ret[
'tables'], $actorQuery[
'tables'] );
2452 $ret[
'fields'] = array_merge( $ret[
'fields'], $actorQuery[
'fields'] );
2453 $ret[
'joins'] = array_merge( $ret[
'joins'], $actorQuery[
'joins'] );
2455 if ( in_array(
'page', $options,
true ) ) {
2456 $ret[
'tables'][] =
'page';
2457 $ret[
'fields'] = array_merge( $ret[
'fields'], [
2465 $ret[
'joins'][
'page'] = [
'JOIN', [
'page_id = rev_page' ] ];
2468 if ( in_array(
'user', $options,
true ) ) {
2469 $ret[
'tables'][] =
'user';
2470 $ret[
'fields'] = array_merge( $ret[
'fields'], [
2473 $u = $actorQuery[
'fields'][
'rev_user'];
2474 $ret[
'joins'][
'user'] = [
'LEFT JOIN', [
"$u != 0",
"user_id = $u" ] ];
2477 if ( in_array(
'text', $options,
true ) ) {
2478 throw new InvalidArgumentException(
2479 'The `text` option is no longer supported in MediaWiki 1.35 and later.'
2514 $ret[
'keys'][
'rev_id'] =
'slot_revision_id';
2515 $ret[
'keys'][
'role_id'] =
'slot_role_id';
2517 $ret[
'tables'][] =
'slots';
2518 $ret[
'fields'] = array_merge( $ret[
'fields'], [
2525 if ( in_array(
'role', $options,
true ) ) {
2528 $ret[
'tables'][] =
'slot_roles';
2529 $ret[
'joins'][
'slot_roles'] = [
'LEFT JOIN', [
'slot_role_id = role_id' ] ];
2530 $ret[
'fields'][] =
'role_name';
2533 if ( in_array(
'content', $options,
true ) ) {
2534 $ret[
'keys'][
'model_id'] =
'content_model';
2536 $ret[
'tables'][] =
'content';
2537 $ret[
'fields'] = array_merge( $ret[
'fields'], [
2543 $ret[
'joins'][
'content'] = [
'JOIN', [
'slot_content_id = content_id' ] ];
2545 if ( in_array(
'model', $options,
true ) ) {
2548 $ret[
'tables'][] =
'content_models';
2549 $ret[
'joins'][
'content_models'] = [
'LEFT JOIN', [
'content_model = model_id' ] ];
2550 $ret[
'fields'][] =
'model_name';
2567 if ( !( $row instanceof stdClass ) ) {
2570 $queryInfo = $table ===
'archive' ? $this->getArchiveQueryInfo() : $this->getQueryInfo();
2571 foreach ( $queryInfo[
'fields'] as $alias => $field ) {
2572 $name = is_numeric( $alias ) ? $field : $alias;
2573 if ( !property_exists( $row, $name ) ) {
2598 $commentQuery = $this->commentStore->getJoin(
'ar_comment' );
2602 'archive_actor' =>
'actor'
2603 ] + $commentQuery[
'tables'],
2617 'ar_user' =>
'archive_actor.actor_user',
2618 'ar_user_text' =>
'archive_actor.actor_name',
2619 ] + $commentQuery[
'fields'],
2621 'archive_actor' => [
'JOIN',
'actor_id=ar_actor' ]
2622 ] + $commentQuery[
'joins'],
2646 [
'rev_id',
'rev_len' ],
2647 [
'rev_id' => $revIds ],
2651 foreach (
$res as $row ) {
2652 $revLens[$row->rev_id] = intval( $row->rev_len );
2667 $op = $dir ===
'next' ?
'>' :
'<';
2668 $sort = $dir ===
'next' ?
'ASC' :
'DESC';
2670 $revisionIdValue = $rev->
getId( $this->wikiId );
2672 if ( !$revisionIdValue || !$rev->
getPageId( $this->wikiId ) ) {
2682 list( $dbType, ) = DBAccessObjectUtils::getDBOptions( $flags );
2683 $db = $this->getDBConnectionRef( $dbType, [
'contributions' ] );
2685 $ts = $this->getTimestampFromId( $revisionIdValue, $flags );
2686 if ( $ts ===
false ) {
2688 $ts = $db->selectField(
'archive',
'ar_timestamp',
2689 [
'ar_rev_id' => $revisionIdValue ], __METHOD__ );
2690 if ( $ts ===
false ) {
2695 $dbts = $db->addQuotes( $db->timestamp( $ts ) );
2697 $revId = $db->selectField(
'revision',
'rev_id',
2699 'rev_page' => $rev->
getPageId( $this->wikiId ),
2700 "rev_timestamp $op $dbts OR (rev_timestamp = $dbts AND rev_id $op $revisionIdValue )"
2704 'ORDER BY' => [
"rev_timestamp $sort",
"rev_id $sort" ],
2705 'IGNORE INDEX' =>
'rev_timestamp',
2709 if ( $revId ===
false ) {
2713 return $this->getRevisionById( intval( $revId ), $flags );
2731 return $this->getRelativeRevision( $rev, $flags,
'prev' );
2746 return $this->getRelativeRevision( $rev, $flags,
'next' );
2761 $this->checkDatabaseDomain( $db );
2763 if ( $rev->
getPageId( $this->wikiId ) ===
null ) {
2766 # Use page_latest if ID is not given
2767 if ( !$rev->
getId( $this->wikiId ) ) {
2769 'page',
'page_latest',
2770 [
'page_id' => $rev->
getPageId( $this->wikiId ) ],
2775 'revision',
'rev_id',
2776 [
'rev_page' => $rev->
getPageId( $this->wikiId ),
'rev_id < ' . $rev->
getId( $this->wikiId ) ],
2778 [
'ORDER BY' =>
'rev_id DESC' ]
2781 return intval( $prevId );
2797 if ( $id instanceof
Title ) {
2800 $flags = func_num_args() > 2 ? func_get_arg( 2 ) : 0;
2808 if ( $id ===
null || $id <= 0 ) {
2812 $db = $this->getDBConnectionRefForQueryFlags( $flags );
2815 $db->selectField(
'revision',
'rev_timestamp', [
'rev_id' => $id ], __METHOD__ );
2817 return ( $timestamp !==
false ) ? MWTimestamp::convert( TS_MW, $timestamp ) :
false;
2830 $this->checkDatabaseDomain( $db );
2833 [
'revCount' =>
'COUNT(*)' ],
2834 [
'rev_page' => $id ],
2838 return intval( $row->revCount );
2853 $id = $this->getArticleId( $page );
2855 return $this->countRevisionsByPageId( $db, $id );
2879 $this->checkDatabaseDomain( $db );
2889 'rev_user' =>
$revQuery[
'fields'][
'rev_user'],
2892 'rev_page' => $pageId,
2896 [
'ORDER BY' =>
'rev_timestamp ASC',
'LIMIT' => 50 ],
2899 foreach (
$res as $row ) {
2900 if ( $row->rev_user != $userId ) {
2921 $db = $this->getDBConnectionRef(
DB_REPLICA );
2922 $revIdPassed = $revId;
2923 $pageId = $this->getArticleId( $page );
2929 if ( $page instanceof
Title ) {
2930 $revId = $page->getLatestRevID();
2932 $pageRecord = $this->pageStore->getPageByReference( $page );
2933 if ( $pageRecord ) {
2934 $revId = $pageRecord->getLatest( $this->getWikiId() );
2940 $this->logger->warning(
2941 'No latest revision known for page {page} even though it exists with page ID {page_id}', [
2943 'page_id' => $pageId,
2944 'wiki_id' => $this->getWikiId() ?:
'local',
2953 $row = $this->cache->getWithSetCallback(
2955 $this->getRevisionRowCacheKey( $db, $pageId, $revId ),
2956 WANObjectCache::TTL_WEEK,
2957 function ( $curValue, &$ttl, array &$setOpts ) use (
2958 $db, $revId, &$fromCache
2960 $setOpts += Database::getCacheSetOptions( $db );
2961 $row = $this->fetchRevisionRowFromConds( $db, [
'rev_id' => intval( $revId ) ] );
2971 $title = $this->ensureRevisionRowMatchesPage( $row, $page, [
2972 'from_cache_flag' => $fromCache,
2973 'page_id_initial' => $pageId,
2974 'rev_id_used' => $revId,
2975 'rev_id_requested' => $revIdPassed,
2978 return $this->newRevisionFromRow( $row, 0,
$title, $fromCache );
2994 int $flags = IDBAccessObject::READ_NORMAL
2998 $page = $this->wikiId === WikiAwareEntity::LOCAL ? Title::castFromLinkTarget( $page ) :
null;
3000 return $this->newRevisionFromConds(
3008 'ORDER BY' => [
'rev_timestamp ASC',
'rev_id ASC' ],
3009 'IGNORE INDEX' => [
'revision' =>
'rev_timestamp' ],
3026 return $this->cache->makeGlobalKey(
3027 self::ROW_CACHE_KEY,
3043 if ( $rev->getId( $this->wikiId ) ===
null ) {
3044 throw new InvalidArgumentException(
"Unsaved {$paramName} revision passed" );
3046 if ( $rev->getPageId( $this->wikiId ) !== $pageId ) {
3047 throw new InvalidArgumentException(
3048 "Revision {$rev->getId( $this->wikiId )} doesn't belong to page {$pageId}"
3074 $options = (array)$options;
3077 if ( in_array( self::INCLUDE_OLD, $options ) ) {
3080 if ( in_array( self::INCLUDE_NEW, $options ) ) {
3083 if ( in_array( self::INCLUDE_BOTH, $options ) ) {
3090 $oldTs =
$dbr->addQuotes(
$dbr->timestamp( $old->getTimestamp() ) );
3091 $conds[] =
"(rev_timestamp = {$oldTs} AND rev_id {$oldCmp} {$old->getId( $this->wikiId )}) " .
3092 "OR rev_timestamp > {$oldTs}";
3095 $newTs =
$dbr->addQuotes(
$dbr->timestamp( $new->getTimestamp() ) );
3096 $conds[] =
"(rev_timestamp = {$newTs} AND rev_id {$newCmp} {$new->getId( $this->wikiId )}) " .
3097 "OR rev_timestamp < {$newTs}";
3134 ?
string $order =
null,
3135 int $flags = IDBAccessObject::READ_NORMAL
3137 $this->assertRevisionParameter(
'old', $pageId, $old );
3138 $this->assertRevisionParameter(
'new', $pageId, $new );
3140 $options = (array)$options;
3141 $includeOld = in_array( self::INCLUDE_OLD, $options ) ||
3142 in_array( self::INCLUDE_BOTH, $options );
3143 $includeNew = in_array( self::INCLUDE_NEW, $options ) ||
3144 in_array( self::INCLUDE_BOTH, $options );
3150 if ( $old && $new && $new->getId( $this->wikiId ) === $old->getId( $this->wikiId ) ) {
3151 return $includeOld || $includeNew ? [ $new->getId( $this->wikiId ) ] : [];
3154 $db = $this->getDBConnectionRefForQueryFlags( $flags );
3155 $conds = array_merge(
3157 'rev_page' => $pageId,
3158 $db->bitAnd(
'rev_deleted', RevisionRecord::DELETED_TEXT ) .
' = 0'
3160 $this->getRevisionLimitConditions( $db, $old, $new, $options )
3164 if ( $order !==
null ) {
3165 $queryOptions[
'ORDER BY'] = [
"rev_timestamp $order",
"rev_id $order" ];
3167 if ( $max !==
null ) {
3168 $queryOptions[
'LIMIT'] = $max + 1;
3171 $values = $db->selectFieldValues(
3178 return array_map(
'intval', $values );
3210 $this->assertRevisionParameter(
'old', $pageId, $old );
3211 $this->assertRevisionParameter(
'new', $pageId, $new );
3212 $options = (array)$options;
3218 if ( $old && $new && $new->getId( $this->wikiId ) === $old->getId( $this->wikiId ) ) {
3219 if ( empty( $options ) ) {
3221 } elseif ( $performer ) {
3222 return [ $new->getUser( RevisionRecord::FOR_THIS_USER, $performer ) ];
3224 return [ $new->getUser() ];
3229 $conds = array_merge(
3231 'rev_page' => $pageId,
3232 $dbr->bitAnd(
'rev_deleted', RevisionRecord::DELETED_USER ) .
" = 0"
3234 $this->getRevisionLimitConditions(
$dbr, $old, $new, $options )
3237 $queryOpts = [
'DISTINCT' ];
3238 if ( $max !==
null ) {
3239 $queryOpts[
'LIMIT'] = $max + 1;
3242 $actorQuery = $this->actorMigration->getJoin(
'rev_user' );
3243 return array_map(
function ( $row ) {
3244 return $this->actorStore->newActorFromRowFields(
3246 $row->rev_user_text,
3249 }, iterator_to_array(
$dbr->select(
3250 array_merge( [
'revision' ], $actorQuery[
'tables'] ),
3251 $actorQuery[
'fields'],
3254 $actorQuery[
'joins']
3289 return count( $this->getAuthorsBetween( $pageId, $old, $new, $performer, $max, $options ) );
3319 $this->assertRevisionParameter(
'old', $pageId, $old );
3320 $this->assertRevisionParameter(
'new', $pageId, $new );
3326 if ( $old && $new && $new->getId( $this->wikiId ) === $old->getId( $this->wikiId ) ) {
3331 $conds = array_merge(
3333 'rev_page' => $pageId,
3334 $dbr->bitAnd(
'rev_deleted', RevisionRecord::DELETED_TEXT ) .
" = 0"
3336 $this->getRevisionLimitConditions(
$dbr, $old, $new, $options )
3338 if ( $max !==
null ) {
3339 return $dbr->selectRowCount(
'revision',
'1',
3342 [
'LIMIT' => $max + 1 ]
3345 return (
int)
$dbr->selectField(
'revision',
'count(*)', $conds, __METHOD__ );
3364 $revision->assertWiki( $this->wikiId );
3365 $db = $this->getDBConnectionRef(
DB_REPLICA );
3367 $subquery = $db->buildSelectSubquery(
3370 [
'rev_page' => $revision->
getPageId( $this->wikiId ) ],
3374 'rev_timestamp DESC',
3378 'LIMIT' => $searchLimit,
3386 $revisionRow = $db->selectRow(
3387 [
'recent_revs' => $subquery ],
3389 [
'rev_sha1' => $revision->
getSha1() ],
3393 return $revisionRow ? $this->newRevisionFromRow( $revisionRow ) : null;
3403class_alias( RevisionStore::class,
'MediaWiki\Storage\RevisionStore' );
wfBacktrace( $raw=null)
Get a debug backtrace as a string.
wfDeprecatedMsg( $msg, $version=false, $component=false, $callerOffset=2)
Log a deprecation warning with arbitrary message text.
if(!defined('MW_SETUP_CALLBACK'))
Expand dynamic defaults and shortcuts.
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.
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.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Represents a title within MediaWiki.
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.