Namespace Jobs

Change-Id: Ib8870284465e00308f475fe492fa579babe23d79
This commit is contained in:
Reedy 2022-11-01 22:15:17 -06:00
parent d3cc06cc6a
commit 6046c48593
4 changed files with 22 additions and 12 deletions

View file

@ -47,8 +47,8 @@
"MediaWiki\\Extension\\Notifications\\Hooks::initEchoExtension"
],
"JobClasses": {
"EchoNotificationJob": "EchoNotificationJob",
"EchoNotificationDeleteJob": "EchoNotificationDeleteJob",
"EchoNotificationJob": "MediaWiki\\Extension\\Notifications\\Jobs\\NotificationJob",
"EchoNotificationDeleteJob": "MediaWiki\\Extension\\Notifications\\Jobs\\EchoNotificationDeleteJob",
"EchoPushNotificationRequest": "MediaWiki\\Extension\\Notifications\\Push\\NotificationRequestJob"
},
"SpecialPages": {
@ -1104,8 +1104,6 @@
"EchoMultipleIterator": "includes/iterator/MultipleIterator.php",
"EchoNotRecursiveIterator": "includes/iterator/NotRecursiveIterator.php",
"EchoNotification": "includes/model/Notification.php",
"EchoNotificationDeleteJob": "includes/jobs/NotificationDeleteJob.php",
"EchoNotificationJob": "includes/jobs/NotificationJob.php",
"EchoNotificationMapper": "includes/mapper/NotificationMapper.php",
"EchoNotifier": "includes/Notifier.php",
"EchoOnWikiList": "includes/EchoOnWikiList.php",

View file

@ -9,14 +9,14 @@ use EchoContainmentList;
use EchoContainmentSet;
use EchoEvent;
use EchoFilteredSequentialIterator;
use EchoNotificationDeleteJob;
use EchoNotificationJob;
use EchoOnWikiList;
use EchoServices;
use Hooks;
use Iterator;
use MapCacheLRU;
use MediaWiki\Extension\Notifications\Exception\CatchableFatalErrorException;
use MediaWiki\Extension\Notifications\Jobs\NotificationDeleteJob;
use MediaWiki\Extension\Notifications\Jobs\NotificationJob;
use MediaWiki\Logger\LoggerFactory;
use MediaWiki\MediaWikiServices;
use MediaWiki\Revision\RevisionStore;
@ -214,7 +214,7 @@ class NotificationController {
return;
}
$job = new EchoNotificationDeleteJob(
$job = new NotificationDeleteJob(
$event->getTitle() ?: Title::newMainPage(),
[
'userIds' => $userIds
@ -265,7 +265,7 @@ class NotificationController {
$queue = MediaWikiServices::getInstance()->getJobQueueGroup();
$params = self::getEventParams( $event );
$job = new EchoNotificationJob(
$job = new NotificationJob(
$event->getTitle() ?: Title::newMainPage(), $params
);

View file

@ -1,6 +1,13 @@
<?php
namespace MediaWiki\Extension\Notifications\Jobs;
use EchoNotificationMapper;
use Job;
use MediaWiki\MediaWikiServices;
use MWEchoNotifUser;
use Title;
use User;
/**
* This job is created when sending notifications to the target users. The purpose
@ -13,7 +20,7 @@ use MediaWiki\MediaWikiServices;
* The initial job contains multiple users, which will in turn have individual jobs
* queued for them.
*/
class EchoNotificationDeleteJob extends Job {
class NotificationDeleteJob extends Job {
/**
* @param Title $title
@ -33,7 +40,7 @@ class EchoNotificationDeleteJob extends Job {
// If there are multiple users, queue a single job for each one
$jobs = [];
foreach ( $this->params['userIds'] as $userId ) {
$jobs[] = new EchoNotificationDeleteJob( $this->title, [ 'userIds' => [ $userId ] ] );
$jobs[] = new NotificationDeleteJob( $this->title, [ 'userIds' => [ $userId ] ] );
}
MediaWikiServices::getInstance()->getJobQueueGroup()->push( $jobs );

View file

@ -1,8 +1,13 @@
<?php
use MediaWiki\Extension\Notifications\Controller\NotificationController;
namespace MediaWiki\Extension\Notifications\Jobs;
class EchoNotificationJob extends Job {
use EchoEventMapper;
use Job;
use MediaWiki\Extension\Notifications\Controller\NotificationController;
use Title;
class NotificationJob extends Job {
public function __construct( Title $title, array $params ) {
$command = isset( $params['jobReleaseTimestamp'] ) ? 'DelayedEchoNotificationJob' : 'EchoNotificationJob';