mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-18 05:01:25 +00:00
b46751d4ed
The feature manager abstracts away how a feature is enabled from the consumer of that feature. Accordingly, replace direct instantiation of SkinVersionLookup with usage of the Vector.FeatureManager service. Supporting changes: - Add Vector\VectorServices, a simple wrapper around MediaWiki\MediaWikiServices that allows us to both document and type-hint services specific to Vector - Add Vector\Hooks::isSkinVersionLegacy to minimise repetition Additional changes: - Make the MakeGlobalVariablesScript hook handler return early if the user isn't using the Vector skin like the other hook handlers Bug: T256100 Change-Id: I93b5ef39802323c7ac658af8fa7cc312fff68aa7
28 lines
636 B
PHP
28 lines
636 B
PHP
<?php
|
|
|
|
namespace Vector;
|
|
|
|
use MediaWiki\MediaWikiServices;
|
|
use Vector\FeatureManagement\FeatureManager;
|
|
|
|
/**
|
|
* A service locator for services specific to Vector.
|
|
*
|
|
* @package Vector
|
|
* @internal
|
|
*/
|
|
final class VectorServices {
|
|
|
|
/**
|
|
* Gets the feature manager service.
|
|
*
|
|
* Per its definition in ServiceWiring.php, the feature manager service is bound to the global
|
|
* request and user objects and to the _Vector.Config_ service.
|
|
*
|
|
* @return FeatureManager
|
|
*/
|
|
public static function getFeatureManager(): FeatureManager {
|
|
return MediaWikiServices::getInstance()->getService( Constants::SERVICE_FEATURE_MANAGER );
|
|
}
|
|
}
|