Require $wgLocaltimezone to be set

Change-Id: I0e09d87152bf7694c8ada935d5c37c244d70cb69
This commit is contained in:
Ed Sanders 2019-10-28 16:52:37 +00:00
parent c60c154b38
commit 7745d4a610
2 changed files with 16 additions and 0 deletions

View file

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

View file

@ -8,6 +8,21 @@
*/ */
class DiscussionToolsHooks { 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. * Adds DiscussionTools JS to the output.
* *