mediawiki-skins-Vector/includes/Constants.php

307 lines
6.4 KiB
PHP
Raw Permalink Normal View History

[Special:Preferences] [PHP] Add skin version user preference and configs Add a Vector-specific user preference to Special:Preferences for toggling skin version, either Legacy Vector or the latest Vector. The presentation of the new preference section and the default values for anonymous, new, and existing accounts are configurable via $wgVectorShowSkinPreferences, $wgVectorDefaultSkinVersion (to be used by the feature manager in T244481), $wgVectorDefaultSkinVersionForExistingAccounts, and $wgVectorDefaultSkinVersionForNewAccounts. These configurations default to the fullest experience so that third-party configuration is minimal. See skin.json for details. The configurations are each tested in VectorHooksTest.php. When presentation is enabled, the new preference appears as a checkbox; enabled is Legacy mode and disable is latest. There are a number of unfortunate details: - Showing and hiding a checkbox is supported by OOUI. Showing and hiding a whole section (Vector skin preferences, in this case) is not so this additional client JavaScript functionality is added in Core (see Iaf68b238a8ac7a4fb22b9ef5d6c5a3394ee2e377). - Stylization as a checkbox is wanted. However, the implied storage type for OOUI checkboxes is a boolean. This is not wanted in the event that another skin version is added (e.g., '3' or 'alpha'). As a workaround, the preference is converted from a boolean to a version string ('1' or '2') on save in Hooks::onPreferencesFormPreSave() and from a version string to a checkbox enable / disable string ('1' or '0') in onGetPreferences(). There a number of test cases to help cover these concerning details. Documentation for overriding the skin version as a URL query parameter is provided in anticipation of T244481. Bug: T242381 Bug: T245793 Depends-On: Iaf68b238a8ac7a4fb22b9ef5d6c5a3394ee2e377 Depends-On: Ifc2863fca9cd9efd11ac30c780420e8d89e8cb22 Change-Id: I177dad88fc982170641059b6a4f53fbb38eefad6
2020-01-23 21:53:09 +00:00
<?php
namespace MediaWiki\Skins\Vector;
[Special:Preferences] [PHP] Add skin version user preference and configs Add a Vector-specific user preference to Special:Preferences for toggling skin version, either Legacy Vector or the latest Vector. The presentation of the new preference section and the default values for anonymous, new, and existing accounts are configurable via $wgVectorShowSkinPreferences, $wgVectorDefaultSkinVersion (to be used by the feature manager in T244481), $wgVectorDefaultSkinVersionForExistingAccounts, and $wgVectorDefaultSkinVersionForNewAccounts. These configurations default to the fullest experience so that third-party configuration is minimal. See skin.json for details. The configurations are each tested in VectorHooksTest.php. When presentation is enabled, the new preference appears as a checkbox; enabled is Legacy mode and disable is latest. There are a number of unfortunate details: - Showing and hiding a checkbox is supported by OOUI. Showing and hiding a whole section (Vector skin preferences, in this case) is not so this additional client JavaScript functionality is added in Core (see Iaf68b238a8ac7a4fb22b9ef5d6c5a3394ee2e377). - Stylization as a checkbox is wanted. However, the implied storage type for OOUI checkboxes is a boolean. This is not wanted in the event that another skin version is added (e.g., '3' or 'alpha'). As a workaround, the preference is converted from a boolean to a version string ('1' or '2') on save in Hooks::onPreferencesFormPreSave() and from a version string to a checkbox enable / disable string ('1' or '0') in onGetPreferences(). There a number of test cases to help cover these concerning details. Documentation for overriding the skin version as a URL query parameter is provided in anticipation of T244481. Bug: T242381 Bug: T245793 Depends-On: Iaf68b238a8ac7a4fb22b9ef5d6c5a3394ee2e377 Depends-On: Ifc2863fca9cd9efd11ac30c780420e8d89e8cb22 Change-Id: I177dad88fc982170641059b6a4f53fbb38eefad6
2020-01-23 21:53:09 +00:00
use FatalError;
/**
* A namespace for Vector constants for internal Vector usage only. **Do not rely on this file as an
* API as it may change without warning at any time.**
* @package Vector
* @internal
[Special:Preferences] [PHP] Add skin version user preference and configs Add a Vector-specific user preference to Special:Preferences for toggling skin version, either Legacy Vector or the latest Vector. The presentation of the new preference section and the default values for anonymous, new, and existing accounts are configurable via $wgVectorShowSkinPreferences, $wgVectorDefaultSkinVersion (to be used by the feature manager in T244481), $wgVectorDefaultSkinVersionForExistingAccounts, and $wgVectorDefaultSkinVersionForNewAccounts. These configurations default to the fullest experience so that third-party configuration is minimal. See skin.json for details. The configurations are each tested in VectorHooksTest.php. When presentation is enabled, the new preference appears as a checkbox; enabled is Legacy mode and disable is latest. There are a number of unfortunate details: - Showing and hiding a checkbox is supported by OOUI. Showing and hiding a whole section (Vector skin preferences, in this case) is not so this additional client JavaScript functionality is added in Core (see Iaf68b238a8ac7a4fb22b9ef5d6c5a3394ee2e377). - Stylization as a checkbox is wanted. However, the implied storage type for OOUI checkboxes is a boolean. This is not wanted in the event that another skin version is added (e.g., '3' or 'alpha'). As a workaround, the preference is converted from a boolean to a version string ('1' or '2') on save in Hooks::onPreferencesFormPreSave() and from a version string to a checkbox enable / disable string ('1' or '0') in onGetPreferences(). There a number of test cases to help cover these concerning details. Documentation for overriding the skin version as a URL query parameter is provided in anticipation of T244481. Bug: T242381 Bug: T245793 Depends-On: Iaf68b238a8ac7a4fb22b9ef5d6c5a3394ee2e377 Depends-On: Ifc2863fca9cd9efd11ac30c780420e8d89e8cb22 Change-Id: I177dad88fc982170641059b6a4f53fbb38eefad6
2020-01-23 21:53:09 +00:00
*/
final class Constants {
/**
* This is tightly coupled to the ValidSkinNames field in skin.json.
[Special:Preferences] [PHP] Add skin version user preference and configs Add a Vector-specific user preference to Special:Preferences for toggling skin version, either Legacy Vector or the latest Vector. The presentation of the new preference section and the default values for anonymous, new, and existing accounts are configurable via $wgVectorShowSkinPreferences, $wgVectorDefaultSkinVersion (to be used by the feature manager in T244481), $wgVectorDefaultSkinVersionForExistingAccounts, and $wgVectorDefaultSkinVersionForNewAccounts. These configurations default to the fullest experience so that third-party configuration is minimal. See skin.json for details. The configurations are each tested in VectorHooksTest.php. When presentation is enabled, the new preference appears as a checkbox; enabled is Legacy mode and disable is latest. There are a number of unfortunate details: - Showing and hiding a checkbox is supported by OOUI. Showing and hiding a whole section (Vector skin preferences, in this case) is not so this additional client JavaScript functionality is added in Core (see Iaf68b238a8ac7a4fb22b9ef5d6c5a3394ee2e377). - Stylization as a checkbox is wanted. However, the implied storage type for OOUI checkboxes is a boolean. This is not wanted in the event that another skin version is added (e.g., '3' or 'alpha'). As a workaround, the preference is converted from a boolean to a version string ('1' or '2') on save in Hooks::onPreferencesFormPreSave() and from a version string to a checkbox enable / disable string ('1' or '0') in onGetPreferences(). There a number of test cases to help cover these concerning details. Documentation for overriding the skin version as a URL query parameter is provided in anticipation of T244481. Bug: T242381 Bug: T245793 Depends-On: Iaf68b238a8ac7a4fb22b9ef5d6c5a3394ee2e377 Depends-On: Ifc2863fca9cd9efd11ac30c780420e8d89e8cb22 Change-Id: I177dad88fc982170641059b6a4f53fbb38eefad6
2020-01-23 21:53:09 +00:00
* @var string
*/
public const SKIN_NAME_MODERN = 'vector-2022';
/**
* This is tightly coupled to the ValidSkinNames field in skin.json.
* @var string
*/
public const SKIN_NAME_LEGACY = 'vector';
[Special:Preferences] [PHP] Add skin version user preference and configs Add a Vector-specific user preference to Special:Preferences for toggling skin version, either Legacy Vector or the latest Vector. The presentation of the new preference section and the default values for anonymous, new, and existing accounts are configurable via $wgVectorShowSkinPreferences, $wgVectorDefaultSkinVersion (to be used by the feature manager in T244481), $wgVectorDefaultSkinVersionForExistingAccounts, and $wgVectorDefaultSkinVersionForNewAccounts. These configurations default to the fullest experience so that third-party configuration is minimal. See skin.json for details. The configurations are each tested in VectorHooksTest.php. When presentation is enabled, the new preference appears as a checkbox; enabled is Legacy mode and disable is latest. There are a number of unfortunate details: - Showing and hiding a checkbox is supported by OOUI. Showing and hiding a whole section (Vector skin preferences, in this case) is not so this additional client JavaScript functionality is added in Core (see Iaf68b238a8ac7a4fb22b9ef5d6c5a3394ee2e377). - Stylization as a checkbox is wanted. However, the implied storage type for OOUI checkboxes is a boolean. This is not wanted in the event that another skin version is added (e.g., '3' or 'alpha'). As a workaround, the preference is converted from a boolean to a version string ('1' or '2') on save in Hooks::onPreferencesFormPreSave() and from a version string to a checkbox enable / disable string ('1' or '0') in onGetPreferences(). There a number of test cases to help cover these concerning details. Documentation for overriding the skin version as a URL query parameter is provided in anticipation of T244481. Bug: T242381 Bug: T245793 Depends-On: Iaf68b238a8ac7a4fb22b9ef5d6c5a3394ee2e377 Depends-On: Ifc2863fca9cd9efd11ac30c780420e8d89e8cb22 Change-Id: I177dad88fc982170641059b6a4f53fbb38eefad6
2020-01-23 21:53:09 +00:00
// These are used to provide different default skin for new users.
[Special:Preferences] [PHP] Add skin version user preference and configs Add a Vector-specific user preference to Special:Preferences for toggling skin version, either Legacy Vector or the latest Vector. The presentation of the new preference section and the default values for anonymous, new, and existing accounts are configurable via $wgVectorShowSkinPreferences, $wgVectorDefaultSkinVersion (to be used by the feature manager in T244481), $wgVectorDefaultSkinVersionForExistingAccounts, and $wgVectorDefaultSkinVersionForNewAccounts. These configurations default to the fullest experience so that third-party configuration is minimal. See skin.json for details. The configurations are each tested in VectorHooksTest.php. When presentation is enabled, the new preference appears as a checkbox; enabled is Legacy mode and disable is latest. There are a number of unfortunate details: - Showing and hiding a checkbox is supported by OOUI. Showing and hiding a whole section (Vector skin preferences, in this case) is not so this additional client JavaScript functionality is added in Core (see Iaf68b238a8ac7a4fb22b9ef5d6c5a3394ee2e377). - Stylization as a checkbox is wanted. However, the implied storage type for OOUI checkboxes is a boolean. This is not wanted in the event that another skin version is added (e.g., '3' or 'alpha'). As a workaround, the preference is converted from a boolean to a version string ('1' or '2') on save in Hooks::onPreferencesFormPreSave() and from a version string to a checkbox enable / disable string ('1' or '0') in onGetPreferences(). There a number of test cases to help cover these concerning details. Documentation for overriding the skin version as a URL query parameter is provided in anticipation of T244481. Bug: T242381 Bug: T245793 Depends-On: Iaf68b238a8ac7a4fb22b9ef5d6c5a3394ee2e377 Depends-On: Ifc2863fca9cd9efd11ac30c780420e8d89e8cb22 Change-Id: I177dad88fc982170641059b6a4f53fbb38eefad6
2020-01-23 21:53:09 +00:00
/**
* @var string
*/
public const SKIN_VERSION_LEGACY = '1';
/**
* @var string
*/
public const SKIN_VERSION_LATEST = '2';
// These are tightly coupled to skin.json's configs. See skin.json for documentation.
[Special:Preferences] [PHP] Add skin version user preference and configs Add a Vector-specific user preference to Special:Preferences for toggling skin version, either Legacy Vector or the latest Vector. The presentation of the new preference section and the default values for anonymous, new, and existing accounts are configurable via $wgVectorShowSkinPreferences, $wgVectorDefaultSkinVersion (to be used by the feature manager in T244481), $wgVectorDefaultSkinVersionForExistingAccounts, and $wgVectorDefaultSkinVersionForNewAccounts. These configurations default to the fullest experience so that third-party configuration is minimal. See skin.json for details. The configurations are each tested in VectorHooksTest.php. When presentation is enabled, the new preference appears as a checkbox; enabled is Legacy mode and disable is latest. There are a number of unfortunate details: - Showing and hiding a checkbox is supported by OOUI. Showing and hiding a whole section (Vector skin preferences, in this case) is not so this additional client JavaScript functionality is added in Core (see Iaf68b238a8ac7a4fb22b9ef5d6c5a3394ee2e377). - Stylization as a checkbox is wanted. However, the implied storage type for OOUI checkboxes is a boolean. This is not wanted in the event that another skin version is added (e.g., '3' or 'alpha'). As a workaround, the preference is converted from a boolean to a version string ('1' or '2') on save in Hooks::onPreferencesFormPreSave() and from a version string to a checkbox enable / disable string ('1' or '0') in onGetPreferences(). There a number of test cases to help cover these concerning details. Documentation for overriding the skin version as a URL query parameter is provided in anticipation of T244481. Bug: T242381 Bug: T245793 Depends-On: Iaf68b238a8ac7a4fb22b9ef5d6c5a3394ee2e377 Depends-On: Ifc2863fca9cd9efd11ac30c780420e8d89e8cb22 Change-Id: I177dad88fc982170641059b6a4f53fbb38eefad6
2020-01-23 21:53:09 +00:00
/**
* @var string
*/
public const CONFIG_KEY_DEFAULT_SKIN_VERSION_FOR_NEW_ACCOUNTS =
'VectorDefaultSkinVersionForNewAccounts';
/**
* @var string
*/
public const PREF_KEY_SKIN = 'skin';
featureManager: Add DynamicConfigRequirement requirement We expect the vast majority of requirements and features to be defined in services as possible. However, there are some "complex" requirements that require additional application/HTTP request state. Unfortunately, service wiring is done before some of that state is available. I65702426 attempted to work around this by requiring clients of the Feature Manager to pass that additional state on every interaction with the system. Those complex requirements would then select the parts of the state that they required when it was required. However implementations of \IContextSource are God objects and their use should be limited. Whilst reviewing I65702426, Stephen Niedzielski mentioned that the application state being available is a requirement. This remarkably simple solution: - Keeps the Requirement interface and FeatureManager API free of God objects; - Is true to the nature of the Feature Manager - it makes clear and centralizes the various checks for application state being available across the codebase; and - Inject a Requirement implementations' dependencies at construction time It just so happens that the $wgFullyInitialised variable flags whether the application state is available... Changes: - Add the the FeatureManager\Requirements\DynamicConfigRequirement class and tests. The DynamicConfigRequirement lazily evaluates a single configuration value whenever ::isMet is invoked - Register an DynamicConfigRequirement instance, configured to evaluate $wgFullyInitialised while constructing the Vector.FeatureManager service Bug: T244481 Change-Id: I7a2cdc2dfdf20d78e4548f07cf53994563b234b3
2020-03-13 17:22:59 +00:00
// These are used in the Feature Management System.
/**
* Also known as `$wgFullyInitialised`. Set to true in core/includes/Setup.php.
featureManager: Add DynamicConfigRequirement requirement We expect the vast majority of requirements and features to be defined in services as possible. However, there are some "complex" requirements that require additional application/HTTP request state. Unfortunately, service wiring is done before some of that state is available. I65702426 attempted to work around this by requiring clients of the Feature Manager to pass that additional state on every interaction with the system. Those complex requirements would then select the parts of the state that they required when it was required. However implementations of \IContextSource are God objects and their use should be limited. Whilst reviewing I65702426, Stephen Niedzielski mentioned that the application state being available is a requirement. This remarkably simple solution: - Keeps the Requirement interface and FeatureManager API free of God objects; - Is true to the nature of the Feature Manager - it makes clear and centralizes the various checks for application state being available across the codebase; and - Inject a Requirement implementations' dependencies at construction time It just so happens that the $wgFullyInitialised variable flags whether the application state is available... Changes: - Add the the FeatureManager\Requirements\DynamicConfigRequirement class and tests. The DynamicConfigRequirement lazily evaluates a single configuration value whenever ::isMet is invoked - Register an DynamicConfigRequirement instance, configured to evaluate $wgFullyInitialised while constructing the Vector.FeatureManager service Bug: T244481 Change-Id: I7a2cdc2dfdf20d78e4548f07cf53994563b234b3
2020-03-13 17:22:59 +00:00
* @var string
*/
public const CONFIG_KEY_FULLY_INITIALISED = 'FullyInitialised';
/**
* @var string
*/
public const REQUIREMENT_FULLY_INITIALISED = 'FullyInitialised';
/**
* @var string
*/
public const REQUIREMENT_LOGGED_IN = 'LoggedIn';
/**
* @var string
*/
public const FEATURE_LANGUAGE_IN_HEADER = 'LanguageInHeader';
/**
* @var string
*/
public const CONFIG_KEY_LANGUAGE_IN_HEADER = 'VectorLanguageInHeader';
/**
* @var string
*/
public const REQUIREMENT_LANGUAGE_IN_HEADER = 'LanguageInHeader';
/**
* @var string
*/
public const CONFIG_STICKY_HEADER = 'VectorStickyHeader';
/**
* @var string
*/
public const REQUIREMENT_STICKY_HEADER = 'StickyHeader';
/**
* @var string
*/
public const FEATURE_STICKY_HEADER = 'StickyHeader';
/**
* Defines whether an A/B test is running.
*
* @var string
*/
public const CONFIG_WEB_AB_TEST_ENROLLMENT = 'VectorWebABTestEnrollment';
/**
* The `mediawiki.searchSuggest` protocol piece of the SearchSatisfaction instrumention reads
* the value of an element with the "data-search-loc" attribute and set the event's
* `inputLocation` property accordingly.
*
* When the search widget is moved as part of the "Search 1: Search widget move" feature, the
* "data-search-loc" attribute is set to this value.
*
* See also:
* - https://www.mediawiki.org/wiki/Reading/Web/Desktop_Improvements/Features#Search_1:_Search_widget_move
* - https://phabricator.wikimedia.org/T261636 and https://phabricator.wikimedia.org/T256100
* - https://gerrit.wikimedia.org/g/mediawiki/core/+/61d36def2d7adc15c88929c824b444f434a0511a/resources/src/mediawiki.searchSuggest/searchSuggest.js#106
*
* @var string
*/
public const SEARCH_BOX_INPUT_LOCATION_MOVED = 'header-moved';
/**
* Similar to `Constants::SEARCH_BOX_INPUT_LOCATION_MOVED`, when the search widget hasn't been
* moved, the "data-search-loc" attribute is set to this value.
*
* @var string
*/
public const SEARCH_BOX_INPUT_LOCATION_DEFAULT = 'header-navigation';
/**
* @var string
*/
public const REQUIREMENT_IS_MAIN_PAGE = 'IsMainPage';
/**
* @var string
*/
public const REQUIREMENT_LANGUAGE_IN_MAIN_PAGE_HEADER = 'LanguageInMainPageHeader';
/**
* @var string
*/
public const CONFIG_LANGUAGE_IN_MAIN_PAGE_HEADER = 'VectorLanguageInMainPageHeader';
/**
* @var string
*/
public const FEATURE_LANGUAGE_IN_MAIN_PAGE_HEADER = 'LanguageInMainPageHeader';
/**
* @var string
*/
public const WEB_AB_TEST_ARTICLE_ID_FACTORY_SERVICE = 'WikimediaEvents.WebABTestArticleIdFactory';
/**
* @var string
*/
public const FEATURE_PAGE_TOOLS_PINNED = 'PageToolsPinned';
/**
* @var string
*/
public const REQUIREMENT_PAGE_TOOLS_PINNED = 'PageToolsPinned';
/**
* @var string
*/
public const PREF_KEY_PAGE_TOOLS_PINNED = 'vector-page-tools-pinned';
/**
* @var string
*/
public const REQUIREMENT_TOC_PINNED = 'TOCPinned';
/**
* @var string
*/
public const PREF_KEY_TOC_PINNED = 'vector-toc-pinned';
/**
* @var string
*/
public const FEATURE_TOC_PINNED = 'TOCPinned';
/**
* @var string
*/
public const FEATURE_MAIN_MENU_PINNED = 'MainMenuPinned';
/**
* @var string
*/
public const REQUIREMENT_MAIN_MENU_PINNED = 'MainMenuPinned';
/**
* @var string
*/
public const PREF_KEY_MAIN_MENU_PINNED = 'vector-main-menu-pinned';
/**
* @var string
*/
public const FEATURE_LIMITED_WIDTH = 'LimitedWidth';
/**
* @var string
*/
public const REQUIREMENT_LIMITED_WIDTH = 'LimitedWidth';
/**
* @var string
*/
public const PREF_KEY_LIMITED_WIDTH = 'vector-limited-width';
/**
* @var string
*/
public const FEATURE_LIMITED_WIDTH_CONTENT = 'LimitedWidthContent';
/**
* @var string
*/
public const REQUIREMENT_LIMITED_WIDTH_CONTENT = 'LimitedWidthContent';
/**
* @var bool
*/
public const CONFIG_DEFAULT_LIMITED_WIDTH = 1;
/**
* @var string
*/
public const PREF_KEY_FONT_SIZE = 'vector-font-size';
/**
* @var string
*/
public const FEATURE_FONT_SIZE = 'CustomFontSize';
/**
* @var string
*/
public const REQUIREMENT_FONT_SIZE = 'CustomFontSize';
/**
* @var string
*/
public const FEATURE_APPEARANCE_PINNED = 'AppearancePinned';
/**
* @var string
*/
public const REQUIREMENT_APPEARANCE_PINNED = 'AppearancePinned';
/**
* @var string
*/
public const PREF_KEY_APPEARANCE_PINNED = 'vector-appearance-pinned';
/**
* @var string
*/
public const CONFIG_KEY_NIGHT_MODE = 'VectorNightMode';
/**
* @var string
*/
public const FEATURE_NIGHT_MODE = 'NightMode';
/**
* @var string
*/
public const REQUIREMENT_NIGHT_MODE = 'NightMode';
/**
* @var string
*/
public const PREF_KEY_NIGHT_MODE = 'vector-theme';
/**
* @var string
*/
public const REQUIREMENT_PREF_NIGHT_MODE = 'PrefNightMode';
/**
* @var string
*/
public const PREF_NIGHT_MODE = 'PrefNightMode';
/**
* @var string
*/
public const VECTOR_2022_BETA_KEY = 'vector-2022-beta-feature';
/**
* @var array
*/
public const VECTOR_BETA_FEATURES = [
self::CONFIG_KEY_NIGHT_MODE,
];
[Special:Preferences] [PHP] Add skin version user preference and configs Add a Vector-specific user preference to Special:Preferences for toggling skin version, either Legacy Vector or the latest Vector. The presentation of the new preference section and the default values for anonymous, new, and existing accounts are configurable via $wgVectorShowSkinPreferences, $wgVectorDefaultSkinVersion (to be used by the feature manager in T244481), $wgVectorDefaultSkinVersionForExistingAccounts, and $wgVectorDefaultSkinVersionForNewAccounts. These configurations default to the fullest experience so that third-party configuration is minimal. See skin.json for details. The configurations are each tested in VectorHooksTest.php. When presentation is enabled, the new preference appears as a checkbox; enabled is Legacy mode and disable is latest. There are a number of unfortunate details: - Showing and hiding a checkbox is supported by OOUI. Showing and hiding a whole section (Vector skin preferences, in this case) is not so this additional client JavaScript functionality is added in Core (see Iaf68b238a8ac7a4fb22b9ef5d6c5a3394ee2e377). - Stylization as a checkbox is wanted. However, the implied storage type for OOUI checkboxes is a boolean. This is not wanted in the event that another skin version is added (e.g., '3' or 'alpha'). As a workaround, the preference is converted from a boolean to a version string ('1' or '2') on save in Hooks::onPreferencesFormPreSave() and from a version string to a checkbox enable / disable string ('1' or '0') in onGetPreferences(). There a number of test cases to help cover these concerning details. Documentation for overriding the skin version as a URL query parameter is provided in anticipation of T244481. Bug: T242381 Bug: T245793 Depends-On: Iaf68b238a8ac7a4fb22b9ef5d6c5a3394ee2e377 Depends-On: Ifc2863fca9cd9efd11ac30c780420e8d89e8cb22 Change-Id: I177dad88fc982170641059b6a4f53fbb38eefad6
2020-01-23 21:53:09 +00:00
/**
* This class is for namespacing constants only. Forbid construction.
* @throws FatalError
* @return never
[Special:Preferences] [PHP] Add skin version user preference and configs Add a Vector-specific user preference to Special:Preferences for toggling skin version, either Legacy Vector or the latest Vector. The presentation of the new preference section and the default values for anonymous, new, and existing accounts are configurable via $wgVectorShowSkinPreferences, $wgVectorDefaultSkinVersion (to be used by the feature manager in T244481), $wgVectorDefaultSkinVersionForExistingAccounts, and $wgVectorDefaultSkinVersionForNewAccounts. These configurations default to the fullest experience so that third-party configuration is minimal. See skin.json for details. The configurations are each tested in VectorHooksTest.php. When presentation is enabled, the new preference appears as a checkbox; enabled is Legacy mode and disable is latest. There are a number of unfortunate details: - Showing and hiding a checkbox is supported by OOUI. Showing and hiding a whole section (Vector skin preferences, in this case) is not so this additional client JavaScript functionality is added in Core (see Iaf68b238a8ac7a4fb22b9ef5d6c5a3394ee2e377). - Stylization as a checkbox is wanted. However, the implied storage type for OOUI checkboxes is a boolean. This is not wanted in the event that another skin version is added (e.g., '3' or 'alpha'). As a workaround, the preference is converted from a boolean to a version string ('1' or '2') on save in Hooks::onPreferencesFormPreSave() and from a version string to a checkbox enable / disable string ('1' or '0') in onGetPreferences(). There a number of test cases to help cover these concerning details. Documentation for overriding the skin version as a URL query parameter is provided in anticipation of T244481. Bug: T242381 Bug: T245793 Depends-On: Iaf68b238a8ac7a4fb22b9ef5d6c5a3394ee2e377 Depends-On: Ifc2863fca9cd9efd11ac30c780420e8d89e8cb22 Change-Id: I177dad88fc982170641059b6a4f53fbb38eefad6
2020-01-23 21:53:09 +00:00
*/
private function __construct() {
throw new FatalError( "Cannot construct a utility class." );
}
}