ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
StrictCliJobManager.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\Cron\Job\Manager;
22 
24 
25 final readonly class StrictCliJobManager implements JobManager
26 {
27  public function __construct(protected JobManager $job_manager)
28  {
29  }
30 
34  private function getValidPhpApis(): array
35  {
36  return [
37  'cli'
38  ];
39  }
40 
41  public function runActiveJobs(\ilObjUser $actor): void
42  {
43  if (\in_array(PHP_SAPI, array_map('strtolower', $this->getValidPhpApis()), true)) {
44  $this->job_manager->runActiveJobs($actor);
45  }
46  }
47 
48  public function runJobManual(string $jobId, \ilObjUser $actor): bool
49  {
50  return $this->job_manager->runJobManual($jobId, $actor);
51  }
52 
53  public function resetJob(\ILIAS\Cron\CronJob $job, \ilObjUser $actor): void
54  {
55  $this->job_manager->resetJob($job, $actor);
56  }
57 
58  public function activateJob(\ILIAS\Cron\CronJob $job, \ilObjUser $actor, bool $wasManuallyExecuted = false): void
59  {
60  $this->job_manager->activateJob($job, $actor, $wasManuallyExecuted);
61  }
62 
63  public function deactivateJob(\ILIAS\Cron\CronJob $job, \ilObjUser $actor, bool $wasManuallyExecuted = false): void
64  {
65  $this->job_manager->deactivateJob($job, $actor, $wasManuallyExecuted);
66  }
67 
68  public function isJobActive(string $jobId): bool
69  {
70  return $this->job_manager->isJobActive($jobId);
71  }
72 
73  public function isJobInactive(string $jobId): bool
74  {
75  return $this->job_manager->isJobInactive($jobId);
76  }
77 
78  public function ping(string $jobId): void
79  {
80  $this->job_manager->ping($jobId);
81  }
82 }
resetJob(\ILIAS\Cron\CronJob $job, \ilObjUser $actor)
Interface Observer Contains several chained tasks and infos about them.
deactivateJob(\ILIAS\Cron\CronJob $job, \ilObjUser $actor, bool $wasManuallyExecuted=false)
activateJob(\ILIAS\Cron\CronJob $job, \ilObjUser $actor, bool $wasManuallyExecuted=false)