|
| __construct (TaskManager $taskManager=null, TaskFactory $taskFactory=null, ilLanguage $language=null, ilLogger $logger=null, Container $dic=null, ilMailValueObjectJsonService $objectJsonService=null, int $anonymousUserId=ANONYMOUS_USER_ID) |
|
| run (array $mailValueObjects, int $userId, string $contextId, array $contextParameters, int $mailsPerTask=100) |
|
◆ __construct()
Definition at line 38 of file class.ilMassMailTaskProcessor.php.
References $anonymousUserId, $DIC, $dic, $language, $logger, $objectJsonService, $taskFactory, $taskManager, ilLoggerFactory\getLogger(), ILIAS\UI\examples\Symbol\Glyph\Language\language(), and ILIAS\Repository\logger().
52 if (null === $taskManager) {
57 if (null === $taskFactory) {
62 if (null === $language) {
67 if (null === $logger) {
72 if (null === $objectJsonService) {
static getLogger(string $a_component_id)
Get component logger.
ilMailValueObjectJsonService $objectJsonService
language()
Get interface to the i18n service.
◆ createInteraction()
ilMassMailTaskProcessor::createInteraction |
( |
int |
$userId, |
|
|
string |
$contextId, |
|
|
array |
$contextParameters, |
|
|
|
$remainingObjects |
|
) |
| |
|
private |
Definition at line 153 of file class.ilMassMailTaskProcessor.php.
Referenced by run().
159 $jsonString = $this->objectJsonService->convertToJson($remainingObjects);
161 $task = $this->taskFactory->createTask(ilMassMailDeliveryJob::class, [
165 serialize($contextParameters),
170 $parameters = [$task, $userId];
172 return $this->taskFactory->createTask(
173 ilMailDeliveryJobUserInteraction::class,
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
◆ run()
ilMassMailTaskProcessor::run |
( |
array |
$mailValueObjects, |
|
|
int |
$userId, |
|
|
string |
$contextId, |
|
|
array |
$contextParameters, |
|
|
int |
$mailsPerTask = 100 |
|
) |
| |
- Parameters
-
| ilMailValueObject[] | $mailValueObjects - One MailValueObject = One Task |
int | $userId | - User ID of the user who executes the background task |
string | $contextId | - context ID of the Background task |
array | $contextParameters | - context parameters for the background tasks |
int | $mailsPerTask | - Defines how many mails will be added before a background task is executed |
- Exceptions
-
Definition at line 88 of file class.ilMassMailTaskProcessor.php.
References createInteraction(), and runTask().
95 $objectsServiceSize = count($mailValueObjects);
97 if ($objectsServiceSize <= 0) {
98 throw new ilException(
'First parameter must contain at least 1 array element');
101 if ($mailsPerTask <= 0) {
104 'The mails per task MUST be a positive integer, "%s" given',
110 foreach ($mailValueObjects as $mailValueObject) {
112 throw new ilException(
'Array MUST contain ilMailValueObjects ONLY');
119 $remainingObjects = [];
120 foreach ($mailValueObjects as $mailValueObject) {
123 $remainingObjects[] = $mailValueObject;
124 if ($taskCounter === $mailsPerTask) {
125 $interaction = $this->
createInteraction($userId, $contextId, $contextParameters, $remainingObjects);
127 $this->
runTask($interaction, $userId);
130 $remainingObjects = [];
134 if ([] !== $remainingObjects) {
135 $interaction = $this->
createInteraction($userId, $contextId, $contextParameters, $remainingObjects);
137 $this->
runTask($interaction, $userId);
createInteraction(int $userId, string $contextId, array $contextParameters, $remainingObjects)
runTask(\ILIAS\BackgroundTasks\Task $task, int $userId)
◆ runTask()
◆ $anonymousUserId
int ilMassMailTaskProcessor::$anonymousUserId |
|
private |
◆ $language
◆ $logger
ilLogger ilMassMailTaskProcessor::$logger |
|
private |
◆ $objectJsonService
◆ $taskFactory
◆ $taskManager
The documentation for this class was generated from the following file: