diff --git a/lib/cronlib.php b/lib/cronlib.php index cb8bb988272..5db8ba8bb2b 100644 --- a/lib/cronlib.php +++ b/lib/cronlib.php @@ -72,6 +72,9 @@ function cron_run() { try { get_mailer('buffer'); $task->execute(); + if ($DB->is_transaction_started()) { + throw new coding_exception("Task left transaction open"); + } if (isset($predbqueries)) { mtrace("... used " . ($DB->perf_get_queries() - $predbqueries) . " dbqueries"); mtrace("... used " . (microtime(1) - $pretime) . " seconds"); @@ -105,6 +108,9 @@ function cron_run() { try { get_mailer('buffer'); $task->execute(); + if ($DB->is_transaction_started()) { + throw new coding_exception("Task left transaction open"); + } if (isset($predbqueries)) { mtrace("... used " . ($DB->perf_get_queries() - $predbqueries) . " dbqueries"); mtrace("... used " . (microtime(1) - $pretime) . " seconds");