Documentation

Cron
in package

Provides API to work with Cron tasks.

Table of Contents

$STATUS_COMPLETED  : mixed
$STATUS_DISABLED  : mixed
$STATUS_ENABLED  : mixed
$STATUS_RUNNING  : mixed
$baseTable  : mixed
$cronAction  : mixed
$cronInstance  : Cron
$data  : mixed
$instanceCache  : mixed
$schemaInitialized  : mixed
checkTimeout()  : bool
Check cron task timeout.
deleteForModule()  : mixed
Delete all cron tasks associated with module.
deregister()  : mixed
De-register cron task.
getDescription()  : mixed
get the description of cron.
getFrequency()  : int
Get the frequency set.
getHandlerClass()  : mixed
Get the configured handler file.
getId()  : int
Get id reference of this instance.
getInstance()  : self
Get instance of cron task.
getInstanceById()  : self
Get instance of cron job by id.
getLastEnd()  : int
Get the timestamp lastrun ended.
getLastEndDateTime()  : string
Get the last end date time.
getLastStart()  : int
Get the timestamp lastrun started.
getLastStartDateTime()  : string
Get the last start date time.
getLastUpdate()  : int
Get the timestamp last task update.
getLastUpdateDateTime()  : string
Get the last task update date time.
getLockStatus()  : mixed
getModule()  : mixed
Get the Module name.
getName()  : string
Get name of this task instance.
getSequence()  : mixed
get the Sequence.
getStatus()  : int
Get the status.
getTimeDiff()  : mixed
Get Time taken to complete task.
hadTimeout()  : bool
Detect if the task was started by never finished.
isCronAction()  : bool
Function checks cron status.
isDisabled()  : mixed
Is task disabled?
isEnabled()  : mixed
Is task enabled?
isRunnable()  : mixed
Check if task is right state for running.
isRunning()  : mixed
Is task in running status?
listAllActiveInstances()  : array<string|int, self>
Get instances that are active (not disabled).
listAllInstancesByModule()  : array<string|int, self>
Get instance of cron.
markFinished()  : self
Mark this instance as finished.
markRunning()  : self
Mark this instance as running.
nextSequence()  : mixed
Get the next sequence.
refreshData()  : mixed
Function to refresh information about task.
register()  : mixed
Register cron task.
set()  : self
set the value to the data.
setCronAction()  : mixed
Function sets cron status.
setCronInstance()  : void
Set cron instance.
setError()  : void
Set error message.
statusEqual()  : mixed
Helper function to check the status value.
unlockTask()  : mixed
updateFrequency()  : mixed
Update frequency.
updateLastActionTime()  : self
Update cron task last action time.
updateStatus()  : mixed
Update status.
__construct()  : mixed
Constructor.

Properties

$STATUS_COMPLETED

public static mixed $STATUS_COMPLETED = 3

$STATUS_DISABLED

public static mixed $STATUS_DISABLED = 0

$STATUS_ENABLED

public static mixed $STATUS_ENABLED = 1

$STATUS_RUNNING

public static mixed $STATUS_RUNNING = 2

$baseTable

protected static mixed $baseTable = 'vtiger_cron_task'

$cronAction

protected static mixed $cronAction = false

$cronInstance

protected Cron $cronInstance

Cron instance.

$data

protected mixed $data

$instanceCache

protected static mixed $instanceCache = []

$schemaInitialized

protected static mixed $schemaInitialized = false

Methods

checkTimeout()

Check cron task timeout.

public checkTimeout() : bool
Return values
bool

deleteForModule()

Delete all cron tasks associated with module.

public static deleteForModule(ModuleBasic $moduleInstance) : mixed
Parameters
$moduleInstance : ModuleBasic
Return values
mixed

deregister()

De-register cron task.

public static deregister(string $name) : mixed
Parameters
$name : string
Return values
mixed

getDescription()

get the description of cron.

public getDescription() : mixed
Return values
mixed

getFrequency()

Get the frequency set.

public getFrequency() : int
Return values
int

getHandlerClass()

Get the configured handler file.

public getHandlerClass() : mixed
Return values
mixed

getId()

Get id reference of this instance.

public getId() : int
Return values
int

getInstance()

Get instance of cron task.

public static getInstance(string $name) : self
Parameters
$name : string
Return values
self

getInstanceById()

Get instance of cron job by id.

public static getInstanceById(int $id) : self
Parameters
$id : int
Return values
self

getLastEnd()

Get the timestamp lastrun ended.

public getLastEnd() : int
Return values
int

getLastEndDateTime()

Get the last end date time.

public getLastEndDateTime() : string
Return values
string

getLastStart()

Get the timestamp lastrun started.

public getLastStart() : int
Return values
int

getLastStartDateTime()

Get the last start date time.

public getLastStartDateTime() : string
Return values
string

getLastUpdate()

Get the timestamp last task update.

public getLastUpdate() : int
Return values
int

getLastUpdateDateTime()

Get the last task update date time.

public getLastUpdateDateTime() : string
Return values
string

getLockStatus()

public getLockStatus() : mixed
Return values
mixed

getModule()

Get the Module name.

public getModule() : mixed
Return values
mixed

getName()

Get name of this task instance.

public getName() : string

@return string

Return values
string

getSequence()

get the Sequence.

public getSequence() : mixed
Return values
mixed

getStatus()

Get the status.

public getStatus() : int
Return values
int

getTimeDiff()

Get Time taken to complete task.

public getTimeDiff() : mixed
Return values
mixed

hadTimeout()

Detect if the task was started by never finished.

public hadTimeout() : bool
Return values
bool

isCronAction()

Function checks cron status.

public static isCronAction() : bool
Return values
bool

isDisabled()

Is task disabled?

public isDisabled() : mixed
Return values
mixed

isEnabled()

Is task enabled?

public isEnabled() : mixed
Return values
mixed

isRunnable()

Check if task is right state for running.

public isRunnable() : mixed
Return values
mixed

isRunning()

Is task in running status?

public isRunning() : mixed
Return values
mixed

listAllActiveInstances()

Get instances that are active (not disabled).

public static listAllActiveInstances() : array<string|int, self>
Return values
array<string|int, self>

listAllInstancesByModule()

Get instance of cron.

public static listAllInstancesByModule(string $moduleName) : array<string|int, self>
Parameters
$moduleName : string
Return values
array<string|int, self>

markFinished()

Mark this instance as finished.

public markFinished() : self
Return values
self

markRunning()

Mark this instance as running.

public markRunning() : self
Return values
self

nextSequence()

Get the next sequence.

public static nextSequence() : mixed
Return values
mixed

refreshData()

Function to refresh information about task.

public refreshData() : mixed
Return values
mixed

register()

Register cron task.

public static register(string $name, string $handlerClass, int $frequency[, string $module = 'Home' ][, int $status = 1 ], int $sequence[, string $description = '' ]) : mixed
Parameters
$name : string
$handlerClass : string
$frequency : int
$module : string = 'Home'
$status : int = 1
$sequence : int
$description : string = ''
Return values
mixed

set()

set the value to the data.

public set(mixed $key, type $value) : self
Parameters
$key : mixed
$value : type

,$key

Return values
self

setCronAction()

Function sets cron status.

public static setCronAction(bool $status) : mixed
Parameters
$status : bool
Return values
mixed

setCronInstance()

Set cron instance.

public setCronInstance(Cron $cronInstance) : void
Parameters
$cronInstance : Cron
Return values
void

setError()

Set error message.

public setError(string $errorMessage) : void
Parameters
$errorMessage : string
Return values
void

statusEqual()

Helper function to check the status value.

public statusEqual(mixed $value) : mixed
Parameters
$value : mixed
Return values
mixed

unlockTask()

public unlockTask() : mixed
Return values
mixed

updateFrequency()

Update frequency.

public updateFrequency(int $frequency) : mixed
Parameters
$frequency : int
Return values
mixed

updateLastActionTime()

Update cron task last action time.

public updateLastActionTime() : self
Return values
self

updateStatus()

Update status.

public updateStatus(int $status) : mixed
Parameters
$status : int
Tags
throws
Exception
Return values
mixed

__construct()

Constructor.

protected __construct(mixed $values) : mixed
Parameters
$values : mixed
Return values
mixed

        

Search results