Cron
in package
Class to handle Cron operations.
Table of Contents
- STATUS_COMPLETED = 3
- STATUS_DISABLED = 0
- STATUS_ENABLED = 1
- STATUS_RUNNING = 2
- $confReportIsActive : bool
- $cronTimeStart : int|null
- Cron run start time in microtime.
- $keepLogFile : bool
- $logActive : bool
- $logFile : bool|string
- $logPath : string
- $registerIsActive : bool
- $scriptTimeStart : int|null
- Script run start time in microtime.
- $shopIsActive : bool
- $watchdogIsActive : bool
- $maxExecutionCronTime : int
- __construct() : mixed
- Init and configure object.
- __destruct() : mixed
- Remove log file if no value information was stored.
- checkActive() : bool
- Check if it is active function.
- checkCronTimeout() : bool
- Check max execution cron time.
- generateStatusFile() : bool|int
- Gather and save information for YetiForce Status module.
- getCronExecutionTime() : float|null
- Calculate current object run time.
- getMaxExecutionTime() : int
- Get max execution cron time.
- log() : mixed
- Add log message.
- updateStatus() : void
- Update cron task status by name.
Constants
STATUS_COMPLETED
public
int
STATUS_COMPLETED
= 3
status completed
STATUS_DISABLED
public
int
STATUS_DISABLED
= 0
status disabled
STATUS_ENABLED
public
int
STATUS_ENABLED
= 1
status enabled
STATUS_RUNNING
public
int
STATUS_RUNNING
= 2
status running
Properties
$confReportIsActive
public
static bool
$confReportIsActive
= true
ConfReport enabled flag
$cronTimeStart
Cron run start time in microtime.
public
static int|null
$cronTimeStart
Cron run start time in microtime
$keepLogFile
public
static bool
$keepLogFile
= false
Flag to keep log file after run finish
$logActive
public
static bool
$logActive
= false
Logging enabled flag
$logFile
public
bool|string
$logFile
= false
Current log file name
$logPath
public
string
$logPath
= ROOT_DIRECTORY . \DIRECTORY_SEPARATOR . 'cache' . \DIRECTORY_SEPARATOR . 'logs' . \DIRECTORY_SEPARATOR . 'cron' . \DIRECTORY_SEPARATOR
Log files directory path
$registerIsActive
public
static bool
$registerIsActive
= true
Register enabled flag
$scriptTimeStart
Script run start time in microtime.
public
static int|null
$scriptTimeStart
Script run start time in microtime
$shopIsActive
public
static bool
$shopIsActive
= true
Shop enabled flag
$watchdogIsActive
public
static bool
$watchdogIsActive
= true
Watchdog enabled flag
$maxExecutionCronTime
private
static int
$maxExecutionCronTime
Max execution cron time.
Methods
__construct()
Init and configure object.
public
__construct() : mixed
Tags
Return values
mixed —__destruct()
Remove log file if no value information was stored.
public
__destruct() : mixed
Return values
mixed —checkActive()
Check if it is active function.
public
static checkActive(string $className) : bool
Parameters
- $className : string
Return values
bool —checkCronTimeout()
Check max execution cron time.
public
checkCronTimeout() : bool
Return values
bool —generateStatusFile()
Gather and save information for YetiForce Status module.
public
static generateStatusFile() : bool|int
Return values
bool|int —getCronExecutionTime()
Calculate current object run time.
public
getCronExecutionTime() : float|null
Return values
float|null —getMaxExecutionTime()
Get max execution cron time.
public
static getMaxExecutionTime() : int
Return values
int —log()
Add log message.
public
log(string $message[, string $level = 'info' ][, bool $indent = true ]) : mixed
Parameters
- $message : string
-
log information
- $level : string = 'info'
-
information type [info, warning, error]
- $indent : bool = true
-
add three spaces at message begin
Return values
mixed —updateStatus()
Update cron task status by name.
public
static updateStatus(int $status, string $name) : void
Parameters
- $status : int
- $name : string