Job View code

A class defining an asynchronous job, and mechanisms for saving and retrieving that job.

package

CMS

author

Robert Campbell

copyright

Copyright (c) 2017, Robert Campbell calguy1000@cmsmadesimple.org

since 2.2
property-read

A unique integer id for this job (generated on save).

property-read

The unix timestamp that this job was first created.

property-read

The number of errors encountered while trying to pricess this job.

Methods

__construct() 

Constructor.

delete() 

Delete this job from the database.

This method will throw exceptions if the job manager module is not available, or if for some reason the job could not be removed.

save() 

Save this job to the database.

This method will throw exceptions if the job manager module is not available, or if for some reason the job could not be saved.

execute() 

Abstract function to execute the job.

abstract

Note: all jobs should be able to execute properly within one HTTP request. Jobs cannot count on administrator or data stored in session variables. Any data that is needed for the job to process should either be stored with the job object, or stored in the database in a user-independant format.

Properties

name

name : string

The name of this job. If not specified a unique random name will be generated.

Type(s)

string

module

module : string

The module that created this job. Useful if the job ever needs to be deleted.

Type(s)

string

start

start : integer

The minimum time that this job should start at.

Type(s)

integer

id

id : integer

A unique integer id for this job (generated on save).

Type(s)

integer

created

created : integer

The unix timestamp that this job was first created.

Type(s)

integer

errors

errors : integer

The number of errors encountered while trying to pricess this job.

Type(s)

integer