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

Namespaces

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

Classes

  • Cron
  • cURL
  • Email
  • File
  • Handler
  • Profiler
  • 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 at sys/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>
public Alo\Cron
# reloadCrontab( )

(re)loads the cron job array

(re)loads the cron job array

Returns

Alo\Cron

Author

Art <a.molcanovas@gmail.com>
public static Alo\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>
public Alo\Cron
# editCronJob( integer $index, string $command, integer|string $minute_const = '*', 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_const
integer|string
$minute_const 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 Alo\Cron
# editCrontab( integer $index, string $command, integer|string $minute_const = '*', 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_const
integer|string
$minute_const 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 Alo\Cron
# commit( )

Saves any changes made

Saves any changes made

Returns

Alo\Cron

Author

Art <a.molcanovas@gmail.com>
public Alo\Cron
# appendCrontab( string $command, integer|string $minute_const = '*', 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
$minute_const
integer|string
$minute_const 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>
public Alo\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>
public Alo\Cron
# clearCrontab( )

Clears the crontab

Clears the crontab

Returns

Alo\Cron

Author

Art <a.molcanovas@gmail.com>
public Alo\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

integer WEEKDAY_SUN 0
#

Defines the day of the week as Sunday

Defines the day of the week as Sunday

integer WEEKDAY_MON 1
#

Defines the day of the week as Monday

Defines the day of the week as Monday

integer WEEKDAY_TUE 2
#

Defines the day of the week as Tuesday

Defines the day of the week as Tuesday

integer WEEKDAY_WED 3
#

Defines the day of the week as Wednesday

Defines the day of the week as Wednesday

integer WEEKDAY_THU 4
#

Defines the day of the week as Thursday

Defines the day of the week as Thursday

integer WEEKDAY_FRI 5
#

Defines the day of the week as Friday

Defines the day of the week as Friday

integer WEEKDAY_SAT 6
#

Defines the day of the week as Saturday

Defines the day of the week as Saturday

string CONST_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

string CONST_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

string CONST_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

string CONST_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

string CONST_HOURLY '0 * * * *'
#

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

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

string CONST_REBOOT '@reboot'
#

A pre-setting to run the cronjob on server startup

A pre-setting to run the cronjob on server startup

integer MONTH_JAN 1
#

Defines the month as January

Defines the month as January

integer MONTH_FEB 2
#

Defines the month as February

Defines the month as February

integer MONTH_MAR 3
#

Defines the month as March

Defines the month as March

integer MONTH_APR 4
#

Defines the month as April

Defines the month as April

integer MONTH_MAY 5
#

Defines the month as May

Defines the month as May

integer MONTH_JUN 6
#

Defines the month as June

Defines the month as June

integer MONTH_JUL 7
#

Defines the month as July

Defines the month as July

integer MONTH_AUG 8
#

Defines the month as August

Defines the month as August

integer MONTH_SEP 9
#

Defines the month as September

Defines the month as September

integer MONTH_OCT 10
#

Defines the month as October

Defines the month as October

integer MONTH_NOV 11
#

Defines the month as November

Defines the month as November

integer MONTH_DEC 12
#

Defines the month as December

Defines the month as December

Properties summary

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 by ApiGen 2.8.0