Piwik\

ScheduledTask

Contains metadata referencing PHP code that should be executed at regular intervals.

See the TaskScheduler docs to learn more about scheduled tasks.

Methods

The class defines the following methods:

  • __construct() Inherited from Task
  • getObjectInstance() ash; Returns the object instance that contains the method to execute. Inherited from Task
  • getClassName() ash; Returns the name of the class that contains the method to execute. Inherited from Task
  • getMethodName() ash; Returns the name of the method that will be executed. Inherited from Task
  • getMethodParameter() ash; Returns the value that will be passed to the method when executed, or null if no value will be supplied. Inherited from Task
  • getScheduledTime() ash; Returns a Schedule instance that describes when the method should be executed and how long before the next execution. Inherited from Task
  • getRescheduledTime() ash; Returns the time in milliseconds when this task will be executed next. Inherited from Task
  • getPriority() ash; Returns the task priority. Inherited from Task
  • getName() ash; Returns a unique name for this scheduled task. Inherited from Task

__construct()

Signature

  • It accepts the following parameter(s):
    • $objectInstance (mixed) — The object or class that contains the method to execute regularly. Usually this will be a Plugin instance.
    • $methodName (string) — The name of the method that will be regularly executed.
    • $methodParameter (mixed|null) — An optional parameter to pass to the method when executed. Must be convertible to string.
    • $scheduledTime (Schedule|null) — A Schedule instance that describes when the method should be executed and how long before the next execution.
    • $priority (int) — The priority of the task. Tasks with a higher priority will be executed first. Tasks with low priority will be executed last.
  • It throws one of the following exceptions:

getObjectInstance()

Returns the object instance that contains the method to execute.

Returns a class name if the method is static.

Signature

  • It returns a mixed value.

getClassName()

Returns the name of the class that contains the method to execute.

Signature

  • It returns a string value.

getMethodName()

Returns the name of the method that will be executed.

Signature

  • It returns a string value.

getMethodParameter()

Returns the value that will be passed to the method when executed, or null if no value will be supplied.

Signature

  • Returns: string|null

getScheduledTime()

Returns a Schedule instance that describes when the method should be executed and how long before the next execution.

Signature

getRescheduledTime()

Returns the time in milliseconds when this task will be executed next.

Signature

  • It returns a int value.

getPriority()

Returns the task priority.

The priority will be an integer whose value is between HIGH_PRIORITY and LOW_PRIORITY.

Signature

  • It returns a int value.

getName()

Returns a unique name for this scheduled task.

The name is stored in the DB and is used to store a task's previous execution time. The name is created using:

  • the name of the class that contains the method to execute,
  • the name of the method to regularly execute,
  • and the value that is passed to the executed task.

Signature

  • It returns a string value.