Jobs - "executeJob" vs "run"
PermalinkThe "run" method doesn't update the Job database table in any way whatsoever. So the job will run, but you wont get any updates to "jobLastRun" dates.
"executeJob" is the more robust method that behaves as you'd expect.
Have you checked the code I've mentioned above? If you override executeJob, you'll also override the code which marks a job as executed. You can also see that the run() method is specified as "abstract", not implementing it would certainly be wrong..
Loader::model("job"); $fetch_feed = Job::getByHandle('fetch_feed'); $fetch_feed->executeJob();
Which, as far I can tell, does exactly what I'd expect (and is what I see in the function).
- Mark the Job as running
- Try to run the job
- If it completes, mark as Completed.
If I do this;
Loader::model("job"); $fetch_feed = Job::getByHandle('fetch_feed'); $fetch_feed->run();
... I get zero updates to the Jobs database table. Nothing. But the job runs.
When you call the job yourself, you'll have to call "executeJob", but when you implement a job, you'll have to use the "run" method.
I think it's pretty rare that someone calls a job directly, but if they do, executeJob is the way to go
https://github.com/concrete5/concrete5/blob/master/web/concrete/core...