General developer forum

Task API, a task running but seemingly not calling the cron function

Picture of sam marshall
Re: Task API, a task running but seemingly not calling the cron function
Core developersParticularly helpful MoodlersPlugin developersTesters

Hi Olli,

I don't think your interface suggestion would work because there is no connection between legacy cron and any tasks. In other words, you could have a plugin which contains both a legacy cron function and one or more tasks, and these can do entirely different things. It's not the case that these are somehow two switches for the same functionality.

Really in the case you describe the plugin is clearly broken (because it apparently defines a 'task' that does nothing) so the usability confusion is mainly caused by the plugin, not with the Moodle interface. If the plugin were implemented correctly, it would either:

a) not have any tasks, still relying on legacy cron


b) have a task that actually does the work, not needing legacy cron to be turned on

So, somebody should fix the plugin. smile

It might be possible to make Moodle generate (for administrators) a list of plugins that require legacy cron to be enabled, so you can see if you need to run it. The only problem with this is there's no way for it to tell for certain - it could look for the existence of a legacy cron function, but if the plugin wants to be supported across older Moodle versions, it's possible that it might have both the legacy cron function and the newer tasks, with the cron function doing nothing on newer versions where the tasks are assumed to do the work...


Average of ratings: Useful (1)