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 Job;
|
2022-11-13 07:53:42 +00:00
|
|
|
use MediaWiki\Extension\Notifications\Services;
|
2020-05-22 22:02:34 +00:00
|
|
|
|
|
|
|
class NotificationRequestJob extends Job {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return bool success
|
|
|
|
*/
|
|
|
|
public function run(): bool {
|
|
|
|
$centralId = $this->params['centralId'];
|
2022-11-13 07:53:42 +00:00
|
|
|
$echoServices = Services::getInstance();
|
2020-05-22 22:02:34 +00:00
|
|
|
$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;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|