mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-09-23 10:22:05 +00:00
Decommission Echo* instruments
Completely remove the EchoMail and EchoInteraction instruments, supporting code, and config variables. Note well that the EchoEventLoggingSchemas config included an entry for the already-decommissioned Echo instrument so remove that too. Bug: T344167 Change-Id: Ic0c44737d2c4a78ec19e67b8b8cd4e6cfb8e14fa
This commit is contained in:
parent
cd5804d27d
commit
f4765cdd25
|
@ -106,19 +106,6 @@
|
|||
]
|
||||
},
|
||||
"ResourceModules": {
|
||||
"ext.echo.logger": {
|
||||
"packageFiles": [
|
||||
"logger/mw.echo.Logger.js",
|
||||
{
|
||||
"name": "logger/config.json",
|
||||
"callback": "MediaWiki\\Extension\\Notifications\\Hooks::getLoggerConfigVars"
|
||||
}
|
||||
],
|
||||
"dependencies": [
|
||||
"oojs",
|
||||
"mediawiki.user"
|
||||
]
|
||||
},
|
||||
"ext.echo.ui.desktop": {
|
||||
"scripts": [
|
||||
"ui/mw.echo.ui.BadgeLinkWidget.js",
|
||||
|
@ -191,7 +178,6 @@
|
|||
"dependencies": [
|
||||
"ext.echo.api",
|
||||
"ext.echo.dm",
|
||||
"ext.echo.logger",
|
||||
"ext.echo.secondaryicons",
|
||||
"oojs",
|
||||
"oojs-ui-core",
|
||||
|
@ -996,23 +982,6 @@
|
|||
"EchoCacheVersion": {
|
||||
"value": "1.12"
|
||||
},
|
||||
"EchoEventLoggingVersion": {
|
||||
"value": "1.12"
|
||||
},
|
||||
"EchoEventLoggingSchemas": {
|
||||
"value": {
|
||||
"Echo": {
|
||||
"enabled": false
|
||||
},
|
||||
"EchoMail": {
|
||||
"enabled": false
|
||||
},
|
||||
"EchoInteraction": {
|
||||
"enabled": false
|
||||
}
|
||||
},
|
||||
"merge_strategy": "array_plus_2d"
|
||||
},
|
||||
"AllowArticleReminderNotification": {
|
||||
"value": false,
|
||||
"description": "This is a feature flag to the Article Reminder notification"
|
||||
|
@ -1046,14 +1015,6 @@
|
|||
"description": "Maximum number of push subscriptions that may be stored in the DB at any given time for a single central user ID."
|
||||
}
|
||||
},
|
||||
"attributes": {
|
||||
"EventLogging": {
|
||||
"Schemas": {
|
||||
"EchoInteraction": "/analytics/legacy/echointeraction/1.0.0",
|
||||
"EchoMail": "/analytics/legacy/echomail/1.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"manifest_version": 2,
|
||||
"AutoloadClasses": {
|
||||
"BackfillUnreadWikis": "maintenance/backfillUnreadWikis.php",
|
||||
|
|
|
@ -368,7 +368,6 @@ class EmailBatch {
|
|||
|
||||
// @Todo Push the email to job queue or just send it out directly?
|
||||
UserMailer::send( $toAddress, $fromAddress, $content['subject'], $content['body'], [ 'replyTo' => $replyTo ] );
|
||||
EventLogging::logSchemaEchoMail( $this->mUser, $emailDeliveryMode );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,81 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace MediaWiki\Extension\Notifications;
|
||||
|
||||
use ExtensionRegistry;
|
||||
use MediaWiki\Extension\EventLogging\EventLogging as EventLoggingExt;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\User\UserIdentity;
|
||||
use MediaWiki\WikiMap\WikiMap;
|
||||
|
||||
/**
|
||||
* Static class for handling all kinds of event logging
|
||||
*
|
||||
* TODO: consider making this a service with dependencies injected
|
||||
*/
|
||||
class EventLogging {
|
||||
|
||||
/**
|
||||
* This is the only function that interacts with EventLogging
|
||||
*
|
||||
* Adds common fields, and logs if logging is enabled for the given $schema.
|
||||
*
|
||||
* @param string $schema
|
||||
* @param array $data
|
||||
*/
|
||||
protected static function logEvent( $schema, array $data ) {
|
||||
global $wgEchoEventLoggingSchemas, $wgEchoEventLoggingVersion;
|
||||
|
||||
$schemaConfig = $wgEchoEventLoggingSchemas[$schema];
|
||||
if ( !ExtensionRegistry::getInstance()->isLoaded( 'EventLogging' )
|
||||
|| !$schemaConfig['enabled']
|
||||
) {
|
||||
// If logging for this schema is disabled, it's a no-op.
|
||||
return;
|
||||
}
|
||||
|
||||
$data['version'] = $wgEchoEventLoggingVersion;
|
||||
|
||||
// NOTE: The 'EchoMail' and 'EchoInteraction' events were migrated to the Event Platform
|
||||
// and are no longer using the legacy EventLogging schema from metawiki. $revId is actually
|
||||
// overridden by the EventLoggingSchemas extension attribute in extension.json.
|
||||
EventLoggingExt::logEvent( $schema, -1, $data );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function for logging the event for Schema:EchoEmail
|
||||
* @param UserIdentity $userIdentity
|
||||
* @param string $emailDeliveryMode 'single' (default), 'daily_digest', or 'weekly_digest'
|
||||
*/
|
||||
public static function logSchemaEchoMail( UserIdentity $userIdentity, $emailDeliveryMode = 'single' ) {
|
||||
$data = [
|
||||
'recipientUserId' => $userIdentity->getId(),
|
||||
'emailDeliveryMode' => $emailDeliveryMode
|
||||
];
|
||||
|
||||
self::logEvent( 'EchoMail', $data );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param UserIdentity $userIdentity
|
||||
* @param string $skinName
|
||||
*/
|
||||
public static function logSpecialPageVisit( UserIdentity $userIdentity, $skinName ) {
|
||||
$userEditCount = (int)MediaWikiServices::getInstance()
|
||||
->getUserEditTracker()
|
||||
->getUserEditCount( $userIdentity );
|
||||
self::logEvent(
|
||||
'EchoInteraction',
|
||||
[
|
||||
'context' => 'archive',
|
||||
'action' => 'special-page-visit',
|
||||
'userId' => $userIdentity->getId(),
|
||||
'editCount' => $userEditCount,
|
||||
'notifWiki' => WikiMap::getCurrentWikiId(),
|
||||
// Hack: Figure out if we are in the mobile skin
|
||||
'mobile' => $skinName === 'minerva',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -1465,15 +1465,6 @@ class Hooks implements
|
|||
];
|
||||
}
|
||||
|
||||
public static function getLoggerConfigVars( RL\Context $context, Config $config ) {
|
||||
$schemas = $config->get( 'EchoEventLoggingSchemas' );
|
||||
return [
|
||||
'EchoInteractionLogging' => $schemas['EchoInteraction']['enabled'] &&
|
||||
ExtensionRegistry::getInstance()->isLoaded( 'EventLogging' ),
|
||||
'EchoEventLoggingVersion' => $config->get( 'EchoEventLoggingVersion' )
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WikiPage $article
|
||||
* @param User $user
|
||||
|
|
|
@ -116,7 +116,6 @@ class Notifier {
|
|||
$options = [ 'replyTo' => $replyAddress ];
|
||||
|
||||
UserMailer::send( $toAddress, $fromAddress, $subject, $body, $options );
|
||||
EventLogging::logSchemaEchoMail( $user, 'single' );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -4,7 +4,6 @@ namespace MediaWiki\Extension\Notifications\Special;
|
|||
|
||||
use Html;
|
||||
use MediaWiki\Extension\Notifications\DataOutputFormatter;
|
||||
use MediaWiki\Extension\Notifications\EventLogging;
|
||||
use MediaWiki\Extension\Notifications\NotifUser;
|
||||
use MediaWiki\Extension\Notifications\OOUI\LabelIconWidget;
|
||||
use MediaWiki\Extension\Notifications\SeenTime;
|
||||
|
@ -240,9 +239,6 @@ class SpecialNotifications extends SpecialPage {
|
|||
'oojs-ui.styles.icons-alerts',
|
||||
'oojs-ui.styles.icons-interactions',
|
||||
] );
|
||||
|
||||
// Log visit
|
||||
EventLogging::logSpecialPageVisit( $user, $out->getSkin()->getSkinName() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,141 +0,0 @@
|
|||
( function () {
|
||||
var configVars = require( './config.json' );
|
||||
mw.echo = mw.echo || {};
|
||||
|
||||
/**
|
||||
* Echo logger
|
||||
*
|
||||
* @class
|
||||
*
|
||||
* @constructor
|
||||
* @param {Object} [config] Configuration object
|
||||
* @cfg {boolean} [clickThroughEnabled] Whether logging is enabled
|
||||
*/
|
||||
mw.echo.Logger = function MwEchoUiLogger( config ) {
|
||||
config = config || {};
|
||||
|
||||
this.clickThroughEnabled = config.clickThroughEnabled || this.constructor.static.clickThroughEnabled;
|
||||
this.notificationsIdCache = [];
|
||||
};
|
||||
|
||||
OO.initClass( mw.echo.Logger );
|
||||
|
||||
/* Static methods */
|
||||
|
||||
/**
|
||||
* Default behavior in MediaWiki for whether logging Echo interactions
|
||||
* is enabled
|
||||
*
|
||||
* @static
|
||||
* @property {boolean}
|
||||
*/
|
||||
mw.echo.Logger.static.clickThroughEnabled = !!configVars.EchoInteractionLogging && !mw.user.isAnon();
|
||||
|
||||
/**
|
||||
* Context definitions.
|
||||
*
|
||||
* 'flyout': Interactions from the popup content
|
||||
* 'archive': Interactions from the Special:Notifications page
|
||||
* 'badge': Interactions from the badge button
|
||||
*
|
||||
* @static
|
||||
* @property {Object}
|
||||
*/
|
||||
mw.echo.Logger.static.context = {
|
||||
popup: 'flyout',
|
||||
archive: 'archive',
|
||||
badge: undefined
|
||||
};
|
||||
|
||||
/**
|
||||
* Logging action names for consistency.
|
||||
*
|
||||
* 'notificationClick': Click interaction
|
||||
* 'notificationImpression': Impression interaction
|
||||
*
|
||||
* @static
|
||||
* @property {Object}
|
||||
*/
|
||||
mw.echo.Logger.static.actions = {
|
||||
notificationClick: 'notification-link-click',
|
||||
notificationBundleExpand: 'notification-bundle-expand',
|
||||
notificationImpression: 'notification-impression',
|
||||
markAllReadClick: 'mark-all-read-click',
|
||||
markXWikiReadClick: 'mark-entire-xwiki-bundle-read-click'
|
||||
};
|
||||
|
||||
/* Methods */
|
||||
|
||||
/**
|
||||
* Log all Echo interaction related events
|
||||
*
|
||||
* @param {string} action The interaction
|
||||
* @param {string} [context] 'flyout'/'archive' or undefined for the badge
|
||||
* @param {number} [eventId] Notification event id
|
||||
* @param {string} [eventType] notification type
|
||||
* @param {boolean} [mobile] True if interaction was on a mobile device
|
||||
* @param {string} [notifWiki] Foreign wiki the notification came from
|
||||
*/
|
||||
mw.echo.Logger.prototype.logInteraction = function ( action, context, eventId, eventType, mobile, notifWiki ) {
|
||||
var myEvt;
|
||||
|
||||
if ( !this.constructor.static.clickThroughEnabled ) {
|
||||
return;
|
||||
}
|
||||
|
||||
myEvt = {
|
||||
action: action,
|
||||
version: configVars.EchoEventLoggingVersion,
|
||||
userId: +mw.config.get( 'wgUserId' ),
|
||||
editCount: +mw.config.get( 'wgUserEditCount' )
|
||||
};
|
||||
|
||||
// All the fields below are optional
|
||||
if ( context ) {
|
||||
myEvt.context = context;
|
||||
}
|
||||
if ( eventId ) {
|
||||
myEvt.eventId = Number( eventId );
|
||||
}
|
||||
if ( eventType ) {
|
||||
myEvt.notificationType = eventType;
|
||||
}
|
||||
if ( mobile !== undefined || mw.config.get( 'skin' ) === 'minerva' ) {
|
||||
myEvt.mobile = mobile || mw.config.get( 'skin' ) === 'minerva';
|
||||
}
|
||||
|
||||
if ( notifWiki && notifWiki !== mw.config.get( 'wgWikiID' ) && notifWiki !== 'local' ) {
|
||||
myEvt.notifWiki = notifWiki;
|
||||
}
|
||||
|
||||
mw.track( 'event.EchoInteraction', myEvt );
|
||||
};
|
||||
|
||||
/**
|
||||
* Log the impression of notifications. This will log each notification exactly once.
|
||||
*
|
||||
* @param {string} type Notification type; 'alert' or 'message'
|
||||
* @param {number[]} notificationIds Array of notification ids
|
||||
* @param {string} context 'flyout'/'archive' or undefined for the badge
|
||||
* @param {string} [notifWiki='local'] Foreign wiki the notifications came from
|
||||
* @param {boolean} [mobile=false] True if interaction was on a mobile device
|
||||
*/
|
||||
mw.echo.Logger.prototype.logNotificationImpressions = function ( type, notificationIds, context, notifWiki, mobile ) {
|
||||
var i, len, key;
|
||||
|
||||
for ( i = 0, len = notificationIds.length; i < len; i++ ) {
|
||||
key = notifWiki && notifWiki !== mw.config.get( 'wgWikiID' ) && notifWiki !== 'local' ?
|
||||
notificationIds[ i ] + '-' + notifWiki :
|
||||
notificationIds[ i ];
|
||||
|
||||
if ( !this.notificationsIdCache[ key ] ) {
|
||||
// Log notification impression
|
||||
this.logInteraction( 'notification-impression', context, notificationIds[ i ], type, mobile, notifWiki );
|
||||
// Cache
|
||||
this.notificationsIdCache[ key ] = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
mw.echo.logger = new mw.echo.Logger();
|
||||
}() );
|
|
@ -95,23 +95,6 @@
|
|||
|
||||
/* Methods */
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
mw.echo.ui.BundleNotificationItemWidget.prototype.onPrimaryLinkClick = function () {
|
||||
// Log notification click
|
||||
|
||||
mw.echo.logger.logInteraction(
|
||||
mw.echo.Logger.static.actions.notificationClick,
|
||||
mw.echo.Logger.static.context.popup,
|
||||
this.getModel().getId(),
|
||||
this.getModel().getCategory(),
|
||||
false,
|
||||
// Source of this notification if it is cross-wiki
|
||||
this.bundle ? this.getModel().getSource() : ''
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
|
@ -160,8 +143,6 @@
|
|||
* Only fetch the first time we expand.
|
||||
*/
|
||||
mw.echo.ui.BundleNotificationItemWidget.prototype.expand = function () {
|
||||
var widget = this;
|
||||
|
||||
this.toggleExpanded( !this.expanded );
|
||||
this.updateExpandButton();
|
||||
|
||||
|
@ -170,14 +151,6 @@
|
|||
if ( !this.expanded ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Log the expand action
|
||||
mw.echo.logger.logInteraction(
|
||||
mw.echo.Logger.static.actions.notificationBundleExpand,
|
||||
mw.echo.Logger.static.context.popup,
|
||||
widget.getModel().getId(),
|
||||
widget.getModel().getCategory()
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -129,22 +129,6 @@
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
mw.echo.ui.CrossWikiNotificationItemWidget.prototype.onMarkAsReadButtonClick = function () {
|
||||
// Log this action
|
||||
mw.echo.logger.logInteraction(
|
||||
mw.echo.Logger.static.actions.markXWikiReadClick,
|
||||
mw.echo.Logger.static.context.popup,
|
||||
null, // Event ID is omitted
|
||||
this.controller.getTypeString() // The type of the list in general
|
||||
);
|
||||
|
||||
// Parent method
|
||||
return mw.echo.ui.CrossWikiNotificationItemWidget.super.prototype.onMarkAsReadButtonClick.call( this );
|
||||
};
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
|
@ -154,23 +138,6 @@
|
|||
this.controller.markEntireCrossWikiItemAsRead();
|
||||
};
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
mw.echo.ui.CrossWikiNotificationItemWidget.prototype.onPrimaryLinkClick = function () {
|
||||
// Log notification click
|
||||
|
||||
mw.echo.logger.logInteraction(
|
||||
mw.echo.Logger.static.actions.notificationClick,
|
||||
mw.echo.Logger.static.context.popup,
|
||||
this.getModel().getId(),
|
||||
this.getModel().getCategory(),
|
||||
false,
|
||||
// Source of this notification if it is cross-wiki
|
||||
this.bundle ? this.getModel().getSource() : ''
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Populate the items in this widget according to the data
|
||||
* in the model
|
||||
|
@ -260,14 +227,6 @@
|
|||
return;
|
||||
}
|
||||
|
||||
// Log the expand action
|
||||
mw.echo.logger.logInteraction(
|
||||
mw.echo.Logger.static.actions.notificationBundleExpand,
|
||||
mw.echo.Logger.static.context.popup,
|
||||
widget.getModel().getId(),
|
||||
widget.getModel().getCategory()
|
||||
);
|
||||
|
||||
if ( !this.fetchedOnce ) {
|
||||
// Expand
|
||||
this.pushPending();
|
||||
|
|
|
@ -270,14 +270,6 @@
|
|||
* Respond to 'mark all as read' button click
|
||||
*/
|
||||
mw.echo.ui.NotificationBadgeWidget.prototype.onMarkAllReadButtonClick = function () {
|
||||
// Log the click action
|
||||
mw.echo.logger.logInteraction(
|
||||
mw.echo.Logger.static.actions.markAllReadClick,
|
||||
mw.echo.Logger.static.context.popup,
|
||||
null, // Event id isn't relevant
|
||||
this.manager.getTypeString() // The type of the list
|
||||
);
|
||||
|
||||
this.controller.markLocalNotificationsRead();
|
||||
};
|
||||
|
||||
|
@ -299,14 +291,6 @@
|
|||
return;
|
||||
}
|
||||
|
||||
// Log the click event
|
||||
mw.echo.logger.logInteraction(
|
||||
'ui-badge-link-click',
|
||||
mw.echo.Logger.static.context.badge,
|
||||
null,
|
||||
this.controller.getTypeString()
|
||||
);
|
||||
|
||||
if ( this.hasRunFirstTime ) {
|
||||
// HACK: Clippable doesn't resize the clippable area when
|
||||
// it calculates the new size. Since the popup contents changed
|
||||
|
|
|
@ -44,22 +44,6 @@
|
|||
OO.mixinClass( mw.echo.ui.SingleNotificationItemWidget, OO.ui.mixin.PendingElement );
|
||||
|
||||
/* Methods */
|
||||
mw.echo.ui.SingleNotificationItemWidget.prototype.onPrimaryLinkClick = function () {
|
||||
// Log notification click
|
||||
|
||||
mw.echo.logger.logInteraction(
|
||||
mw.echo.Logger.static.actions.notificationClick,
|
||||
mw.echo.Logger.static.context.popup,
|
||||
this.getModel().getId(),
|
||||
this.getModel().getCategory(),
|
||||
false,
|
||||
// Source of this notification if it is cross-wiki
|
||||
// TODO: For notifications in local bundles, we need
|
||||
// to consider changing this
|
||||
this.bundle ? this.getModel().getSource() : ''
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
|
|
|
@ -106,15 +106,6 @@
|
|||
if ( data.href ) {
|
||||
location.href = data.href;
|
||||
} else if ( data === 'markAllRead' ) {
|
||||
// Log this action
|
||||
mw.echo.logger.logInteraction(
|
||||
mw.echo.Logger.static.actions.markAllReadClick,
|
||||
mw.echo.Logger.static.context.archive,
|
||||
null, // Notification ID is irrelevant
|
||||
this.manager.getTypeString(), // The type of the list in general
|
||||
null, // The Logger has logic to decide whether this is mobile or not
|
||||
this.manager.getFiltersModel().getSourcePagesModel().getCurrentSource() // Source name
|
||||
);
|
||||
this.emit( 'markAllRead' );
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue