mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-14 11:25:10 +00:00
bf51f1f65c
Bug: T273303 Change-Id: I2d940e1944a9d7686bf7bc544a318c88c0b2afad
37 lines
1.3 KiB
PHP
37 lines
1.3 KiB
PHP
<?php
|
|
/**
|
|
* DiscussionTools tag hooks
|
|
*
|
|
* @file
|
|
* @ingroup Extensions
|
|
* @license MIT
|
|
*/
|
|
|
|
namespace MediaWiki\Extension\DiscussionTools\Hooks;
|
|
|
|
use ConfigException;
|
|
|
|
class RegistrationHooks {
|
|
public static function onRegistration() : void {
|
|
// Use globals instead of Config. Accessing it so early blows up unrelated extensions (T255704).
|
|
global $wgLocaltimezone, $wgFragmentMode;
|
|
// HACK: Do not run these tests on CI as the globals are not configured.
|
|
if ( getenv( 'ZUUL_PROJECT' ) ) {
|
|
return;
|
|
}
|
|
// 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.
|
|
if ( !$wgLocaltimezone ) {
|
|
throw new ConfigException( 'DiscussionTools requires $wgLocaltimezone to be set' );
|
|
}
|
|
// If $wgFragmentMode is set to use 'legacy' encoding, determining the IDs of our thread
|
|
// headings is harder, especially since the implementation is different in Parsoid.
|
|
if ( !isset( $wgFragmentMode[0] ) || $wgFragmentMode[0] !== 'html5' ) {
|
|
throw new ConfigException( 'DiscussionTools requires $wgFragmentMode to be set to ' .
|
|
"[ 'html5', 'legacy' ] or [ 'html5' ]" );
|
|
}
|
|
}
|
|
}
|