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

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

by Olli Savolainen -
Number of replies: 1

It turns out there's a setting for 'Legacy cron processing for plugins', which was turned off. So even though inactive_user_cleanup task was turned on, that didn't help as it depended on that other Task being turned on.

Usability recommendation: If there's a such a modality in the system, i.e. dependency on another Task, please make it visible in the system.

I.e. could Moodle detect if a plugin depends on 'Legacy cron processing' being turned on?

-> and then alert the user that they still have to turn that on if they have a dependent Task turned on. 

i.e tell them that it's not enough for the task of the plugin itself to be on.

In reply to Olli Savolainen

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

by sam marshall -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

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

or

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...

--sam

Average of ratings: Useful (1)