diff --git a/library/includes/cron/cron_run.php b/library/includes/cron/cron_run.php index 06b5e8896..fbb0103fb 100644 --- a/library/includes/cron/cron_run.php +++ b/library/includes/cron/cron_run.php @@ -46,6 +46,7 @@ foreach ($cron_jobs as $job) { if (is_file($job_script)) { $cron_start_time = utime(); $cron_runtime_log = []; + $cronjob_completed = false; $cron_write_log = (CRON_LOG_ENABLED && (CRON_FORCE_LOG || $job['log_enabled'] >= 1)); $cron_sql_log_file = CRON_LOG_DIR . '/SQL-' . basename($job['cron_script']); @@ -90,7 +91,7 @@ foreach ($cron_jobs as $job) { } } - if (!defined('CRONJOB_COMPLETED') || !CRONJOB_COMPLETED) { + if (!$cronjob_completed) { return; } diff --git a/library/includes/cron/jobs/attach_maintenance.php b/library/includes/cron/jobs/attach_maintenance.php index c5864ef28..102f4c111 100644 --- a/library/includes/cron/jobs/attach_maintenance.php +++ b/library/includes/cron/jobs/attach_maintenance.php @@ -213,4 +213,4 @@ DB()->query("DROP TEMPORARY TABLE $tmp_attach_tbl"); unset($fix_errors, $debug_mode); // Cron completed -define('CRONJOB_COMPLETED', true); +$cronjob_completed = true; diff --git a/library/includes/cron/jobs/board_maintenance.php b/library/includes/cron/jobs/board_maintenance.php index 1455abbdf..6dc52c067 100644 --- a/library/includes/cron/jobs/board_maintenance.php +++ b/library/includes/cron/jobs/board_maintenance.php @@ -66,4 +66,4 @@ $datastore->update('check_updates'); $datastore->update('files_integrity'); // Cron completed -define('CRONJOB_COMPLETED', true); +$cronjob_completed = true; diff --git a/library/includes/cron/jobs/clean_dlstat.php b/library/includes/cron/jobs/clean_dlstat.php index fe80238e1..d9f853a06 100644 --- a/library/includes/cron/jobs/clean_dlstat.php +++ b/library/includes/cron/jobs/clean_dlstat.php @@ -85,4 +85,4 @@ DB()->query(" "); // Cron completed -define('CRONJOB_COMPLETED', true); +$cronjob_completed = true; diff --git a/library/includes/cron/jobs/clean_log.php b/library/includes/cron/jobs/clean_log.php index ba9abe994..6b23e296c 100644 --- a/library/includes/cron/jobs/clean_log.php +++ b/library/includes/cron/jobs/clean_log.php @@ -18,4 +18,4 @@ if ($log_days_keep !== 0) { } // Cron completed -define('CRONJOB_COMPLETED', true); +$cronjob_completed = true; diff --git a/library/includes/cron/jobs/clean_pm.php b/library/includes/cron/jobs/clean_pm.php index 1de3253d6..ae677e7fd 100644 --- a/library/includes/cron/jobs/clean_pm.php +++ b/library/includes/cron/jobs/clean_pm.php @@ -40,4 +40,4 @@ if ($pm_days_keep !== 0) { } // Cron completed -define('CRONJOB_COMPLETED', true); +$cronjob_completed = true; diff --git a/library/includes/cron/jobs/clean_search_results.php b/library/includes/cron/jobs/clean_search_results.php index 64d7fd47b..56693988b 100644 --- a/library/includes/cron/jobs/clean_search_results.php +++ b/library/includes/cron/jobs/clean_search_results.php @@ -19,4 +19,4 @@ DB()->query(" "); // Cron completed -define('CRONJOB_COMPLETED', true); +$cronjob_completed = true; diff --git a/library/includes/cron/jobs/demo_mode.php b/library/includes/cron/jobs/demo_mode.php index b6e5ee252..72ac39c8a 100644 --- a/library/includes/cron/jobs/demo_mode.php +++ b/library/includes/cron/jobs/demo_mode.php @@ -44,4 +44,4 @@ foreach (file($dump_path) as $line) { } // Cron completed -define('CRONJOB_COMPLETED', true); +$cronjob_completed = true; diff --git a/library/includes/cron/jobs/ds_update_cat_forums.php b/library/includes/cron/jobs/ds_update_cat_forums.php index 18c63dfd5..ad6f655fd 100644 --- a/library/includes/cron/jobs/ds_update_cat_forums.php +++ b/library/includes/cron/jobs/ds_update_cat_forums.php @@ -14,4 +14,4 @@ if (!defined('BB_ROOT')) { $datastore->update('cat_forums'); // Cron completed -define('CRONJOB_COMPLETED', true); +$cronjob_completed = true; diff --git a/library/includes/cron/jobs/ds_update_stats.php b/library/includes/cron/jobs/ds_update_stats.php index 749297816..521174ce9 100644 --- a/library/includes/cron/jobs/ds_update_stats.php +++ b/library/includes/cron/jobs/ds_update_stats.php @@ -14,4 +14,4 @@ if (!defined('BB_ROOT')) { $datastore->update('stats'); // Cron completed -define('CRONJOB_COMPLETED', true); +$cronjob_completed = true; diff --git a/library/includes/cron/jobs/flash_topic_view.php b/library/includes/cron/jobs/flash_topic_view.php index 766643d46..63d6680ba 100644 --- a/library/includes/cron/jobs/flash_topic_view.php +++ b/library/includes/cron/jobs/flash_topic_view.php @@ -35,4 +35,4 @@ DB()->query("DELETE buf FROM " . BUF_TOPIC_VIEW . " buf"); DB()->unlock(); // Cron completed -define('CRONJOB_COMPLETED', true); +$cronjob_completed = true; diff --git a/library/includes/cron/jobs/prune_forums.php b/library/includes/cron/jobs/prune_forums.php index 98a2ac348..9ba8784a1 100644 --- a/library/includes/cron/jobs/prune_forums.php +++ b/library/includes/cron/jobs/prune_forums.php @@ -20,4 +20,4 @@ if ($bb_cfg['prune_enable']) { } // Cron completed -define('CRONJOB_COMPLETED', true); +$cronjob_completed = true; diff --git a/library/includes/cron/jobs/prune_inactive_users.php b/library/includes/cron/jobs/prune_inactive_users.php index 0332e5449..050eb5bd5 100644 --- a/library/includes/cron/jobs/prune_inactive_users.php +++ b/library/includes/cron/jobs/prune_inactive_users.php @@ -55,4 +55,4 @@ while (true) { } // Cron completed -define('CRONJOB_COMPLETED', true); +$cronjob_completed = true; diff --git a/library/includes/cron/jobs/prune_topic_moved.php b/library/includes/cron/jobs/prune_topic_moved.php index 3aa5f4d8d..f3faa01af 100644 --- a/library/includes/cron/jobs/prune_topic_moved.php +++ b/library/includes/cron/jobs/prune_topic_moved.php @@ -22,4 +22,4 @@ if ($bb_cfg['topic_moved_days_keep']) { } // Cron completed -define('CRONJOB_COMPLETED', true); +$cronjob_completed = true; diff --git a/library/includes/cron/jobs/sessions_cleanup.php b/library/includes/cron/jobs/sessions_cleanup.php index 0a58d8100..0775706bb 100644 --- a/library/includes/cron/jobs/sessions_cleanup.php +++ b/library/includes/cron/jobs/sessions_cleanup.php @@ -54,4 +54,4 @@ DB()->query(" "); // Cron completed -define('CRONJOB_COMPLETED', true); +$cronjob_completed = true; diff --git a/library/includes/cron/jobs/sitemap.php b/library/includes/cron/jobs/sitemap.php index 953825336..2d47806ba 100644 --- a/library/includes/cron/jobs/sitemap.php +++ b/library/includes/cron/jobs/sitemap.php @@ -23,4 +23,4 @@ if (is_file(SITEMAP_DIR . '/sitemap.xml')) { } // Cron completed -define('CRONJOB_COMPLETED', true); +$cronjob_completed = true; diff --git a/library/includes/cron/jobs/tr_cleanup_and_dlstat.php b/library/includes/cron/jobs/tr_cleanup_and_dlstat.php index 02ce3a87c..b5c69d4aa 100644 --- a/library/includes/cron/jobs/tr_cleanup_and_dlstat.php +++ b/library/includes/cron/jobs/tr_cleanup_and_dlstat.php @@ -160,4 +160,4 @@ DB()->query(" DB()->query("DROP TABLE IF EXISTS " . NEW_BB_BT_LAST_USERSTAT . ", " . OLD_BB_BT_LAST_USERSTAT); // Cron completed -define('CRONJOB_COMPLETED', true); +$cronjob_completed = true; diff --git a/library/includes/cron/jobs/tr_complete_count.php b/library/includes/cron/jobs/tr_complete_count.php index 2b59501b8..3adefb643 100644 --- a/library/includes/cron/jobs/tr_complete_count.php +++ b/library/includes/cron/jobs/tr_complete_count.php @@ -66,4 +66,4 @@ if ($bb_cfg['ocelot']['enabled']) { }*/ // Cron completed -define('CRONJOB_COMPLETED', true); +$cronjob_completed = true; diff --git a/library/includes/cron/jobs/tr_maintenance.php b/library/includes/cron/jobs/tr_maintenance.php index bf8d10897..9b620bf24 100644 --- a/library/includes/cron/jobs/tr_maintenance.php +++ b/library/includes/cron/jobs/tr_maintenance.php @@ -62,4 +62,4 @@ if ($dead_tor_sql && $attach_sql) { } // Cron completed -define('CRONJOB_COMPLETED', true); +$cronjob_completed = true; diff --git a/library/includes/cron/jobs/tr_make_snapshot.php b/library/includes/cron/jobs/tr_make_snapshot.php index 92f5b7983..a56df2676 100644 --- a/library/includes/cron/jobs/tr_make_snapshot.php +++ b/library/includes/cron/jobs/tr_make_snapshot.php @@ -193,4 +193,4 @@ if ($bb_cfg['torhelp_enabled']) { DB()->expect_slow_query(10); // Cron completed -define('CRONJOB_COMPLETED', true); +$cronjob_completed = true; diff --git a/library/includes/cron/jobs/tr_seed_bonus.php b/library/includes/cron/jobs/tr_seed_bonus.php index 232fddfee..ed82546f7 100644 --- a/library/includes/cron/jobs/tr_seed_bonus.php +++ b/library/includes/cron/jobs/tr_seed_bonus.php @@ -71,4 +71,4 @@ if ($bb_cfg['seed_bonus_enabled'] && $bb_cfg['seed_bonus_points'] && $bb_cfg['se } // Cron completed -define('CRONJOB_COMPLETED', true); +$cronjob_completed = true; diff --git a/library/includes/cron/jobs/tr_update_seeder_last_seen.php b/library/includes/cron/jobs/tr_update_seeder_last_seen.php index fb74b109f..0088cf696 100644 --- a/library/includes/cron/jobs/tr_update_seeder_last_seen.php +++ b/library/includes/cron/jobs/tr_update_seeder_last_seen.php @@ -25,4 +25,4 @@ DB()->query(" DB()->query("TRUNCATE TABLE " . BUF_LAST_SEEDER); // Cron completed -define('CRONJOB_COMPLETED', true); +$cronjob_completed = true; diff --git a/library/includes/cron/jobs/update_forums_atom.php b/library/includes/cron/jobs/update_forums_atom.php index 46eb3474b..aea81396f 100644 --- a/library/includes/cron/jobs/update_forums_atom.php +++ b/library/includes/cron/jobs/update_forums_atom.php @@ -35,4 +35,4 @@ foreach ($forums_data as $forum_data) { } // Cron completed -define('CRONJOB_COMPLETED', true); +$cronjob_completed = true; diff --git a/src/Legacy/Admin/Cron.php b/src/Legacy/Admin/Cron.php index 6c7b918af..43682815b 100644 --- a/src/Legacy/Admin/Cron.php +++ b/src/Legacy/Admin/Cron.php @@ -32,13 +32,14 @@ class Cron bb_die('Could not obtain cron script'); } + $cronjob_completed = false; while ($row = DB()->sql_fetchrow($result)) { $job = $row['cron_script']; $job_script = INC_DIR . '/cron/jobs/' . $job; require($job_script); } - if (!defined('CRONJOB_COMPLETED') || !CRONJOB_COMPLETED) { + if (!$cronjob_completed) { return; }