CMS Made Simple API

RegularTask extends Job
in package

This class allows converting an old CmsRegularTask pseudocron task into an asynchronous background job.

Tags
author

Robert Campbell

copyright

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

since
2.2

Table of Contents

Properties

$created  : int
$errors  : int
$id  : int
$module  : string
$name  : string
$start  : int
$task  : CmsRegularTask

Methods

__construct()  : mixed
Constructor.
delete()  : mixed
Delete this job from the database.
execute()  : mixed
Abstract function to execute the job.
save()  : mixed
Save this job to the database.

Properties

$created read-only

public int $created

The unix timestamp that this job was first created.

$errors read-only

public int $errors

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

$id read-only

public int $id

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

$module

public string $module

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

$name

public string $name

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

$start

public int $start

The minimum time that this job should start at.

Methods

__construct()

Constructor.

public __construct(CmsRegularTask $task) : mixed
Parameters
$task : CmsRegularTask

delete()

Delete this job from the database.

public delete() : mixed

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

execute()

Abstract function to execute the job.

public abstract execute() : mixed

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.

save()

Save this job to the database.

public save() : mixed

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


        
On this page

Search results