Vector
Vector is a skin for MediaWiki. Vector has been the default skin on all Wikimedia wikis since 2010.
Loading...
Searching...
No Matches
FeatureManagement Namespace Reference

A simple feature manager. More...

Detailed Description

A simple feature manager.

Some application state changes throughout the lifetime of the application, e.g.

NOTE: This API hasn't settled.

NOTE: This API hasn't settled. It may change at any time without warning. Please don't bind to it unless you absolutely need to.

@unstable

It may change at any time without warning. Please don't bind to it unless you absolutely need to

@unstable

wgSitename or wgFullyInitialised, which signals whether the application boot process has finished and critical resources like database connections are available.

The DynamicStateRequirement allows us to define requirements that lazily evaluate the application state statically, e.g.

=php
$featureManager->registerComplexRequirement(
new DynamicConfigRequirement(
$config,
'Sitename',
'Foo'
)
);

registers a requirement that will evaluate to true only when mediawiki/includes/Setup.php has finished executing (after all service wiring has executed). I.e., every call to Requirement->isMet() reinterrogates the Config object for the current state and returns it. Contrast to

=php
$featureManager->registerRequirement(
'Foo',
$config->get( 'Sitename' )
);

wherein state is evaluated only once at registration time and permanently cached.

NOTE: This API hasn't settled. It may change at any time without warning. Please don't bind to it unless you absolutely need to

@unstable