mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Linter
synced 2024-11-11 16:59:40 +00:00
Merge "[DI] Use dependency injection for ApiQueryLinterStats"
This commit is contained in:
commit
0868dd1e83
|
@ -48,7 +48,12 @@
|
|||
"linterrors": "MediaWiki\\Linter\\ApiQueryLintErrors"
|
||||
},
|
||||
"APIMetaModules": {
|
||||
"linterstats": "MediaWiki\\Linter\\ApiQueryLinterStats"
|
||||
"linterstats": {
|
||||
"class": "MediaWiki\\Linter\\ApiQueryLinterStats",
|
||||
"services": [
|
||||
"MainWANObjectCache"
|
||||
]
|
||||
}
|
||||
},
|
||||
"SpecialPages": {
|
||||
"LintErrors": {
|
||||
|
|
|
@ -22,14 +22,20 @@ namespace MediaWiki\Linter;
|
|||
use ApiQuery;
|
||||
use ApiQueryBase;
|
||||
use ApiResult;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use WANObjectCache;
|
||||
|
||||
class ApiQueryLinterStats extends ApiQueryBase {
|
||||
|
||||
private WANObjectCache $cache;
|
||||
|
||||
/**
|
||||
* @param ApiQuery $queryModule
|
||||
* @param string $moduleName
|
||||
* @param WANObjectCache $cache
|
||||
*/
|
||||
public function __construct( ApiQuery $queryModule ) {
|
||||
parent::__construct( $queryModule, 'linterstats', 'lntrst' );
|
||||
public function __construct( ApiQuery $queryModule, string $moduleName, WANObjectCache $cache ) {
|
||||
parent::__construct( $queryModule, $moduleName, 'lntrst' );
|
||||
$this->cache = $cache;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -38,7 +44,7 @@ class ApiQueryLinterStats extends ApiQueryBase {
|
|||
public function execute() {
|
||||
$totalsLookup = new TotalsLookup(
|
||||
new CategoryManager(),
|
||||
MediaWikiServices::getInstance()->getMainWANObjectCache(),
|
||||
$this->cache,
|
||||
new Database( 0 )
|
||||
);
|
||||
$totals = $totalsLookup->getTotals();
|
||||
|
|
Loading…
Reference in a new issue