1 | <?php |
||
11 | class CronManager |
||
12 | { |
||
13 | /** |
||
14 | * The lines of the cron table, can be cron command or comment |
||
15 | * |
||
16 | * @var array |
||
17 | */ |
||
18 | protected $lines = []; |
||
19 | |||
20 | /** |
||
21 | * The error when using the comment 'crontab' |
||
22 | * |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $error; |
||
26 | |||
27 | /** |
||
28 | * The output when using the command 'crontab' |
||
29 | * |
||
30 | * @var string |
||
31 | */ |
||
32 | protected $output; |
||
33 | |||
34 | public function __construct() |
||
57 | |||
58 | /** |
||
59 | * Gets the array of crons indexed by line number |
||
60 | * |
||
61 | * @return Cron[] |
||
62 | */ |
||
63 | public function getCrons() |
||
69 | |||
70 | /** |
||
71 | * Get a specific cron by its id |
||
72 | * |
||
73 | * @param int $id |
||
74 | * |
||
75 | * @return Cron |
||
76 | */ |
||
77 | public function getById($id) |
||
86 | |||
87 | /** |
||
88 | * Add a cron to the cron table |
||
89 | * |
||
90 | * @param Cron $cron |
||
91 | */ |
||
92 | public function add(Cron $cron) |
||
98 | |||
99 | /** |
||
100 | * Remove a cron from the cron table |
||
101 | * |
||
102 | * @param int $index - the line number |
||
103 | */ |
||
104 | public function remove($index) |
||
110 | |||
111 | /** |
||
112 | * Write the current crons in the cron table |
||
113 | */ |
||
114 | public function write() |
||
126 | |||
127 | /** |
||
128 | * Gets the error output when using the 'crontab' command |
||
129 | * |
||
130 | * @return string |
||
131 | */ |
||
132 | public function getError() |
||
136 | |||
137 | /** |
||
138 | * Gets the output when using the 'crontab' command |
||
139 | * |
||
140 | * @return string |
||
141 | */ |
||
142 | public function getOutput() |
||
146 | |||
147 | /** |
||
148 | * Gets a representation of the cron table file |
||
149 | * |
||
150 | * @return string |
||
151 | */ |
||
152 | public function getRaw() |
||
156 | } |
||
157 |