Change-Id: I527388514489e79c53b6016a8bd3119ee1750c83
$store = new RevisionStore(
$services->getDBLoadBalancer(),
$blobStore,
$store = new RevisionStore(
$services->getDBLoadBalancer(),
$blobStore,
- $services->getMainWANObjectCache()
+ $services->getMainWANObjectCache(),
+ $services->getCommentStore()
);
$store->setLogger( LoggerFactory::getInstance( 'RevisionStore' ) );
);
$store->setLogger( LoggerFactory::getInstance( 'RevisionStore' ) );
+ /**
+ * @var CommentStore
+ */
+ private $commentStore;
+
/**
* @var LoggerInterface
*/
/**
* @var LoggerInterface
*/
* @param LoadBalancer $loadBalancer
* @param SqlBlobStore $blobStore
* @param WANObjectCache $cache
* @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,
* @param bool|string $wikiId
*/
public function __construct(
LoadBalancer $loadBalancer,
SqlBlobStore $blobStore,
WANObjectCache $cache,
+ CommentStore $commentStore,
$wikiId = false
) {
Assert::parameterType( 'string|boolean', $wikiId, '$wikiId' );
$wikiId = false
) {
Assert::parameterType( 'string|boolean', $wikiId, '$wikiId' );
$this->loadBalancer = $loadBalancer;
$this->blobStore = $blobStore;
$this->cache = $cache;
$this->loadBalancer = $loadBalancer;
$this->blobStore = $blobStore;
$this->cache = $cache;
+ $this->commentStore = $commentStore;
$this->wikiId = $wikiId;
$this->logger = new NullLogger();
}
$this->wikiId = $wikiId;
$this->logger = new NullLogger();
}
}
list( $commentFields, $commentCallback ) =
}
list( $commentFields, $commentCallback ) =
- CommentStore::getStore()->insertWithTempTable( $dbw, 'rev_comment', $comment );
+ $this->commentStore->insertWithTempTable( $dbw, 'rev_comment', $comment );
$row += $commentFields;
if ( $this->contentHandlerUseDB ) {
$row += $commentFields;
if ( $this->contentHandlerUseDB ) {
$user = $this->getUserIdentityFromRowObject( $row, 'ar_' );
$user = $this->getUserIdentityFromRowObject( $row, 'ar_' );
- $comment = CommentStore::getStore()
+ $comment = $this->commentStore
// Legacy because $row may have come from self::selectFields()
->getCommentLegacy( $this->getDBConnection( DB_REPLICA ), 'ar_comment', $row, true );
// Legacy because $row may have come from self::selectFields()
->getCommentLegacy( $this->getDBConnection( DB_REPLICA ), 'ar_comment', $row, true );
$user = $this->getUserIdentityFromRowObject( $row );
$user = $this->getUserIdentityFromRowObject( $row );
- $comment = CommentStore::getStore()
+ $comment = $this->commentStore
// Legacy because $row may have come from self::selectFields()
->getCommentLegacy( $this->getDBConnection( DB_REPLICA ), 'rev_comment', $row, true );
// Legacy because $row may have come from self::selectFields()
->getCommentLegacy( $this->getDBConnection( DB_REPLICA ), 'rev_comment', $row, true );
- $commentQuery = CommentStore::getStore()->getJoin( 'rev_comment' );
+ $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'] );
$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() {
* - joins: (array) to include in the `$join_conds` to `IDatabase->select()`
*/
public function getArchiveQueryInfo() {
- $commentQuery = CommentStore::getStore()->getJoin( 'ar_comment' );
+ $commentQuery = $this->commentStore->getJoin( 'ar_comment' );
$ret = [
'tables' => [ 'archive' ] + $commentQuery['tables'],
'fields' => [
$ret = [
'tables' => [ 'archive' ] + $commentQuery['tables'],
'fields' => [
$store = new RevisionStore(
$services->getDBLoadBalancer(),
$services->getService( '_SqlBlobStore' ),
$store = new RevisionStore(
$services->getDBLoadBalancer(),
$services->getService( '_SqlBlobStore' ),
- $services->getMainWANObjectCache()
+ $services->getMainWANObjectCache(),
+ $services->getCommentStore()
);
$store->setContentHandlerUseDB( $this->getContentHandlerUseDB() );
);
$store->setContentHandlerUseDB( $this->getContentHandlerUseDB() );
+use MediaWiki\MediaWikiServices;
use MediaWiki\Storage\BlobStoreFactory;
use MediaWiki\Storage\MutableRevisionRecord;
use MediaWiki\Storage\RevisionAccessException;
use MediaWiki\Storage\BlobStoreFactory;
use MediaWiki\Storage\MutableRevisionRecord;
use MediaWiki\Storage\RevisionAccessException;
$cache = $this->getWANObjectCache();
$cache = $this->getWANObjectCache();
- $blobStore = new RevisionStore( $lb, $this->getBlobStore(), $cache );
+ $blobStore = new RevisionStore(
+ $lb,
+ $this->getBlobStore(),
+ $cache,
+ MediaWikiServices::getInstance()->getCommentStore()
+ );
$loadBalancer,
$blobStore,
new WANObjectCache( [ 'cache' => new HashBagOStuff() ] ),
$loadBalancer,
$blobStore,
new WANObjectCache( [ 'cache' => new HashBagOStuff() ] ),
+ MediaWikiServices::getInstance()->getCommentStore(),
use HashBagOStuff;
use Language;
use HashBagOStuff;
use Language;
+use MediaWiki\MediaWikiServices;
use MediaWiki\Storage\RevisionAccessException;
use MediaWiki\Storage\RevisionStore;
use MediaWiki\Storage\SqlBlobStore;
use MediaWiki\Storage\RevisionAccessException;
use MediaWiki\Storage\RevisionStore;
use MediaWiki\Storage\SqlBlobStore;
return new RevisionStore(
$loadBalancer ? $loadBalancer : $this->getMockLoadBalancer(),
$blobStore ? $blobStore : $this->getMockSqlBlobStore(),
return new RevisionStore(
$loadBalancer ? $loadBalancer : $this->getMockLoadBalancer(),
$blobStore ? $blobStore : $this->getMockSqlBlobStore(),
- $WANObjectCache ? $WANObjectCache : $this->getHashWANObjectCache()
+ $WANObjectCache ? $WANObjectCache : $this->getHashWANObjectCache(),
+ MediaWikiServices::getInstance()->getCommentStore()
$blobStore = new SqlBlobStore( wfGetLB(), $cache );
$blobStore->setLegacyEncoding( $encoding, Language::factory( $locale ) );
$blobStore = new SqlBlobStore( wfGetLB(), $cache );
$blobStore->setLegacyEncoding( $encoding, Language::factory( $locale ) );
- $store = new RevisionStore( wfGetLB(), $blobStore, $cache );
+ $store = $this->getRevisionStore( wfGetLB(), $blobStore, $cache );
$record = $store->newRevisionFromRow(
$this->makeRow( $row ),
$record = $store->newRevisionFromRow(
$this->makeRow( $row ),
$blobStore = new SqlBlobStore( wfGetLB(), $cache );
$blobStore->setLegacyEncoding( 'windows-1252', Language::factory( 'en' ) );
$blobStore = new SqlBlobStore( wfGetLB(), $cache );
$blobStore->setLegacyEncoding( 'windows-1252', Language::factory( 'en' ) );
- $store = new RevisionStore( wfGetLB(), $blobStore, $cache );
+ $store = $this->getRevisionStore( wfGetLB(), $blobStore, $cache );
$record = $store->newRevisionFromRow(
$this->makeRow( $row ),
$record = $store->newRevisionFromRow(
$this->makeRow( $row ),