Dotclear


Version 5 (modified by Tomtom33, 15 years ago) (diff)

Edit plugin documentation

Français

dcCron

Schedule any tasks

Author/Contributors?

Development

Bugs and features requests

Repository

Recent Changes

[2656] by Tomtom33 on 09/21/10 12:33:53

dcCron:

  • Updated link with dcLog plugin
  • Updated CSS class for tasks list

[2654] by Tomtom33 on 09/21/10 11:28:34

dcCron 2.0-RC2:

  • Exception management for check() function
  • Improved filters
  • Improved UI

[2650] by Tomtom33 on 09/20/10 20:06:11

dcCron 2.0-RC1:

  • Lock file support
  • Fixed date concurrency
  • Improved tasks check
  • Improved UI

Documentation

dcCron is a generic plugin can be called by others to schedule tasks. It provides a simply API to use it

Add / Modify tasks

To add a task in dcCron, just put this in your code :

if (isset($core->blog->dcCron)) {
 $core->blog->dcCron->put('taskNameId','interval','callback');
}
  • taskNameId must be an alphanumeric string. That's means just contains letters and numbers.
  • nterval must be an interger. Second is the unit .
  • callback must be an array with class name or object in first argument and function in second.

Note: Callback must be an static method. You can not specify an object

If a task is already defined, function will modify the actual one if interval changed

Delete task

To delete tasks just put this in your code :

if (isset($core->blog->dcCron)) {
 $core->blog->dcCron->del('taskNameId');
}
  • taskNameId must be a valide task name id.

Verify if function exists

To verify if function exists or not, just put this code :

if ($core->blog->dcCron->taskExists('taskNameId')) {
 # Task exists at this point
}
  • taskNameId must be a valide task name id.

Attachments

Sites map