AloFramework documentation
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo

Namespaces

  • Alo
    • Cache
    • CLI
    • Controller
    • Db
    • Exception
    • FileSystem
    • Session
    • Validators
    • Windows
  • Controller
  • None
  • PHP

Classes

  • Cookie
  • Cron
  • Curl
  • Email
  • Format
  • Handler
  • Locale
  • Profiler
  • Security
  • SFTP

Class Cron

The crontab editor class. You must call the commit() method to save your changes.

Namespace:Alo
Author:Art <a.molcanovas@gmail.com>
Located atsys/class/alo/cron.php

Methods summary

public
#__construct( )

Instantiates the crontab handler

Instantiates the crontab handler

Throws

Alo\Exception\OSException
When the machine is running Windows

Author

Art <a.molcanovas@gmail.com>
publicAlo\Cron
#reloadCrontab( )

(re)loads the cron job array

(re)loads the cron job array

Returns

Alo\Cron

Author

Art <a.molcanovas@gmail.com>
public staticAlo\Cron
#cron( )

Instantiates the crontab handler

Instantiates the crontab handler

Returns

Alo\Cron

Throws

Alo\Exception\OSException
When the machine is running Windows

Author

Art <a.molcanovas@gmail.com>
publicAlo\Cron
#editCronJob(integer$index,string$command,integer|string$minute='*',integer|string$hour='*',integer|string$day='*',integer|string$month='*',integer|string$weekday='*')

Edits the cron job at index $index. Can be substituded with the full CRON expression (schedule + command) to perform a search - use with caution!

Edits the cron job at index $index. Can be substituded with the full CRON expression (schedule + command) to perform a search - use with caution!

Parameters

$index
integer
$index The job index in the crontab array
$command
string
$command The command to run
$minute
integer|string
$minute The minute parameter
$hour
integer|string
$hour The hour parameter
$day
integer|string
$day The day of the month parameter
$month
integer|string
$month The month parameter
$weekday
integer|string
$weekday The day of the week parameter

Returns

Alo\Cron

Throws

Alo\Exception\CronException
When the minute expression is invalid
Alo\Exception\CronException
When the parameters are invalid
Alo\Exception\CronException
When one or more parameters are non-scalar

Author

Art <a.molcanovas@gmail.com>
protectedAlo\Cron
#editCrontab(integer$index,string$command,integer|string$minute='*',integer|string$hour='*',integer|string$day='*',integer|string$month='*',integer|string$weekday='*')

Performs modifiation on the crontab file

Performs modifiation on the crontab file

Parameters

$index
integer
$index The job index in the crontab array
$command
string
$command The command to run
$minute
integer|string
$minute The minute parameter
$hour
integer|string
$hour The hour parameter
$day
integer|string
$day The day of the month parameter
$month
integer|string
$month The month parameter
$weekday
integer|string
$weekday The day of the week parameter

Returns

Alo\Cron

Throws

Alo\Exception\CronException
When the minute expression is invalid
Alo\Exception\CronException
When the parameters are invalid
Alo\Exception\CronException
When one or more parameters are non-scalar

Author

Art <a.molcanovas@gmail.com>
protected static boolean
#formatOK(integer|string$min,integer|string$hour,integer|string$day,integer|string$month,integer|string$weekday)

Checks whether all the fields are formatted properly

Checks whether all the fields are formatted properly

Parameters

$min
integer|string
$min The minute parameter
$hour
integer|string
$hour The hour parameter
$day
integer|string
$day The day of the month parameter
$month
integer|string
$month The month parameter
$weekday
integer|string
$weekday The day of the week parameter

Returns

boolean

Author

Art <a.molcanovas@gmail.com>
public boolean
#commit( )

Saves any changes made

Saves any changes made

Returns

boolean

Author

Art <a.molcanovas@gmail.com>
publicAlo\Cron
#appendCrontab(string$command,integer|string$minuteConst='*',integer|string$hour='*',integer|string$day='*',integer|string$month='*',integer|string$weekday='*')

Appends the crontab file

Appends the crontab file

Parameters

$command
string
$command The command to run
$minuteConst
integer|string
$minuteConst The minute parameter
$hour
integer|string
$hour The hour parameter
$day
integer|string
$day The day of the month parameter
$month
integer|string
$month The month parameter
$weekday
integer|string
$weekday The day of the week parameter

Returns

Alo\Cron

Throws

Alo\Exception\CronException
When the minute expression is invalid
Alo\Exception\CronException
When the parameters are invalid
Alo\Exception\CronException
When one or more parameters are non-scalar

Author

Art <a.molcanovas@gmail.com>
publicAlo\Cron
#deleteJob(integer$index)

Removes the cron job @ index $index

Removes the cron job @ index $index

Parameters

$index
integer
$index The cron job's index in the array

Returns

Alo\Cron

Author

Art <a.molcanovas@gmail.com>
publicAlo\Cron
#clearCrontab( )

Clears the crontab

Clears the crontab

Returns

Alo\Cron

Author

Art <a.molcanovas@gmail.com>
publicAlo\Cron|boolean
#autocommit(boolean|null$set=null)

If no parameter is passed or the parameter isn't TRUE/FALSE, returns the current autocommit setting, otherwise sets it. Use with caution!

If no parameter is passed or the parameter isn't TRUE/FALSE, returns the current autocommit setting, otherwise sets it. Use with caution!

Parameters

$set
boolean|null
$set The desired setting if changing

Returns

Alo\Cron|boolean
$this if not changing the autocommit value or the value otherwise

Author

Art <a.molcanovas@gmail.com>
public null|string
#getAtIndex(integer$i)

Returns crontab entry at index $i

Returns crontab entry at index $i

Parameters

$i
integer
$i The index

Returns

null|string

Author

Art <a.molcanovas@gmail.com>
public array
#getCrontab( )

Returns the crontab array

Returns the crontab array

Returns

array

Author

Art <a.molcanovas@gmail.com>
public string
#__toString( )

Returns a string representation of the object data

Returns a string representation of the object data

Returns

string

Author

Art <a.molcanovas@gmail.com>

Magic methods summary

Constants summary

integerWEEKDAY_SUN0
#

Defines the day of the week as Sunday

Defines the day of the week as Sunday

integerWEEKDAY_MON1
#

Defines the day of the week as Monday

Defines the day of the week as Monday

integerWEEKDAY_TUE2
#

Defines the day of the week as Tuesday

Defines the day of the week as Tuesday

integerWEEKDAY_WED3
#

Defines the day of the week as Wednesday

Defines the day of the week as Wednesday

integerWEEKDAY_THU4
#

Defines the day of the week as Thursday

Defines the day of the week as Thursday

integerWEEKDAY_FRI5
#

Defines the day of the week as Friday

Defines the day of the week as Friday

integerWEEKDAY_SAT6
#

Defines the day of the week as Saturday

Defines the day of the week as Saturday

stringCONST_YEARLY'0 0 1 1 *'
#

A pre-setting to run the cronjob yearly at 1 Jan, 00:00

A pre-setting to run the cronjob yearly at 1 Jan, 00:00

stringCONST_MONTHLY'0 0 1 * *'
#

A pre-setting to run the cronjob monthly at 00:00

A pre-setting to run the cronjob monthly at 00:00

stringCONST_WEEKLY'0 0 * * 0'
#

A pre-setting to run the cronjob weekly on Sunday, 00:00

A pre-setting to run the cronjob weekly on Sunday, 00:00

stringCONST_DAILY'0 0 * * *'
#

A pre-setting to run the cronjob daily at 00:00

A pre-setting to run the cronjob daily at 00:00

stringCONST_HOURLY'0 * * * *'
#

A pre-setting to run the cronjob hourly at 00 minutes

A pre-setting to run the cronjob hourly at 00 minutes

stringCONST_REBOOT'@reboot'
#

A pre-setting to run the cronjob on server startup

A pre-setting to run the cronjob on server startup

integerMONTH_JAN1
#

Defines the month as January

Defines the month as January

integerMONTH_FEB2
#

Defines the month as February

Defines the month as February

integerMONTH_MAR3
#

Defines the month as March

Defines the month as March

integerMONTH_APR4
#

Defines the month as April

Defines the month as April

integerMONTH_MAY5
#

Defines the month as May

Defines the month as May

integerMONTH_JUN6
#

Defines the month as June

Defines the month as June

integerMONTH_JUL7
#

Defines the month as July

Defines the month as July

integerMONTH_AUG8
#

Defines the month as August

Defines the month as August

integerMONTH_SEP9
#

Defines the month as September

Defines the month as September

integerMONTH_OCT10
#

Defines the month as October

Defines the month as October

integerMONTH_NOV11
#

Defines the month as November

Defines the month as November

integerMONTH_DEC12
#

Defines the month as December

Defines the month as December

Properties summary

public staticAlo\Cron$this
#

Static reference to the last instance of the class

Static reference to the last instance of the class

protected static array$validConstants
#

Array of valid CRON constants

Array of valid CRON constants

protected array$crontab
#

The current crontab data

The current crontab data

protected boolean$autocommit
#

Whether changes should be autocommited automatically

Whether changes should be autocommited automatically

AloFramework documentation API documentation generated byApiGen 2.8.0