From: Fomafix Date: Sun, 16 Jun 2019 20:30:15 +0000 (+0200) Subject: resourceloader: Define the default language and skin in constants X-Git-Tag: 1.34.0-rc.0~1344^2 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmembres/cotisations/gestion/rappel_supprimer.php?a=commitdiff_plain;h=86a1f6f080a116ebe69728401f1a0391b494cc59;p=lhc%2Fweb%2Fwiklou.git resourceloader: Define the default language and skin in constants This allows to use the default values at several places. Change-Id: I53f29c2162c4cac9caf672e816ebfeb97c452389 --- diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index 2ae6d7495e..8ce4ab9036 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -1721,10 +1721,10 @@ MESSAGE; // match the defaults assumed by ResourceLoaderContext. // Note: This relies on the defaults either being insignificant or forever constant, // as otherwise cached urls could change in meaning when the defaults change. - if ( $lang !== 'qqx' ) { + if ( $lang !== ResourceLoaderContext::DEFAULT_LANG ) { $query['lang'] = $lang; } - if ( $skin !== 'fallback' ) { + if ( $skin !== ResourceLoaderContext::DEFAULT_SKIN ) { $query['skin'] = $skin; } if ( $debug === true ) { diff --git a/includes/resourceloader/ResourceLoaderContext.php b/includes/resourceloader/ResourceLoaderContext.php index f57f13beca..95a81e6d4b 100644 --- a/includes/resourceloader/ResourceLoaderContext.php +++ b/includes/resourceloader/ResourceLoaderContext.php @@ -30,6 +30,9 @@ use MediaWiki\MediaWikiServices; * of a specific loader request. */ class ResourceLoaderContext implements MessageLocalizer { + const DEFAULT_LANG = 'qqx'; + const DEFAULT_SKIN = 'fallback'; + protected $resourceLoader; protected $request; protected $logger; @@ -88,7 +91,7 @@ class ResourceLoaderContext implements MessageLocalizer { // The 'skin' parameter is required. (Not yet enforced.) // For requests without a known skin specified, // use MediaWiki's 'fallback' skin for skin-specific decisions. - $this->skin = 'fallback'; + $this->skin = self::DEFAULT_SKIN; } } @@ -178,7 +181,7 @@ class ResourceLoaderContext implements MessageLocalizer { if ( !Language::isValidBuiltInCode( $lang ) ) { // The 'lang' parameter is required. (Not yet enforced.) // If omitted, localise with the dummy language code. - $lang = 'qqx'; + $lang = self::DEFAULT_LANG; } $this->language = $lang; }