| 1 |
<?php |
| 2 |
|
| 3 |
namespace MediaWiki\Extension\Notifications\Push; |
| 4 |
|
| 5 |
use Job; |
| 6 |
use MediaWiki\Extension\Notifications\Services; |
| 7 |
|
| 8 |
class NotificationRequestJob extends Job { |
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
public function run(): bool { |
| 14 |
$centralId = $this->params['centralId']; |
| 15 |
$echoServices = Services::getInstance(); |
| 16 |
$subscriptionManager = $echoServices->getPushSubscriptionManager(); |
| 17 |
$subscriptions = $subscriptionManager->getSubscriptionsForUser( $centralId ); |
| 18 |
if ( count( $subscriptions ) === 0 ) { |
| 19 |
return true; |
| 20 |
} |
| 21 |
$serviceClient = $echoServices->getPushNotificationServiceClient(); |
| 22 |
$serviceClient->sendCheckEchoRequests( $subscriptions ); |
| 23 |
return true; |
| 24 |
} |
| 25 |
|
| 26 |
} |