2020-05-22 22:02:34 +00:00
|
|
|
<?php
|
|
|
|
|
2022-04-08 00:38:27 +00:00
|
|
|
namespace MediaWiki\Extension\Notifications\Push;
|
2020-05-22 22:02:34 +00:00
|
|
|
|
|
|
|
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 );
|
2020-06-10 19:14:00 +00:00
|
|
|
if ( count( $subscriptions ) === 0 ) {
|
|
|
|
return true;
|
|
|
|
}
|
2020-05-22 22:02:34 +00:00
|
|
|
$serviceClient = $echoServices->getPushNotificationServiceClient();
|
2020-06-02 23:21:36 +00:00
|
|
|
$serviceClient->sendCheckEchoRequests( $subscriptions );
|
2020-05-22 22:02:34 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|