mediawiki-skins-MinervaNeue/includes/ServiceWiring.php
Piotr Miazga 572ffdf25a Use MediaWikiServices to cache commonly used helpers
SkinMinerva cached the ContentHandler object for better performance.
In the future the ContentHandler will be also used in the Menu,
for better readability, store ContentHandler as Service.

MediaWikiServices will initialize service on first access and cache
it for future needs. Same applies to SkinUserPageHelper,

Bug: T216152
Change-Id: Ia98dc860862360a68556272714669f0c3a13eb1e
2019-04-15 20:50:11 +02:00

14 lines
403 B
PHP

<?php
use MediaWiki\MediaWikiServices;
use MediaWiki\Minerva\SkinUserPageHelper;
return [
'Minerva.ContentHandler' => function ( MediaWikiServices $services ) {
return ContentHandler::getForTitle( RequestContext::getMain()->getTitle() );
},
'Minerva.SkinUserPageHelper' => function ( MediaWikiServices $services ) {
return new SkinUserPageHelper( RequestContext::getMain()->getTitle() );
}
];