getCategory() === 'system' ) { $sender = -1; } else { $agent = $event->getAgent(); if ( $agent ) { $sender = $agent->isAnon() ? $agent->getName() : $agent->getId(); } else { $sender = -1; } } if ( isset( $wgEchoNotifications[$event->getType()]['group'] ) ) { $group = $wgEchoNotifications[$event->getType()]['group']; } else { $group = 'neutral'; } $data = array ( 'version' => $wgEchoConfig['version'], 'eventId' => $event->getId(), 'notificationType' => $event->getType(), 'notificationGroup' => $group, 'sender' => (string)$sender, 'recipientUserId' => $user->getId(), 'recipientEditCount' => (int)$user->getEditCount() ); // Add the source if it exists. (This is mostly for the Thanks extension.) $extra = $event->getExtra(); if ( isset( $extra['source'] ) ) { $data['eventSource'] = (string)$extra['source']; } if( $deliveryMethod == 'email' ) { $data['deliveryMethod'] = 'email'; } else { // whitelist valid delivery methods so it is always valid $data['deliveryMethod'] = 'web'; } self::actuallyLogTheEvent( 'Echo', $data ); } /** * Function for logging the event for Schema:EchoEmail * @param $user User * @param $emailDeliveryMode string */ public static function logSchemaEchoMail( User $user, $emailDeliveryMode = 'single' ) { global $wgEchoConfig; if ( !$wgEchoConfig['eventlogging']['EchoMail']['enabled'] ) { // Only attempt event logging if EchoMail schema is enabled return; } $data = array ( 'version' => $wgEchoConfig['version'], 'recipientUserId' => $user->getId(), 'emailDeliveryMode' => $emailDeliveryMode ); self::actuallyLogTheEvent( 'EchoMail', $data ); } }