|
| __construct (private readonly int $anonymousUserId=ANONYMOUS_USER_ID, ?TaskManager $taskManager=null, ?TaskFactory $taskFactory=null, ?ilLanguage $language=null, ?ilLogger $logger=null, ?Container $dic=null, ?ilMailValueObjectJsonService $objectJsonService=null) |
|
| run (array $mailValueObjects, int $userId, string $contextId, array $contextParameters, int $mailsPerTask=100) |
|
◆ __construct()
Definition at line 37 of file class.ilMassMailTaskProcessor.php.
References $DIC, $dic, $language, $logger, $objectJsonService, $taskFactory, $taskManager, ilLoggerFactory\getLogger(), ILIAS\UI\examples\Symbol\Glyph\Language\language(), ILIAS\Repository\logger(), and null.
static getLogger(string $a_component_id)
Get component logger.
readonly ilLogger $logger
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
readonly TaskFactory $taskFactory
readonly ilMailValueObjectJsonService $objectJsonService
readonly TaskManager $taskManager
language()
description: > Example for rendring a language glyph.
readonly ilLanguage $language
◆ createInteraction()
ilMassMailTaskProcessor::createInteraction |
( |
int |
$userId, |
|
|
string |
$contextId, |
|
|
array |
$contextParameters, |
|
|
|
$remainingObjects |
|
) |
| |
|
private |
Definition at line 148 of file class.ilMassMailTaskProcessor.php.
Referenced by run().
154 $jsonString = $this->objectJsonService->convertToJson($remainingObjects);
156 $task = $this->taskFactory->createTask(ilMassMailDeliveryJob::class, [
160 serialize($contextParameters),
165 $parameters = [$task, $userId];
167 return $this->taskFactory->createTask(
168 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 85 of file class.ilMassMailTaskProcessor.php.
References createInteraction(), and runTask().
92 $objectsServiceSize = count($mailValueObjects);
94 if ($objectsServiceSize <= 0) {
95 throw new ilMailException(
'First parameter must contain at least 1 array element');
98 if ($mailsPerTask <= 0) {
101 'The mails per task MUST be a positive integer, "%s" given',
107 foreach ($mailValueObjects as $mailValueObject) {
109 throw new ilMailException(
'Array MUST contain ilMailValueObjects ONLY');
114 $remainingObjects = [];
115 foreach ($mailValueObjects as $mailValueObject) {
118 $remainingObjects[] = $mailValueObject;
119 if ($taskCounter === $mailsPerTask) {
120 $interaction = $this->
createInteraction($userId, $contextId, $contextParameters, $remainingObjects);
122 $this->
runTask($interaction, $userId);
125 $remainingObjects = [];
129 if ([] !== $remainingObjects) {
130 $interaction = $this->
createInteraction($userId, $contextId, $contextParameters, $remainingObjects);
132 $this->
runTask($interaction, $userId);
createInteraction(int $userId, string $contextId, array $contextParameters, $remainingObjects)
runTask(\ILIAS\BackgroundTasks\Task $task, int $userId)
◆ runTask()
◆ $language
readonly ilLanguage ilMassMailTaskProcessor::$language |
|
private |
◆ $logger
readonly ilLogger ilMassMailTaskProcessor::$logger |
|
private |
◆ $objectJsonService
◆ $taskFactory
readonly TaskFactory ilMassMailTaskProcessor::$taskFactory |
|
private |
◆ $taskManager
readonly TaskManager ilMassMailTaskProcessor::$taskManager |
|
private |
The documentation for this class was generated from the following file: