Addshore added a comment.

I’m a bit confused about the use of MediaWikiServices there. Consider the following snippet of Cognate’s ServiceWiring.php:

	'CognateRepo' => function ( MediaWikiServices $services ) {
		$repo = new CognateRepo(
			CognateServices::getStore(),
			CognateServices::getCacheInvalidator(),
			$services->getTitleFormatter(),
			CognateServices::getLogger()
		);
		$repo->setStatsdDataFactory( $services->getStatsdDataFactory() );
		return $repo;
	},

This function uses the CognateServices utility methods to get some other services which, ultimately, are also declared in ServiceWiring.php. But those utility methods always use MediaWikiServices::getInstance(), not the $services passed into the CognateRepo callback. So as far as I can tell, it’s possible that CognateRepo contains a mixture of service from two different service locators – the default one, and whatever was passed into the callback. Isn’t that a problem?

@Addshore perhaps you can comment on this? It looks like you were the main person to work on MediaWikiServices in Cognate.

Yes, this should probably get services from the main service locator passed into the function


TASK DETAIL
https://phabricator.wikimedia.org/T196053

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Lucas_Werkmeister_WMDE, Addshore
Cc: gerritbot, Addshore, Lucas_Werkmeister_WMDE, Aklapper, Ladsgroup, Gaboe420, Versusxo, Majesticalreaper22, Giuliamocci, Adrian1985, Cpaulf30, Lahi, Gq86, Baloch007, Darkminds3113, Bsandipan, Lordiis, GoranSMilovanovic, Adik2382, Jayprakash12345, Th3d3v1ls, Ramalepe, Liugev6, QZanden, LawExplorer, Lewizho99, Maathavan, Agabi10, Jonas, Wikidata-bugs, aude, Dinoguy1000, Lydia_Pintscher, Mbch331, Jay8g
_______________________________________________
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to