mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-11 17:00:10 +00:00
Inject service LinkBatchFactory into ApiEchoMute
Change-Id: I98c1d2f6b1aa04eb64cef299a6aca475658bdd74
This commit is contained in:
parent
2dd93768c5
commit
73bd6e8ef1
|
@ -40,6 +40,7 @@
|
|||
"class": "MediaWiki\\Extension\\Notifications\\Api\\ApiEchoMute",
|
||||
"services": [
|
||||
"CentralIdLookup",
|
||||
"LinkBatchFactory",
|
||||
"UserOptionsManager"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace MediaWiki\Extension\Notifications\Api;
|
|||
|
||||
use ApiBase;
|
||||
use ApiMain;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\Cache\LinkBatchFactory;
|
||||
use MediaWiki\Title\Title;
|
||||
use MediaWiki\User\CentralId\CentralIdLookup;
|
||||
use MediaWiki\User\Options\UserOptionsManager;
|
||||
|
@ -15,6 +15,9 @@ class ApiEchoMute extends ApiBase {
|
|||
/** @var CentralIdLookup */
|
||||
private $centralIdLookup;
|
||||
|
||||
/** @var LinkBatchFactory */
|
||||
private $linkBatchFactory;
|
||||
|
||||
/** @var UserOptionsManager */
|
||||
private $userOptionsManager;
|
||||
|
||||
|
@ -34,17 +37,20 @@ class ApiEchoMute extends ApiBase {
|
|||
* @param ApiMain $main
|
||||
* @param string $action
|
||||
* @param CentralIdLookup $centralIdLookup
|
||||
* @param LinkBatchFactory $linkBatchFactory
|
||||
* @param UserOptionsManager $userOptionsManager
|
||||
*/
|
||||
public function __construct(
|
||||
ApiMain $main,
|
||||
$action,
|
||||
CentralIdLookup $centralIdLookup,
|
||||
LinkBatchFactory $linkBatchFactory,
|
||||
UserOptionsManager $userOptionsManager
|
||||
) {
|
||||
parent::__construct( $main, $action );
|
||||
|
||||
$this->centralIdLookup = $centralIdLookup;
|
||||
$this->linkBatchFactory = $linkBatchFactory;
|
||||
$this->userOptionsManager = $userOptionsManager;
|
||||
}
|
||||
|
||||
|
@ -97,7 +103,7 @@ class ApiEchoMute extends ApiBase {
|
|||
|
||||
private function lookupIds( $names, $type ) {
|
||||
if ( $type === 'title' ) {
|
||||
$linkBatch = MediaWikiServices::getInstance()->getLinkBatchFactory()->newLinkBatch();
|
||||
$linkBatch = $this->linkBatchFactory->newLinkBatch();
|
||||
foreach ( $names as $name ) {
|
||||
$linkBatch->addObj( Title::newFromText( $name ) );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue