/
[console] Command for running scheduled tasks

[console] Command for running scheduled tasks

Scheduled tasks allow to perform various tasks in background and usually are executed from CRON. During scheduled task development it's often needed to execute single scheduled task and there is "Run" button on "Scheduled Tasks" section that allows to do that.

Unfortunately that "Run" button executes scheduled task in "Admin Console context" and using currently logged-in user ID. In real life (from CRON) scheduled tasks are executed in "Front-End context" and using "root" user. Such inconsistency ends up in developer thinking that scheduled task is working (when executed in Admin Console), but in fact it's not working (when executed from CRON).

Solution

To remove that inconsistency I propose to create "in-portal scheduled-task:run" command that will:

  • execute given scheduled task, when it's name is given: 

    in-portal scheduled-task:run check_submission_repies
  • execute all scheduled tasks, when name isn't given: 

    in-portal scheduled-task:run

Then this command can be called from tools/cron.php script as well to avoid it being used from Web context.

Related Tasks

INP-1435 - Getting issue details... STATUS