ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
PersistingObserver.php
Go to the documentation of this file.
1<?php
2
20
25
32{
33 public function __construct(protected Bucket $bucket, protected Persistence $persistence)
34 {
35 }
36
40 public function notifyState(int $state): void
41 {
42 $this->bucket->setState($state);
43 $this->bucket->heartbeat();
44 $this->persistence->updateBucket($this->bucket);
45 }
46
47 public function notifyPercentage(Task $task, int $percentage): void
48 {
49 $this->bucket->setPercentage($task, $percentage);
50 $this->bucket->heartbeat();
51 $this->persistence->updateBucket($this->bucket);
52 }
53
54 public function notifyCurrentTask(Task $task): void
55 {
56 $this->bucket->setCurrentTask($task);
57 $this->bucket->heartbeat();
58 $this->persistence->updateBucket($this->bucket);
59 }
60
65 public function heartbeat(): void
66 {
67 $this->bucket->heartbeat();
68 $this->persistence->updateBucket($this->bucket);
69 }
70}
__construct(protected Bucket $bucket, protected Persistence $persistence)
heartbeat()
I'm still alive! If your calculation takes a really long time don't forget to use the heartbeat.
notifyCurrentTask(Task $task)
If the current task changes notify the observer.
notifyPercentage(Task $task, int $percentage)
You can change the progress of a currently running task.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Job.php:19