From c8dd1fbd72959e04300c1d2a89e5165028b90f46 Mon Sep 17 00:00:00 2001 From: Nicolas Domenech <52404047+nicolas-eoxia@users.noreply.github.com> Date: Wed, 13 Nov 2024 23:21:33 +0100 Subject: [PATCH] New hook beforeRunCronJob and afterRunCronJob (#29884) --- scripts/cron/cron_run_jobs.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php index 303c8d6b9798a..49da9149aff6b 100755 --- a/scripts/cron/cron_run_jobs.php +++ b/scripts/cron/cron_run_jobs.php @@ -281,6 +281,10 @@ dol_syslog("cron_run_jobs.php::fetch Error ".$cronjob->error, LOG_ERR); exit(1); } + + $parameters = array('cronjob' => $cronjob, 'line' => $line); + $reshook = $hookmanager->executeHooks('beforeRunCronJob', $parameters, $object); + // Execute job $result = $cronjob->run_jobs($userlogin); if ($result < 0) { @@ -307,6 +311,9 @@ } echo "Job re-scheduled\n"; + + $parameters = array('cronjob' => $cronjob, 'line' => $line); + $reshook = $hookmanager->executeHooks('afterRunCronJob', $parameters, $object); } else { echo " - not qualified (datenextrunok=".($datenextrunok ?: 0).", datestartok=".($datestartok ?: 0).", dateendok=".($dateendok ?: 0).")\n";