*/
private $cache;
+ /**
+ * @var CommentStore
+ */
+ private $commentStore;
+
/**
* @var LoggerInterface
*/
* @param LoadBalancer $loadBalancer
* @param SqlBlobStore $blobStore
* @param WANObjectCache $cache
+ * @param CommentStore $commentStore
* @param bool|string $wikiId
*/
public function __construct(
LoadBalancer $loadBalancer,
SqlBlobStore $blobStore,
WANObjectCache $cache,
+ CommentStore $commentStore,
$wikiId = false
) {
Assert::parameterType( 'string|boolean', $wikiId, '$wikiId' );
$this->loadBalancer = $loadBalancer;
$this->blobStore = $blobStore;
$this->cache = $cache;
+ $this->commentStore = $commentStore;
$this->wikiId = $wikiId;
$this->logger = new NullLogger();
}
$this->logger = $logger;
}
+ /**
+ * @return bool Whether the store is read-only
+ */
+ public function isReadOnly() {
+ return $this->blobStore->isReadOnly();
+ }
+
/**
* @return bool
*/
if ( $title ) {
$this->logger->info(
__METHOD__ . ' fell back to READ_LATEST and got a Title.',
- [ 'trace' => wfDebugBacktrace() ]
+ [ 'trace' => wfBacktrace() ]
);
return $title;
}
}
/**
- * Insert a new revision into the database, returning the new revision ID
- * number on success and dies horribly on failure.
+ * Insert a new revision into the database, returning the new revision record
+ * on success and dies horribly on failure.
*
* MCR migration note: this replaces Revision::insertOn
*
}
list( $commentFields, $commentCallback ) =
- CommentStore::newKey( 'rev_comment' )->insertWithTempTable( $dbw, $comment );
+ $this->commentStore->insertWithTempTable( $dbw, 'rev_comment', $comment );
$row += $commentFields;
if ( $this->contentHandlerUseDB ) {
if ( isset( $row->rev_text_id ) && $row->rev_text_id > 0 ) {
$mainSlotRow->cont_address = 'tt:' . $row->rev_text_id;
- } elseif ( isset( $row->ar_id ) ) {
- $mainSlotRow->cont_address = 'ar:' . $row->ar_id;
}
if ( isset( $row->old_text ) ) {
$user = $this->getUserIdentityFromRowObject( $row, 'ar_' );
- $comment = CommentStore::newKey( 'ar_comment' )
+ $comment = $this->commentStore
// Legacy because $row may have come from self::selectFields()
- ->getCommentLegacy( $this->getDBConnection( DB_REPLICA ), $row, true );
+ ->getCommentLegacy( $this->getDBConnection( DB_REPLICA ), 'ar_comment', $row, true );
$mainSlot = $this->emulateMainSlot_1_29( $row, $queryFlags, $title );
$slots = new RevisionSlots( [ 'main' => $mainSlot ] );
$user = $this->getUserIdentityFromRowObject( $row );
- $comment = CommentStore::newKey( 'rev_comment' )
+ $comment = $this->commentStore
// Legacy because $row may have come from self::selectFields()
- ->getCommentLegacy( $this->getDBConnection( DB_REPLICA ), $row, true );
+ ->getCommentLegacy( $this->getDBConnection( DB_REPLICA ), 'rev_comment', $row, true );
$mainSlot = $this->emulateMainSlot_1_29( $row, $queryFlags, $title );
$slots = new RevisionSlots( [ 'main' => $mainSlot ] );
'rev_sha1',
] );
- $commentQuery = CommentStore::newKey( 'rev_comment' )->getJoin();
+ $commentQuery = $this->commentStore->getJoin( 'rev_comment' );
$ret['tables'] = array_merge( $ret['tables'], $commentQuery['tables'] );
$ret['fields'] = array_merge( $ret['fields'], $commentQuery['fields'] );
$ret['joins'] = array_merge( $ret['joins'], $commentQuery['joins'] );
* - joins: (array) to include in the `$join_conds` to `IDatabase->select()`
*/
public function getArchiveQueryInfo() {
- $commentQuery = CommentStore::newKey( 'ar_comment' )->getJoin();
+ $commentQuery = $this->commentStore->getJoin( 'ar_comment' );
$ret = [
'tables' => [ 'archive' ] + $commentQuery['tables'],
'fields' => [