mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree
synced 2024-11-27 09:43:06 +00:00
Replace deprecated wfGetDB( DB_REPLICA )
Bug: T330641 Change-Id: Ic2dc694bbb29c3ff315f2be32c24ee6995f9b964
This commit is contained in:
parent
449b72d9e4
commit
b2ef67d9c8
|
@ -24,6 +24,7 @@
|
|||
"class": "MediaWiki\\Extension\\CategoryTree\\ApiCategoryTree",
|
||||
"services": [
|
||||
"ConfigFactory",
|
||||
"DBLoadBalancerFactory",
|
||||
"LanguageConverterFactory",
|
||||
"MainWANObjectCache"
|
||||
]
|
||||
|
|
|
@ -11,6 +11,7 @@ use MediaWiki\Languages\LanguageConverterFactory;
|
|||
use MediaWiki\Title\Title;
|
||||
use WANObjectCache;
|
||||
use Wikimedia\ParamValidator\ParamValidator;
|
||||
use Wikimedia\Rdbms\IConnectionProvider;
|
||||
|
||||
/**
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -36,6 +37,9 @@ class ApiCategoryTree extends ApiBase {
|
|||
/** @var LanguageConverterFactory */
|
||||
private $languageConverterFactory;
|
||||
|
||||
/** @var IConnectionProvider */
|
||||
private $dbProvider;
|
||||
|
||||
/** @var WANObjectCache */
|
||||
private $wanCache;
|
||||
|
||||
|
@ -43,6 +47,7 @@ class ApiCategoryTree extends ApiBase {
|
|||
* @param ApiMain $main
|
||||
* @param string $action
|
||||
* @param ConfigFactory $configFactory
|
||||
* @param IConnectionProvider $dbProvider
|
||||
* @param LanguageConverterFactory $languageConverterFactory
|
||||
* @param WANObjectCache $wanCache
|
||||
*/
|
||||
|
@ -50,12 +55,14 @@ class ApiCategoryTree extends ApiBase {
|
|||
ApiMain $main,
|
||||
$action,
|
||||
ConfigFactory $configFactory,
|
||||
IConnectionProvider $dbProvider,
|
||||
LanguageConverterFactory $languageConverterFactory,
|
||||
WANObjectCache $wanCache
|
||||
) {
|
||||
parent::__construct( $main, $action );
|
||||
$this->configFactory = $configFactory;
|
||||
$this->languageConverterFactory = $languageConverterFactory;
|
||||
$this->dbProvider = $dbProvider;
|
||||
$this->wanCache = $wanCache;
|
||||
}
|
||||
|
||||
|
@ -122,7 +129,7 @@ class ApiCategoryTree extends ApiBase {
|
|||
if ( $condition === 'last-modified' ) {
|
||||
$params = $this->extractRequestParams();
|
||||
$title = CategoryTree::makeTitle( $params['category'] );
|
||||
return wfGetDB( DB_REPLICA )->selectField( 'page', 'page_touched',
|
||||
return $this->dbProvider->getReplicaDatabase()->selectField( 'page', 'page_touched',
|
||||
[
|
||||
'page_namespace' => NS_CATEGORY,
|
||||
'page_title' => $title->getDBkey(),
|
||||
|
|
|
@ -401,7 +401,7 @@ class CategoryTree {
|
|||
return '';
|
||||
}
|
||||
|
||||
$dbr = wfGetDB( DB_REPLICA );
|
||||
$dbr = MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->getReplicaDatabase();
|
||||
|
||||
$inverse = $this->isInverse();
|
||||
$mode = $this->getOption( 'mode' );
|
||||
|
@ -522,7 +522,7 @@ class CategoryTree {
|
|||
public function renderParents( Title $title ) {
|
||||
global $wgCategoryTreeMaxChildren;
|
||||
|
||||
$dbr = wfGetDB( DB_REPLICA );
|
||||
$dbr = MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->getReplicaDatabase();
|
||||
|
||||
$res = $dbr->select(
|
||||
'categorylinks',
|
||||
|
|
Loading…
Reference in a new issue