Stud.IP  2.4 Revision 48548
 All Data Structures Namespaces Files Functions Variables Groups Pages
CronjobSchedule Class Reference
Inheritance diagram for CronjobSchedule:
Inheritance graph
Collaboration diagram for CronjobSchedule:
Collaboration graph

Public Member Functions

 getTitle ()
 __construct ($id=null)
 store ()
 activate ()
 deactivate ()
 execute ($force=false)
 shouldExecute ($now=null)
 calculateNextExecution ($now=null)
- Public Member Functions inherited from SimpleORMap
 __clone ()
 getRelationOptions ($relation)
 getTableMetadata ()
 hasAutoIncrementColumn ()
 setId ($id)
 getId ()
 getNewId ()
 toArray ($only_these_fields=null)
 toArrayRecursive ($depth=1, $only_these_fields=null)
 getValue ($field)
 getRelationValue ($relation, $field)
 setValue ($field, $value)
 __get ($field)
 __set ($field, $value)
 __isset ($field)
 offsetExists ($offset)
 offsetGet ($offset)
 offsetSet ($offset, $value)
 offsetUnset ($offset)
 getIterator ()
 count ()
 isField ($field)
 isAdditionalField ($field)
 isAliasField ($field)
 setData ($data, $reset=false)
 haveData ()
 isNew ()
 isDeleted ()
 setNew ($is_new)
 getWhereQuery ()
 restore ()
 triggerChdate ()
 delete ()
 isDirty ()
 isFieldDirty ($field)
 revertValue ($field)
 initRelation ($relation)
 resetRelation ($relation)

Static Public Member Functions

static getPriorities ()
static describePriority ($priority)
- Static Public Member Functions inherited from SimpleORMap
static expireTableScheme ()
static find ($id)
static exists ($id)
static countBySql ($where=1, $params=array())
static create ($data)
static import ($data)
static findBySQL ($where, $params=array())
static findThru ($foreign_key_value, $options)
static findEachBySQL ($callable, $where, $params=array())
static findMany ($pks=array(), $order= '')
static findEachMany ($callable, $pks=array(), $order= '')
static deleteBySQL ($where, $params=array())
static toObject ($id_or_object)
static __callStatic ($name, $arguments)

Data Fields

const PRIORITY_LOW = 'low'
const PRIORITY_NORMAL = 'normal'
const PRIORITY_HIGH = 'high'

Protected Member Functions

 testTimestamp ($timestamp, $condition, $format)
- Protected Member Functions inherited from SimpleORMap
 parseRelationOptions ($type, $name, $options)
 getTableScheme ()
 storeRelations ()
 deleteRelations ()
 initializeContent ()
 applyCallbacks ($type)
 registerCallback ($types, $cb)
 unregisterCallback ($types, $cb)
 cbAutoIncrementColumn ($type)
 cbAutoKeyCreation ()

Additional Inherited Members

- Static Protected Member Functions inherited from SimpleORMap
static tableScheme ($db_table)
- Protected Attributes inherited from SimpleORMap
 $content = array()
 $content_db = array()
 $is_new = true
 $db_table = ''
 $db_fields = null
 $pk = null
 $default_values = array()
 $alias_fields = array()
 $additional_fields = array()
 $relations = array()
 $has_many = array()
 $has_one = array()
 $belongs_to = array()
 $has_and_belongs_to_many = array()
 $registered_callbacks
 $known_slots = array()
 $reserved_slots = array('value','newid','iterator','tablemetadata', 'relationvalue','wherequery','relationoptions','data','new','id')
- Static Protected Attributes inherited from SimpleORMap
static $schemes

Constructor & Destructor Documentation

__construct (   $id = null)

Defines the associated database table, relations to the task and logs and appropriate callbacks to encode/decode the parameters.

Parameters
mixed$idId of the schedule entry in question or null for a new entry

Reimplemented from SimpleORMap.

Here is the call graph for this function:

Member Function Documentation

activate ( )

Activates this schedule.

Returns
CronjobSchedule Returns itself to allow chaining

Here is the call graph for this function:

calculateNextExecution (   $now = null)

Calculates the next execution for this schedule.

For schedules of type 'once' the check solely tests whether the timestamp has already passed and will return false in that case. Otherwise the defined timestamp will be returned.

For schedules of type 'periodic' the next execution is calculated by increasing the current timestamp and testing whether all conditions match. This is not the best method to test and should be optimized sooner or later.

Parameters
mixed$nowDefines the temporal fix point
Returns
int Timestamp of calculated next execution
Exceptions
RuntimeExceptionWhen calculation takes too long (you should check the conditions for validity in that case)

Here is the call graph for this function:

Here is the caller graph for this function:

deactivate ( )

Deactivates this schedule.

Returns
CronjobSchedule Returns itself to allow chaining

Here is the call graph for this function:

static describePriority (   $priority)
static

Maps a priority value to it's localized label.

Parameters
String$priorityPriority value
Returns
String The localized label
Exceptions
RuntimeExceptionwhen an unknown priority value is passed

Here is the call graph for this function:

execute (   $force = false)

Executes this schedule.

Parameters
bool$forcePass true to force execution of the schedule even if it's not activated
Returns
mixed The result of the execution
Exceptions
RuntimeExceptionWhen either the schedule or the according is not activated

Here is the call graph for this function:

static getPriorities ( )
static

Returns a mapped version of the priorities (key = priority value, value = localized priority label).

Returns
Array The mapped priorities

Here is the caller graph for this function:

getTitle ( )

replaces title with task name if title is empty.

Returns
string the title or the task name
shouldExecute (   $now = null)

Determines whether the schedule should execute given the provided timestamp.

Parameters
mixed$nowDefines the temporal fix point
Returns
bool Whether the schedule should execute or not.
store ( )

Stores the schedule in database. Will bail out with an exception if the provided task does not exists. Will also nullify the title if it matches the task name (see CronjobSchedule::getTitle()).

Returns
CronjobSchedule Returns itself to allow chaining

Reimplemented from SimpleORMap.

Here is the caller graph for this function:

testTimestamp (   $timestamp,
  $condition,
  $format 
)
protected

Tests a timestamp against the passed condition.

Parameters
int$timestampThe timestamp to test
mixed$conditionCan be either null for "don't care", a positive number for an exact moment or a negative number for a repeating moment
String$formatFormat for date() to extract a portion of the timestamp

Here is the caller graph for this function:

Field Documentation

const PRIORITY_HIGH = 'high'
const PRIORITY_LOW = 'low'
const PRIORITY_NORMAL = 'normal'

The documentation for this class was generated from the following file: