Piwik\Scheduler\Schedule\

Schedule

Describes the interval on which a scheduled task is executed.

Methods

The abstract class defines the following methods:

  • setHour() — Sets the hour of the day on which the task should be executed.
  • factory() — Returns a new Schedule instance using a string description of the scheduled period type and a string description of the day within the period to execute the task on.

setHour()

Sets the hour of the day on which the task should be executed.

Signature

  • It accepts the following parameter(s):
    • $hour (int) — Must be >= 0 and < 24.
  • It does not return anything or a mixed result.
  • It throws one of the following exceptions:
    • Exception — If the current scheduled period is hourly or if $hour is invalid.

factory()

Returns a new Schedule instance using a string description of the scheduled period type and a string description of the day within the period to execute the task on.

Signature

  • It accepts the following parameter(s):

    • $periodType (string) — The scheduled period type. Can be 'hourly', 'daily', 'weekly', or 'monthly'.
    • $periodDay (bool|false|int|string) — A string describing the day within the scheduled period to execute the task on. Only valid for week and month periods. If 'weekly' is supplied for $periodType, this should be a day of the week, for example, 'monday' or 'tuesday'. If 'monthly' is supplied for $periodType, this can be a numeric day in the month or a day in one week of the month. For example, 12, 23, 'first sunday' or 'fourth tuesday'.
  • Returns: Hourly|Daily|Weekly|Monthly

  • It throws one of the following exceptions: