Vector
Vector is a skin for MediaWiki. Vector has been the default skin on all Wikimedia wikis since 2010.
Vector Namespace Reference

A namespace for Vector constants for internal Vector usage only. More...

Classes

class  Constants
 
class  Hooks
 
class  SkinVersionLookup
 
class  VectorServices
 

Detailed Description

A namespace for Vector constants for internal Vector usage only.

A service locator for services specific to Vector.

Given initial dependencies, retrieve the current skin version.

Skin subclass for Vector

Skins extending SkinVector are not supported.

The field on Special:Preferences (and Special:GlobalPreferences) that allows the user to enable/disable the legacy version of the Vector skin.

Presentation hook handlers for Vector skin.

Retrieve the skin version for the request and compare it with Constants::SKIN_VERSION_LATEST.

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

NOTE: This API hasn't settled.

A simple feature manager.

Do not rely on this file as an API as it may change without warning at any time.

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

\FeatureManagement

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

@unstable

\FeatureManagement

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.

{lang=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

{lang=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

\FeatureManagement\Requirements

This requirement is met if the two are equal.

Skin version is evaluated in the following order:

  • useskinversion URL query parameter override. See README.md.
  • User preference. The User object for new and existing accounts are updated by hook according to the VectorDefaultSkinVersionForNewAccounts and VectorDefaultSkinVersionForExistingAccounts config values. See the Vector\Hooks class and skin.json.

    If the skin version is evaluated prior to User preference hook invocations, an incorrect version may be returned as only query parameter and site configuration will be known.

  • Site configuration default. The default is controlled by the VectorDefaultSkinVersion config value. This is used for anonymous users and as a fallback configuration. See skin.json.

This majority of this class is taken from Stephen Niedzielski's Vector\SkinVersionLookup class, which was introduced in d1072d0fdfb1.

@unstable

\FeatureManagement\Requirements

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

@unstable

\FeatureManagement\Requirements

Hook handler method names should be in the form of: on<HookName>()

Per https://phabricator.wikimedia.org/T242381, the field is a checkbox, that, when checked, enables the legacy version of the Vector skin.

HTMLLegacySkinVersionField adapts the boolean storage type of a checkbox field to the string storage type of the Vector skin version preference (e.g. see Constants::SKIN_VERSION_LEGACY).

However, we cannot extend HTMLCheckField to inherit the behavior of a checkbox field. HTMLCheckField::loadDataFromRequest returns boolean values. Returning non-boolean values in HTMLLegacySkinVersionField::loadDataFromRequest would violate Liskov's Substitution Principle. Like HTMLExpiryField, HTMLLegacySkinVersionField proxies to a private instance of HTMLCheckField, adapting parameter and return values where necessary.

\HTMLForm\Fields

This class does no parsing, just the lookup.

Skin version is evaluated in the following order:

  • useskinversion URL query parameter override. See readme.
  • User preference. The User object for new accounts is updated (persisted as a user preference) by hook according to VectorDefaultSkinVersionForNewAccounts. See Hooks and skin.json. The user may then change the preference at will.
  • Site configuration default. The default is controlled by VectorDefaultSkinVersion and VectorDefaultSkinVersionForExistingAccounts based on login state. The former is used for anonymous users and as a fallback configuration, the latter is logged in users (existing accounts). See skin.json.

@unstable