Like i said, i'm thinking about writing a plugin that can be used as a tasksheduler: NP_Sheduler.
This is how i plan to do it (please comment! does it make sense at all?):
- The plugin will execute 'task-scripts' at a certain time. These taskscripts are just php files with a name like task_foobar.php and a function start_task() to start the task. These file will be dropped in the 'tasks'-folder inside the 'sheduler'-folder, so that the plugin can 'scan' this folder to find new taskscripts. Other plugin could then 'drop-in' taskscripts when they are installed (well just unzipped ofcourse), and after that the user will be able to make a task for the new script, by selecting the task-script from the list and plan it
- The plugin subscribes to the very last event, to check if there are tasks to be done (checks the current timestamp with the calculated 'next-run'-timestamp of every task, if current is > nextrun -> run the task), and if so includes the appropriate task_scripts and calls the start_task()-function.
- To store the time of the tasks in the database i'll use unix-notation (the one found in CPanel > cronjobs > avanced (unix notation)
- after a task has been run the plugin computes the timestamp for the next run and stores this in the database (so that it can be compared with the current timestamp in the event).