mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-18 13:05:50 +00:00
d1072d0fdf
As described in the readme but not implemented until now, this patch enables the skin version to be specified as a URL query parameter. This is useful for testing both skin versions during development and on wiki, as well as enabling sharing URLs with a specific skin (Vector) and skin version (1 or 2). Obtaining the actual skin version requires tying together three input sources, WebRequest, User, and Config. It seems simple but it'd be easy to botch. For this reason, a helper class to correctly interrogate them and tests are provided. Bug: T244481 Change-Id: I52d80942b4270c008d4e45050589ed9220255a50
90 lines
2.1 KiB
PHP
90 lines
2.1 KiB
PHP
<?php
|
|
namespace Vector;
|
|
|
|
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.**
|
|
*/
|
|
final class Constants {
|
|
/**
|
|
* This is tightly coupled to the ConfigRegistry field in skin.json.
|
|
* @var string
|
|
*/
|
|
public const SKIN_NAME = 'vector';
|
|
|
|
// These are tightly coupled to PREF_KEY_SKIN_VERSION and skin.json's configs. See skin.json for
|
|
// documentation.
|
|
/**
|
|
* @var string
|
|
*/
|
|
public const SKIN_VERSION_LEGACY = '1';
|
|
/**
|
|
* @var string
|
|
*/
|
|
public const SKIN_VERSION_LATEST = '2';
|
|
|
|
/**
|
|
* @var string
|
|
*/
|
|
public const SERVICE_CONFIG = 'Vector.Config';
|
|
|
|
/**
|
|
* @var string
|
|
*/
|
|
public const SERVICE_FEATURE_MANAGER = 'Vector.FeatureManager';
|
|
|
|
// These are tightly coupled to skin.json's config.
|
|
/**
|
|
* @var string
|
|
*/
|
|
public const CONFIG_KEY_SHOW_SKIN_PREFERENCES = 'VectorShowSkinPreferences';
|
|
/**
|
|
* @var string
|
|
*/
|
|
public const CONFIG_KEY_DEFAULT_SKIN_VERSION = 'VectorDefaultSkinVersion';
|
|
/**
|
|
* @var string
|
|
*/
|
|
public const CONFIG_KEY_DEFAULT_SKIN_VERSION_FOR_EXISTING_ACCOUNTS =
|
|
'VectorDefaultSkinVersionForExistingAccounts';
|
|
/**
|
|
* @var string
|
|
*/
|
|
public const CONFIG_KEY_DEFAULT_SKIN_VERSION_FOR_NEW_ACCOUNTS =
|
|
'VectorDefaultSkinVersionForNewAccounts';
|
|
|
|
/**
|
|
* @var string
|
|
*/
|
|
public const PREF_KEY_SKIN_VERSION = 'VectorSkinVersion';
|
|
|
|
// These are used in the Feature Management System.
|
|
/**
|
|
* Also known as `$wgFullyInitialised`. Set to true in core/includes/Setup.php.
|
|
* @var string
|
|
*/
|
|
public const CONFIG_KEY_FULLY_INITIALISED = 'FullyInitialised';
|
|
|
|
/**
|
|
* @var string
|
|
*/
|
|
public const REQUIREMENT_FULLY_INITIALISED = 'FullyInitialised';
|
|
|
|
// These are used for query parameters.
|
|
/**
|
|
* Override the skin version user preference and site Config. See readme.
|
|
* @var string
|
|
*/
|
|
public const QUERY_PARAM_SKIN_VERSION = 'useskinversion';
|
|
|
|
/**
|
|
* This class is for namespacing constants only. Forbid construction.
|
|
* @throws FatalError
|
|
*/
|
|
private function __construct() {
|
|
throw new FatalError( "Cannot construct a utility class." );
|
|
}
|
|
}
|