I'm working on making phpbb cron facilities invokable by the system cron daemon, because having users request 'cron.php' on a dedicated server is just silly. That's not actually straightforward because phpbb cron code is tightly coupled to the idea that it's invoked by users like normal pages. I came up with a new design that allows cron tasks to be invoked either the 'phpbb way' or the 'system way', and has a very nice side effect that modifications can trivially add cron tasks without needing to change any existing code. Is there interest in incorporating this change into phpbb itself?
Here's how the new cron design works. A 'cron task' is a piece of php code that should be periodically executed, so named to avoid confusion with a 'cron job', which is something one specifies in system crontab. There is a new class called cron which is the interface between cron tasks and the code that uses cron tasks. The cron class provides methods to retrieve runnable tasks, 'schedule' them (if using phpbb system) by generating appropriate html code, and invoke the tasks. Cron class does not have any actual task definitions however; those exist in separate classes which are loaded by cron class (automatically). A task class contains definitions of one or more tasks along with code to actually run the tasks. Task definitions describe task properties: which configuration setting controls whether the task is enabled, whether task needs to check a condition to determine its runnability, etc.
In order for a modification to add cron tasks it needs to do two things. First, create a new cron task class with appropriate definitions and place it in the right directory. Second, add the class name to the list of enabled classes (or modules) in config.
Configuration gains two settings: how to run cron tasks (phpbb or system) and which cron modules are enabled (comma-separated list).
I think mod authors will benefit from this cron design. From what I read there's demand for adding cron tasks to phpbb but not many people do it through phpbb's current cron system.




