Jump to content

Debugging DailyCronJob hook


Recommended Posts

Hello,

We're experiencing some issues with DailyCronJob hook (it's not triggered for our custom written modules). We also have few modules written by 3rd parties and encoded with Zend or ionCube so we can't really examine the code for all of them. Is there any way to examine if any of them is interrupting the code execution? Also what's the order of execution? Is it something like alphabetically by module name or just something random? Is each call of hook function from WHMCS core wrapped with "try .. catch" to ensure that one failing module won't stop the whole sequense of hooks from different modules?

Thank you in advance.

P.S. I've added a test code (below) to one of our modules. Daily cron execution time is set to 9 a.m.

add_hook("AfterCronJob", 1, function ($vars) {
    localAPI('LogActivity', ['description' => 'Kirill confirms AfterCronJob working.'], 'vasilisk');
});

add_hook("DailyCronJob", 1, function ($vars) {
    localAPI('LogActivity', ['description' => 'Kirill confirms DailyCronJob working.'], 'vasilisk');
});

add_hook("DailyCronJobPreEmail", 1, function ($vars) {
    localAPI('LogActivity', ['description' => 'Kirill confirms DailyCronJobPreEmail working.'], 'vasilisk');
});

add_hook("PreCronJob", 1, function ($vars) {
    localAPI('LogActivity', ['description' => 'Kirill confirms PreCronJob working.'], 'vasilisk');
});

The resulting output is:

Quote
03/04/2018 09:20
Kirill confirms AfterCronJob working.
vasilisk  
03/04/2018 09:10
Kirill confirms AfterCronJob working.
vasilisk  
03/04/2018 09:00
Kirill confirms PreCronJob working.
vasilisk  
03/04/2018 08:50
Kirill confirms AfterCronJob working.
vasilisk  
03/04/2018 08:40
Kirill confirms AfterCronJob working.
vasilisk

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated