mediawiki-extensions-Echo/includes/jobs/NotificationJob.php
jgiannelos c97b8e6851 Implement delayed echo notifications
* EchoEvent now supports `extra` params for job delay and deduplication
* When Echo identifies this type of param it creates a
  DelayedEchoNotificationJob that will be executed after `delay` seconds

Change-Id: Ib0c6789dfe42e9703a67835909e5932c0054089f
2020-10-28 12:11:15 +01:00

18 lines
486 B
PHP

<?php
class EchoNotificationJob extends Job {
public function __construct( Title $title, array $params ) {
$command = isset( $params['jobReleaseTimestamp'] ) ? 'DelayedEchoNotificationJob' : 'EchoNotificationJob';
parent::__construct( $command, $title, $params );
}
public function run() {
$eventMapper = new EchoEventMapper();
$event = $eventMapper->fetchById( $this->params['eventId'], true );
EchoNotificationController::notify( $event, false );
return true;
}
}