Prepare ULS for EventLogging
This change introduces a new configuration variable, $wgULSEventLogging. When set to true, ULS will register an EventLogging schema module for <http://meta.wikimedia.org/wiki/Schema:UniversalLanguageSelector>, making it possible to log events using `mw.uls.logEvent`. When false, the schema module is not loaded, and `mw.uls.logEvent` is a no-op. Change-Id: I7139e67cc2f830a6b4b3c8ff1fc72dfcdec9a699
This commit is contained in:
@@ -116,6 +116,13 @@ $wgULSIMEEnabled = true;
|
||||
*/
|
||||
$wgULSPosition = 'personal';
|
||||
|
||||
/**
|
||||
* Whether to use EventLogging. The EventLogging extension must be installed
|
||||
* if this option is enabled.
|
||||
* @since 2013.06
|
||||
*/
|
||||
$wgULSEventLogging = false;
|
||||
|
||||
$dir = __DIR__;
|
||||
|
||||
// Internationalization
|
||||
@@ -139,11 +146,12 @@ $wgHooks['UserGetLanguageObject'][] = 'UniversalLanguageSelectorHooks::getLangua
|
||||
$wgHooks['SkinTemplateOutputPageBeforeExec'][] =
|
||||
'UniversalLanguageSelectorHooks::onSkinTemplateOutputPageBeforeExec';
|
||||
|
||||
|
||||
$wgDefaultUserOptions['uls-preferences'] = '';
|
||||
$wgHooks['GetPreferences'][] = 'UniversalLanguageSelectorHooks::onGetPreferences';
|
||||
|
||||
$wgExtensionFunctions[] = function() {
|
||||
global $wgHooks, $wgULSGeoService;
|
||||
global $wgHooks, $wgResourceModules, $wgULSEventLogging, $wgULSGeoService;
|
||||
|
||||
if ( $wgULSGeoService === true ) {
|
||||
$wgHooks['BeforePageDisplay'][] = function( &$out ) {
|
||||
@@ -153,6 +161,24 @@ $wgExtensionFunctions[] = function() {
|
||||
};
|
||||
}
|
||||
|
||||
// If EventLogging integration is enabled, first ensure that the
|
||||
// EventLogging extension is present, then declare schema module.
|
||||
// If it is not present, emit a warning and disable logging.
|
||||
if ( $wgULSEventLogging ) {
|
||||
if ( class_exists( 'ResourceLoaderSchemaModule' ) ) {
|
||||
/// @see https://meta.wikimedia.org/wiki/Schema:UniversalLanguageSelector
|
||||
$wgResourceModules['schema.UniversalLanguageSelector'] = array(
|
||||
'class' => 'ResourceLoaderSchemaModule',
|
||||
'schema' => 'UniversalLanguageSelector',
|
||||
'revision' => 5573536,
|
||||
);
|
||||
} else {
|
||||
wfWarn( 'UniversalLanguageSelector is configured to use EventLogging, but '
|
||||
. 'the extension is is not available. Disabling wgULSEventLogging.' );
|
||||
$wgULSEventLogging = false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user