1 | <?php |
||
16 | class RemoveOldLogEntriesTask extends BuildTask implements CronTask |
||
17 | { |
||
18 | /** |
||
19 | * {@inheritDoc} |
||
20 | */ |
||
21 | private static $segment = 'RemoveOldLogEntriesTask'; |
||
1 ignored issue
–
show
|
|||
22 | |||
23 | /** |
||
24 | * {@inheritDoc} |
||
25 | */ |
||
26 | protected $title = 'Remove LogEntry records older than a "n" days'; |
||
27 | |||
28 | /** |
||
29 | * {@inheritDoc} |
||
30 | */ |
||
31 | protected $description = 'Removes LogEntry records that are older than the configured ' |
||
32 | . '`LogViewer.max_log_age` setting. Will run as a cron task unless disabled via configuration.'; |
||
33 | |||
34 | /** |
||
35 | * BuildTask implementation |
||
36 | * |
||
37 | * {@inheritDoc} |
||
38 | * |
||
39 | * @return bool Whether anything was removed |
||
40 | */ |
||
41 | public function run($request) |
||
45 | |||
46 | /** |
||
47 | * CronTask implementation - can be disabled with YAML configuration |
||
48 | * |
||
49 | * {@inheritDoc} |
||
50 | * |
||
51 | * @return bool Whether anything was removed |
||
52 | */ |
||
53 | public function process() |
||
60 | |||
61 | /** |
||
62 | * {@inheritDoc} |
||
63 | */ |
||
64 | public function getSchedule() |
||
68 | |||
69 | /** |
||
70 | * Get the maximum age allowed for a LogEntry from configuration |
||
71 | * |
||
72 | * @return int |
||
73 | */ |
||
74 | public function getMaxAge() |
||
78 | |||
79 | /** |
||
80 | * Return whether the cron functionality is enabled from configuration |
||
81 | * |
||
82 | * @return bool |
||
83 | */ |
||
84 | public function getCronEnabled() |
||
88 | |||
89 | /** |
||
90 | * Remove LogEntry records older than the LogViewer.max_log_age days |
||
91 | * |
||
92 | * @return bool Whether anything was deleted or not |
||
93 | */ |
||
94 | protected function removeOldLogs() |
||
111 | } |
||
112 |