mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-09-23 18:29:35 +00:00
Make EventLogging a soft dependency
Based on https://gist.github.com/atdt/4652474 Bug: 61880 Change-Id: Ief5ce7eef43ffe4612541627dff2b0fc75b696ab
This commit is contained in:
parent
8a3426268e
commit
7386f10df3
56
Popups.php
56
Popups.php
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -355,6 +355,7 @@
|
|||
setTimeout( dfd.reject, 1000 );
|
||||
elTime = elDuration = elAction = undefined;
|
||||
}
|
||||
var logEvent = mw.eventLog ? mw.eventLog.logEvent : function () {};
|
||||
|
||||
/**
|
||||
* @method getSessionId
|
||||
|
|
Loading…
Reference in a new issue