Stud.IP  5.4
CronjobSchedule Class Reference
Inheritance diagram for CronjobSchedule:
SimpleORMap

Public Member Functions

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

Static Public Member Functions

static getPriorities ()
 
static describePriority ($priority)
 
- Static Public Member Functions inherited from SimpleORMap
static tableScheme ($db_table)
 
static expireTableScheme ()
 
static exists ($id)
 
static countBySql ($sql='1', $params=[])
 
static create ($data)
 
static buildExisting ($data)
 
static import ($data)
 
static findBySQL ($sql, $params=[])
 
static findOneBySQL ($where, $params=[])
 
static findThru ($foreign_key_value, $options)
 
static findEachBySQL ($callable, $sql, $params=[])
 
static findMany ($pks=[], $order='', $order_params=[])
 
static findEachMany ($callable, $pks=[], $order='', $order_params=[])
 
static findAndMapBySQL ($callable, $where, $params=[])
 
static findAndMapMany ($callable, $pks=[], $order='', $order_params=[])
 
static deleteBySQL ($where, $params=[])
 
static toObject ($id_or_object)
 
static __callStatic ($name, $arguments)
 

Data Fields

const PRIORITY_LOW = 'low'
 
const PRIORITY_NORMAL = 'normal'
 
const PRIORITY_HIGH = 'high'
 
- Data Fields inherited from SimpleORMap
const ID_SEPARATOR = '_'
 

Protected Member Functions

 cbJsonifyParameters ($type)
 
 testTimestamp ($timestamp, $condition, $format)
 
- Protected Member Functions inherited from SimpleORMap
 _getId ($field)
 
 _setId ($field, $value)
 
 _getAdditionalValueFromRelation ($field)
 
 _setAdditionalValueFromRelation ($field, $value)
 
 _getAdditionalValue ($field)
 
 _setAdditionalValue ($field, $value)
 
 parseRelationOptions ($type, $name, $options)
 
 storeRelations ($only_these=null)
 
 deleteRelations ()
 
 initializeContent ()
 
 applyCallbacks ($type)
 
 cbNotificationMapper ($cb_type)
 
 cbAfterInitialize ($cb_type)
 
 setSerializedValue ($field, $value)
 
 setI18nValue ($field, $value)
 

Static Protected Member Functions

static configure ($config=[])
 
- Static Protected Member Functions inherited from SimpleORMap
static db_table ()
 
static db_fields ()
 
static pk ()
 
static default_values ()
 
static serialized_fields ()
 
static alias_fields ()
 
static i18n_fields ()
 
static additional_fields ()
 
static has_many ()
 
static has_one ()
 
static belongs_to ()
 
static has_and_belongs_to_many ()
 
static registered_callbacks ()
 
static known_slots ()
 
static notification_map ()
 
static getter_setter_map ()
 
static configure ($config=[])
 
static config ($key)
 
static registerCallback ($types, $cb)
 
static unregisterCallback ($types, $cb)
 

Additional Inherited Members

- Static Public Attributes inherited from SimpleORMap
static $schemes = null
 
- Protected Attributes inherited from SimpleORMap
 $content = []
 
 $content_db = []
 
 $is_new = true
 
 $is_deleted = false
 
 $relations = []
 
 $additional_data = []
 
- Static Protected Attributes inherited from SimpleORMap
static $config = []
 
static $reserved_slots = ['value','newid','iterator','tablemetadata', 'relationvalue','wherequery','relationoptions','data','new','id']
 
static $performs_batch_operation = false
 

Member Function Documentation

◆ activate()

activate ( )

Activates this schedule.

Returns
CronjobSchedule Returns itself to allow chaining

◆ calculateNextExecution()

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)

◆ cbJsonifyParameters()

cbJsonifyParameters (   $type)
protected

◆ configure()

static configure (   $config = [])
staticprotected

◆ deactivate()

deactivate ( )

Deactivates this schedule.

Returns
CronjobSchedule Returns itself to allow chaining

◆ describePriority()

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

◆ execute()

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

◆ getPriorities()

static getPriorities ( )
static

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

Returns
Array The mapped priorities

◆ getTitle()

getTitle ( )

replaces title with task name if title is empty.

Returns
string the title or the task name

◆ shouldExecute()

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()

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

◆ testTimestamp()

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

Field Documentation

◆ PRIORITY_HIGH

const PRIORITY_HIGH = 'high'

◆ PRIORITY_LOW

const PRIORITY_LOW = 'low'

◆ PRIORITY_NORMAL

const PRIORITY_NORMAL = 'normal'

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