| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Extension\Notifications\Jobs; |
| 4 | |
| 5 | use Job; |
| 6 | use MediaWiki\Extension\Notifications\Controller\NotificationController; |
| 7 | use MediaWiki\Extension\Notifications\Mapper\EventMapper; |
| 8 | use MediaWiki\Title\Title; |
| 9 | |
| 10 | class NotificationJob extends Job { |
| 11 | |
| 12 | public function __construct( Title $title, array $params ) { |
| 13 | $command = isset( $params['jobReleaseTimestamp'] ) ? 'DelayedEchoNotificationJob' : 'EchoNotificationJob'; |
| 14 | parent::__construct( $command, $title, $params ); |
| 15 | } |
| 16 | |
| 17 | public function run() { |
| 18 | $eventMapper = new EventMapper(); |
| 19 | $event = $eventMapper->fetchById( $this->params['eventId'], true ); |
| 20 | NotificationController::notify( $event, false ); |
| 21 | |
| 22 | return true; |
| 23 | } |
| 24 | } |