-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTestCronInterfaceJob.php
More file actions
103 lines (87 loc) · 2.01 KB
/
TestCronInterfaceJob.php
File metadata and controls
103 lines (87 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
/* Copyright (c) 1998-2021 ILIAS open source, Extended GPL, see docs/LICENSE */
declare(strict_types=1);
namespace ILIAS\Plugin\TestCronInterface\Cron;
use ilCronJob;
use ilCronJobResult;
use ilLogger;
use ILIAS\Cron\Schedule\CronJobScheduleType;
use ILIAS\Language\Language;
use ILIAS\Logging\LoggerFactory;
/**
* Class TestCronInterfaceJob
* @package ILIAS\Plugin\TestCronInterface\Cron
* @author Michael Jansen <mjansen@databay.de>
*/
class TestCronInterfaceJob extends ilCronJob
{
/**
* @inheritDoc
*/
public function getTitle(): string
{
return sprintf("Title Test of: %s", self::class);
}
/**
* @inheritDoc
*/
public function getDescription(): string
{
return sprintf("Description Test of: %s", self::class);
}
/**
* @inheritDoc
*/
public function getId(): string
{
return 'testcroninterface_job';
}
/**
* @inheritDoc
*/
public function hasAutoActivation(): bool
{
return true;
}
/**
* @inheritDoc
*/
public function hasFlexibleSchedule(): bool
{
return true;
}
/**
* @inheritDoc
*/
public function getDefaultScheduleType(): \ILIAS\Cron\Schedule\CronJobScheduleType
{
return \ILIAS\Cron\Schedule\CronJobScheduleType::SCHEDULE_TYPE_DAILY;
}
/**
* @inheritDoc
*/
public function getDefaultScheduleValue(): int
{
return 1;
}
/**
* @return bool
*/
public function isManuallyExecutable(): bool
{
return defined('DEVMODE') && (bool) DEVMODE;
}
/**
* @inheritDoc
*/
public function run(): ilCronJobResult
{
$logger = $this->logger_factory::getRootLogger();
$logger->info('Started job');
$result = new ilCronJobResult();
$result->setStatus(ilCronJobResult::STATUS_OK);
$result->setMessage('Successfully finished job');
$logger->info($result->getMessage());
return $result;
}
}