Merge "Require $wgLocaltimezone to be set"

This commit is contained in:
jenkins-bot 2019-10-29 19:52:23 +00:00 committed by Gerrit Code Review
commit 6ede82f74a
2 changed files with 16 additions and 0 deletions

View file

@ -14,6 +14,7 @@
"MessagesDirs": {
"DiscussionTools": [ "i18n" ]
},
"callback": "DiscussionToolsHooks::onRegistration",
"ResourceFileModulePaths": {
"localBasePath": "modules",
"remoteExtPath": "DiscussionTools/modules"

View file

@ -8,6 +8,21 @@
*/
class DiscussionToolsHooks {
public static function onRegistration() {
global $wgLocaltimezone;
// If $wgLocaltimezone isn't hard-coded, it is evaluated from the system
// timezone. On some systems this isn't guaranteed to be static, for example
// on Debian, GMT can get converted to UTC, instead of Europe/London.
//
// Timestamp parsing assumes that the timezone never changes.
//
// HACK: Do not run this test on CI as $wgLocaltimezone is not configured.
if ( !$wgLocaltimezone && !getenv( 'ZUUL_PROJECT' ) ) {
throw new \ConfigException( 'DiscussionTools requires $wgLocaltimezone to be set' );
}
}
/**
* Adds DiscussionTools JS to the output.
*