XF 2.3 Manual Cron Job Detection

I've now taken the time to look through cron jobs, and I didn't see anything that would let me see if a cron job is run manually or if it was automated.

Has anyone seen something I've missed?



As a tempory fix I created a specific way of running the job. If you force a cron job to run it will have the flag automatic. Then I modified my template to have a button that will run the job. When the button is pressed it instead passes the manual flag.

It feels like such a hodge podge method, but it works... If anyone has a better solution please let me know :)
 
Last edited:
Solution
Not all cron entries are jobs exactly (though cron itself is run via the job queue). The general pattern would be to have a static cron method which enqueues your job, and then a template modification for tools_rebuild which allows for manually running the job when needed.
I thought the database table xf_job would be a good place to find it. I was kind of correct, it has a flag for manual_execute but it doesn't have all the cron jobs registered on there. Just cron, xfCollectStats, xfUpgradeCheck the value cron seems to be linked with all the cron jobs (When I say linked I mean when any of the cron jobs get run,. the time stamp updates for the unique_key cron), so there doesn't look to be a way of detecting which specific cron job has been run. It also seems to not change the manual_execute when the job is run.
 
Not all cron entries are jobs exactly (though cron itself is run via the job queue). The general pattern would be to have a static cron method which enqueues your job, and then a template modification for tools_rebuild which allows for manually running the job when needed.
 
Solution
Not all cron entries are jobs exactly (though cron itself is run via the job queue). The general pattern would be to have a static cron method which enqueues your job, and then a template modification for tools_rebuild which allows for manually running the job when needed.
Thank you this pretty much confirmed what I'd figured out while messing with it.
 
Back
Top Bottom