mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Thanks
synced 2024-11-23 14:36:47 +00:00
Switch to ICP and stop using DBAccessObjectUtils::getDBOptions()
We are getting rid of this Bug: T354194 Change-Id: I70c613993647f77259ef0ccf7570e3560b66ef56
This commit is contained in:
parent
ac31054b91
commit
9d4ccf0db4
|
@ -11,12 +11,12 @@ return [
|
|||
): ThanksQueryHelper {
|
||||
return new ThanksQueryHelper(
|
||||
$services->getTitleFactory(),
|
||||
$services->getDBLoadBalancer()
|
||||
$services->getConnectionProvider()
|
||||
);
|
||||
},
|
||||
'ThanksLogStore' => static function ( MediaWikiServices $services ): LogStore {
|
||||
return new LogStore(
|
||||
$services->getDBLoadBalancerFactory(),
|
||||
$services->getConnectionProvider(),
|
||||
$services->getActorNormalization(),
|
||||
new ServiceOptions(
|
||||
LogStore::CONSTRUCTOR_OPTIONS,
|
||||
|
|
|
@ -162,7 +162,7 @@ class EchoCoreThanksPresentationModel extends EchoEventPresentationModel {
|
|||
if ( !$logId ) {
|
||||
$this->logEntry = false;
|
||||
} else {
|
||||
$dbr = MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->getReplicaDatabase();
|
||||
$dbr = MediaWikiServices::getInstance()->getConnectionProvider()->getReplicaDatabase();
|
||||
$this->logEntry = DatabaseLogEntry::newFromId( $logId, $dbr ) ?: false;
|
||||
}
|
||||
return $this->logEntry;
|
||||
|
|
|
@ -5,20 +5,18 @@ use DBAccessObjectUtils;
|
|||
use IDBAccessObject;
|
||||
use MediaWiki\Title\TitleFactory;
|
||||
use MediaWiki\User\UserIdentity;
|
||||
use Wikimedia\Rdbms\ILoadBalancer;
|
||||
use Wikimedia\Rdbms\IConnectionProvider;
|
||||
|
||||
/**
|
||||
* Query module
|
||||
*/
|
||||
class ThanksQueryHelper {
|
||||
/** @var TitleFactory */
|
||||
private TitleFactory $titleFactory;
|
||||
/** @var ILoadBalancer */
|
||||
private ILoadBalancer $loadBalancer;
|
||||
private IConnectionProvider $dbProvider;
|
||||
|
||||
public function __construct( TitleFactory $titleFactory, ILoadBalancer $loadBalancer ) {
|
||||
public function __construct( TitleFactory $titleFactory, IConnectionProvider $dbProvider ) {
|
||||
$this->titleFactory = $titleFactory;
|
||||
$this->loadBalancer = $loadBalancer;
|
||||
$this->dbProvider = $dbProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -36,9 +34,7 @@ class ThanksQueryHelper {
|
|||
int $limit = 1000,
|
||||
int $flags = IDBAccessObject::READ_NORMAL
|
||||
): int {
|
||||
$loadBalancer = $this->loadBalancer;
|
||||
list( $index, $options ) = DBAccessObjectUtils::getDBOptions( $flags );
|
||||
$db = $loadBalancer->getConnection( $index );
|
||||
$db = DBAccessObjectUtils::getDBFromRecency( $this->dbProvider, $flags );
|
||||
$userPage = $this->titleFactory->newFromText( $userIdentity->getName(), NS_USER );
|
||||
$logTitle = $userPage->getDBkey();
|
||||
return $db->newSelectQueryBuilder()
|
||||
|
|
Loading…
Reference in a new issue