Make EventLogging a soft dependency

Based on https://gist.github.com/atdt/4652474

Bug: 61880
Change-Id: Ief5ce7eef43ffe4612541627dff2b0fc75b696ab
This commit is contained in:
Prateek Saxena 2014-02-27 13:39:34 +05:30
parent 8a3426268e
commit 7386f10df3
2 changed files with 34 additions and 23 deletions

View file

@ -33,8 +33,33 @@ $wgExtensionCredits['betafeatures'][] = array(
$localBasePath = dirname( __DIR__ ) . '/Popups';
$remoteExtPath = 'Popups';
$wgResourceModules = array_merge( $wgResourceModules, array(
'ext.popups' => array(
$wgAutoloadClasses['PopupsHooks'] = __DIR__ . '/Popups.hooks.php';
$wgExtensionMessagesFiles['Popups'] = __DIR__ . '/Popups.i18n.php';
$wgHooks['GetBetaFeaturePreferences'][] = 'PopupsHooks::getPreferences';
$wgHooks['BeforePageDisplay'][] = 'PopupsHooks::onBeforePageDisplay';
$wgHooks[ 'ResourceLoaderRegisterModules' ][] = function ( ResourceLoader &$resourceLoader ) {
$moduleDependencies = array(
'mediawiki.api',
'mediawiki.jqueryMsg',
'moment',
);
// If EventLogging is present, declare the schema module
// and add it to the array of dependencies.
if ( class_exists( 'ResourceLoaderSchemaModule' ) ) {
$resourceLoader->register( "schema.Popups", array(
'class' => 'ResourceLoaderSchemaModule',
'schema' => 'Popups',
'revision' => 7536956,
) );
$moduleDependencies[] = "schema.Popups";
}
$resourceLoader->register( "ext.popups", array(
'scripts' => array(
'resources/ext.popups.core.js',
),
@ -42,28 +67,13 @@ $wgResourceModules = array_merge( $wgResourceModules, array(
'resources/ext.popups.core.less',
'resources/ext.popups.animation.less',
),
'dependencies' => array(
'mediawiki.api',
'mediawiki.jqueryMsg',
'moment',
),
'dependencies' => $moduleDependencies,
'messages' => array(
'popups-last-edited',
'popups-redirects',
),
'remoteExtPath' => $remoteExtPath,
'localBasePath' => $localBasePath,
),
'schema.Popups' => array(
'class' => 'ResourceLoaderSchemaModule',
'schema' => 'Popups',
'revision' => 7536956,
),
) );
$wgAutoloadClasses['PopupsHooks'] = __DIR__ . '/Popups.hooks.php';
$wgExtensionMessagesFiles['Popups'] = __DIR__ . '/Popups.i18n.php';
$wgHooks['GetBetaFeaturePreferences'][] = 'PopupsHooks::getPreferences';
$wgHooks['BeforePageDisplay'][] = 'PopupsHooks::onBeforePageDisplay';
'remoteExtPath' => 'Popups',
'localBasePath' => dirname( __DIR__ ) . '/Popups',
) );
return true;
};

View file

@ -355,6 +355,7 @@
setTimeout( dfd.reject, 1000 );
elTime = elDuration = elAction = undefined;
}
var logEvent = mw.eventLog ? mw.eventLog.logEvent : function () {};
/**
* @method getSessionId