PHP Class Aoe_Scheduler_Model_Schedule, Aoe_Scheduler

Inheritance: extends Mage_Cron_Model_Schedule
Afficher le fichier Open project: aoepeople/aoe_scheduler Class Usage Examples

Protected Properties

Свойство Type Description
$_eventObject string In an observer method you can use $observer->getData('schedule') or $observer->getData('data_object') to get this object
$_eventPrefix string Event name prefix for events that are dispatched by this class
$_redirect boolean Placeholder to keep track of active redirect buffer.
$_redirectOutputHandlerChunkSize Prior to PHP 5.4.0, the value 1 set the chunk size to 4096 bytes.
$errorSettingsBackup array Backup of the original error settings
$job Aoe_Scheduler_Model_Job
$jobWasLocked boolean

Méthodes publiques

Méthode Description
_addBufferToMessages ( $buffer ) : string Used as callback function to redirect the output buffer directly into the messages field of this schedule.
addMessages ( $messages ) Append data to the current messages field.
canRun ( boolean $throwException = false ) : boolean Check if this schedule can be run
checkPid ( ) : boolean Check if process is running (linux only)
checkRunningAsCorrectUser ( ) : boolean Check if the user running the process matches the configured user. Message will capture cases where the user is not set too in its response message. Process may optionally be killed, or may be allowed to continue.
getAllStatuses ( )
getDuration ( ) : boolean | integer Get job duration.
getErrorLogFile ( ) : string Get error log filename
getJob ( ) : Aoe_Scheduler_Model_Job Get job configuration
getJobWasLocked ( ) : boolean Flag that shows that a previous execution was prevented because the job was locked
getParameters ( ) : mixed Get parameters (and fallback to job)
getStarttime ( ) : string Get start time (planned or actual)
getStatuses ( ) : array Gets statuses that are currently in the scheduler table
initializeFromJob ( Aoe_Scheduler_Model_Job $job ) Initialize from job
isAlive ( ) : boolean | null Is this process still alive?
isAlwaysTask ( ) : boolean Check if this is an "always" task
kill ( ) : void Kill this process
markAsDisappeared ( string $message = null ) : void Mark task as disappeared
process ( ) Process schedule
refresh ( ) Get fresh version of this object
requestKill ( integer $time = null, string $message = null ) Request kill
runNow ( boolean $tryLockJob = true, boolean $forceRun = false ) : Aoe_Scheduler_Model_Schedule Run this task now
saveMessages ( ) Save the messages directly to the schedule record.
schedule ( integer $time = null ) : Aoe_Scheduler_Model_Schedule Schedule this task to be executed at a given time
scheduleNow ( ) : Aoe_Scheduler_Model_Schedule Schedule this task to be executed as soon as possible
setCronExpr ( $expr ) Bypass parent's setCronExpr is the expression is "always" This will break trySchedule, but always tasks will never be tried to scheduled anyway
setLastRunUser ( string | null $user = null ) : self Set the user who ran the last successfully started schedule into a core variable

Méthodes protégées

Méthode Description
_beforeSave ( ) : Mage_Core_Model_Abstract Processing object before save data
_getPdoWarning ( PDO $pdo ) : mixed Retrieve the last PDO warning.
_startBufferToMessages ( ) Redirect all output to the messages field of this Schedule.
_stopBufferToMessages ( ) Stop redirecting all output to the messages field of this Schedule.
jobErrorContext ( ) Switch the job error context
log ( $message, null $level = null ) Log message to configured log file (or skip)
restoreErrorContext ( ) Restore the original error context

Method Details

_addBufferToMessages() public méthode

Used as callback function to redirect the output buffer directly into the messages field of this schedule.
public _addBufferToMessages ( $buffer ) : string
$buffer
Résultat string

_beforeSave() protected méthode

Check if there are other schedules for the same job at the same time and skip saving in this case.
protected _beforeSave ( ) : Mage_Core_Model_Abstract
Résultat Mage_Core_Model_Abstract

_getPdoWarning() protected méthode

Retrieve the last PDO warning.
protected _getPdoWarning ( PDO $pdo ) : mixed
$pdo PDO
Résultat mixed

_startBufferToMessages() protected méthode

We use ob_start with _addBufferToMessages to redirect the output.
protected _startBufferToMessages ( )

_stopBufferToMessages() protected méthode

We use ob_end_flush to stop redirecting the output.
protected _stopBufferToMessages ( )

addMessages() public méthode

Append data to the current messages field.
public addMessages ( $messages )
$messages

canRun() public méthode

Check if this schedule can be run
public canRun ( boolean $throwException = false ) : boolean
$throwException boolean
Résultat boolean

checkPid() public méthode

Check if process is running (linux only)
public checkPid ( ) : boolean
Résultat boolean

checkRunningAsCorrectUser() public méthode

Check if the user running the process matches the configured user. Message will capture cases where the user is not set too in its response message. Process may optionally be killed, or may be allowed to continue.
public checkRunningAsCorrectUser ( ) : boolean
Résultat boolean

getAllStatuses() public méthode

public getAllStatuses ( )

getDuration() public méthode

Get job duration.
public getDuration ( ) : boolean | integer
Résultat boolean | integer time in seconds, or false

getErrorLogFile() public méthode

Get error log filename
public getErrorLogFile ( ) : string
Résultat string

getJob() public méthode

Get job configuration
public getJob ( ) : Aoe_Scheduler_Model_Job
Résultat Aoe_Scheduler_Model_Job

getJobWasLocked() public méthode

Flag that shows that a previous execution was prevented because the job was locked
public getJobWasLocked ( ) : boolean
Résultat boolean

getParameters() public méthode

Get parameters (and fallback to job)
public getParameters ( ) : mixed
Résultat mixed

getStarttime() public méthode

Get start time (planned or actual)
public getStarttime ( ) : string
Résultat string

getStatuses() public méthode

Gets statuses that are currently in the scheduler table
public getStatuses ( ) : array
Résultat array

initializeFromJob() public méthode

Initialize from job
public initializeFromJob ( Aoe_Scheduler_Model_Job $job )
$job Aoe_Scheduler_Model_Job

isAlive() public méthode

true -> alive false -> dead null -> we don't know because the task is running on a different server
public isAlive ( ) : boolean | null
Résultat boolean | null

isAlwaysTask() public méthode

Check if this is an "always" task
public isAlwaysTask ( ) : boolean
Résultat boolean

jobErrorContext() protected méthode

Switch the job error context
protected jobErrorContext ( )

kill() public méthode

Kill this process
public kill ( ) : void
Résultat void

log() protected méthode

Log message to configured log file (or skip)
protected log ( $message, null $level = null )
$message
$level null

markAsDisappeared() public méthode

Mark task as disappeared
public markAsDisappeared ( string $message = null ) : void
$message string
Résultat void

process() public méthode

Process schedule
public process ( )

refresh() public méthode

Get fresh version of this object
public refresh ( )

requestKill() public méthode

Request kill
public requestKill ( integer $time = null, string $message = null )
$time integer
$message string

restoreErrorContext() protected méthode

Restore the original error context
protected restoreErrorContext ( )

runNow() public méthode

Run this task now
public runNow ( boolean $tryLockJob = true, boolean $forceRun = false ) : Aoe_Scheduler_Model_Schedule
$tryLockJob boolean
$forceRun boolean
Résultat Aoe_Scheduler_Model_Schedule

saveMessages() public méthode

If the messages field was not updated in the database, check if this is because of data truncation and fix the message length.
public saveMessages ( )

schedule() public méthode

Schedule this task to be executed at a given time
public schedule ( integer $time = null ) : Aoe_Scheduler_Model_Schedule
$time integer
Résultat Aoe_Scheduler_Model_Schedule

scheduleNow() public méthode

Schedule this task to be executed as soon as possible
Deprecation: use Aoe_Scheduler_Model_Schedule::schedule() instead
public scheduleNow ( ) : Aoe_Scheduler_Model_Schedule
Résultat Aoe_Scheduler_Model_Schedule

setCronExpr() public méthode

Bypass parent's setCronExpr is the expression is "always" This will break trySchedule, but always tasks will never be tried to scheduled anyway
public setCronExpr ( $expr )
$expr

setLastRunUser() public méthode

Set the user who ran the last successfully started schedule into a core variable
public setLastRunUser ( string | null $user = null ) : self
$user string | null Optional: if specified, overrides the default
Résultat self

Property Details

$_eventObject protected_oe property

In an observer method you can use $observer->getData('schedule') or $observer->getData('data_object') to get this object
protected string $_eventObject
Résultat string

$_eventPrefix protected_oe property

Event name prefix for events that are dispatched by this class
protected string $_eventPrefix
Résultat string

$_redirect protected_oe property

Placeholder to keep track of active redirect buffer.
protected bool $_redirect
Résultat boolean

$_redirectOutputHandlerChunkSize protected_oe property

Prior to PHP 5.4.0, the value 1 set the chunk size to 4096 bytes.
protected $_redirectOutputHandlerChunkSize

$errorSettingsBackup protected_oe property

Backup of the original error settings
protected array $errorSettingsBackup
Résultat array

$job protected_oe property

protected Aoe_Scheduler_Model_Job $job
Résultat Aoe_Scheduler_Model_Job

$jobWasLocked protected_oe property

protected bool $jobWasLocked
Résultat boolean