ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\BackgroundTasks\Implementation\TaskManager\SyncTaskManager Class Reference
+ Inheritance diagram for ILIAS\BackgroundTasks\Implementation\TaskManager\SyncTaskManager:
+ Collaboration diagram for ILIAS\BackgroundTasks\Implementation\TaskManager\SyncTaskManager:

Public Member Functions

 __construct (protected Persistence $persistence)
 
 run (Bucket $bucket)
 This will add an Observer of the Task and start running the task. More...
 
- Public Member Functions inherited from ILIAS\BackgroundTasks\Implementation\TaskManager\BasicTaskManager
 __construct (protected Persistence $persistence)
 
 continueTask (Bucket $bucket, Option $option)
 Continue a task with a given option. More...
 
 quitBucket (Bucket $bucket)
 Quits and deletes a Bucket with all it's Jobs. More...
 
- Public Member Functions inherited from ILIAS\BackgroundTasks\TaskManager
 executeTask (Task $task, Observer $observer)
 Actually executes a task. More...
 
 run (Bucket $bucket)
 Depending on your background task settings, executes or puts the task into the queue. More...
 
 continueTask (Bucket $bucket, Option $option)
 Continue a task that is the state UserInteraction with a given option. More...
 
 quitBucket (Bucket $bucket)
 Quits and deletes a Bucket with all it's Jobs. More...
 

Detailed Description

Definition at line 39 of file SyncTaskManager.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\BackgroundTasks\Implementation\TaskManager\SyncTaskManager::__construct ( protected Persistence  $persistence)

Reimplemented from ILIAS\BackgroundTasks\Implementation\TaskManager\BasicTaskManager.

Definition at line 41 of file SyncTaskManager.php.

42 {
43 }

Member Function Documentation

◆ run()

ILIAS\BackgroundTasks\Implementation\TaskManager\SyncTaskManager::run ( Bucket  $bucket)

This will add an Observer of the Task and start running the task.

Exceptions

Exception

Implements ILIAS\BackgroundTasks\TaskManager.

Definition at line 49 of file SyncTaskManager.php.

49 : void
50 {
51 $task = $bucket->getTask();
52 $bucket->setCurrentTask($task);
53 $observer = new NonPersistingObserver($bucket);
54
55 try {
56 $task = $this->executeTask($task, $observer);
57 if ($task instanceof UserInteraction && $task->canBeSkipped($task->getInput())) {
58 throw new UserInteractionSkippedException('can be skipped');
59 }
60 $bucket->setState(State::FINISHED);
61 } catch (UserInteractionSkippedException) {
62 $bucket->setState(State::FINISHED);
63 } catch (UserInteractionRequiredException) {
64 // We're okay!
65 $this->persistence->saveBucketAndItsTasks($bucket);
66 }
67 }
executeTask(Task $task, Observer $observer)
Actually executes a task.

References ILIAS\BackgroundTasks\Task\UserInteraction\canBeSkipped(), ILIAS\BackgroundTasks\TaskManager\executeTask(), ILIAS\BackgroundTasks\Implementation\Bucket\State\FINISHED, ILIAS\BackgroundTasks\Bucket\getTask(), ILIAS\BackgroundTasks\Bucket\setCurrentTask(), and ILIAS\BackgroundTasks\Bucket\setState().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: