mediawiki-extensions-Echo/includes/Push/NotificationRequestJob.php
Reedy c76761eff3 Move EchoPush namespace to MediaWiki\Extension\Notifications\Push
Bug: T305667
Change-Id: I5a7846a0fc383bddbf6511d6ba73c8be7d7760c7
2022-04-25 13:56:09 +01:00

27 lines
647 B
PHP

<?php
namespace MediaWiki\Extension\Notifications\Push;
use EchoServices;
use Job;
class NotificationRequestJob extends Job {
/**
* @return bool success
*/
public function run(): bool {
$centralId = $this->params['centralId'];
$echoServices = EchoServices::getInstance();
$subscriptionManager = $echoServices->getPushSubscriptionManager();
$subscriptions = $subscriptionManager->getSubscriptionsForUser( $centralId );
if ( count( $subscriptions ) === 0 ) {
return true;
}
$serviceClient = $echoServices->getPushNotificationServiceClient();
$serviceClient->sendCheckEchoRequests( $subscriptions );
return true;
}
}