\Buoy_Crontab_Manager

A simple helper class to manage crontab files.

Summary

Methods
Properties
Constants
__construct()
getCron()
jobExists()
appendCronJobs()
removeCronJobs()
save()
$crontab_lines
No constants found
No protected methods found
No protected properties found
N/A
crontabExists()
readCrontab()
removeCrontab()
No private properties found
N/A

Properties

$crontab_lines

$crontab_lines : array<mixed,string>

The current crontab file contents.

Type

array<mixed,string>

Methods

__construct()

__construct() : void

Constructor.

getCron()

getCron() : array<mixed,string>

Gets the current crontab file contents.

Returns

array<mixed,string>

jobExists()

jobExists(string  $job) : boolean

Checks whether there is an entry for the job in the crontab.

Parameters

string $job

Returns

boolean

appendCronJobs()

appendCronJobs(string|array<mixed,string>  $jobs) : \Buoy_Crontab_Manager

Add cron jobs to the current crontab.

Parameters

string|array<mixed,string> $jobs

Cron jobs to add.

Returns

\Buoy_Crontab_Manager

removeCronJobs()

removeCronJobs(string  $job_patterns) : \Buoy_Crontab_Manager

Remove cron jobs from the current crontab.

Parameters

string $job_patterns

Regex pattern of cron jobs to remove.

Returns

\Buoy_Crontab_Manager

save()

save() : \Buoy_Crontab_Manager

Saves the current crontab contents to the filesystem.

Throws

\RuntimeException

If an error occurrs during crontab installation.

Returns

\Buoy_Crontab_Manager

crontabExists()

crontabExists() : boolean

Checks whether a crontab file exists.

Returns

boolean

readCrontab()

readCrontab() : array<mixed,string>

Reads the current crontab file from disk.

Returns

array<mixed,string>

removeCrontab()

removeCrontab() : \Buoy_Crontab_Manager

Deletes the crontab file from the filesystem.

Returns

\Buoy_Crontab_Manager