ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
SyncTaskManager.php
Go to the documentation of this file.
1 <?php
2 
20 
27 
40 {
42 
43  public function __construct(Persistence $persistence)
44  {
45  $this->persistence = $persistence;
46  }
47 
52  public function run(Bucket $bucket): void
53  {
54  $task = $bucket->getTask();
55  $bucket->setCurrentTask($task);
56  $observer = new NonPersistingObserver($bucket);
57 
58  try {
59  $task = $this->executeTask($task, $observer);
60  if ($task instanceof UserInteraction && $task->canBeSkipped($task->getInput())) {
61  throw new UserInteractionSkippedException('can be skipped');
62  }
63  $bucket->setState(State::FINISHED);
65  $bucket->setState(State::FINISHED);
67  // We're okay!
68  $this->persistence->saveBucketAndItsTasks($bucket);
69  }
70  }
71 }
executeTask(Task $task, Observer $observer)
Actually executes a task.
canBeSkipped(array $input)
Decide whether the UserInteraction is presented to the user and he has to decide or user UserInteract...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Option.php:19
run(Bucket $bucket)
This will add an Observer of the Task and start running the task.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...