From 2971501f63eb2da0eecff07b4dc27995af8227ac Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 30 Sep 2017 17:12:27 +0000 Subject: [PATCH] The direct structure call is now only executed when called via the poller.php --- boot.php | 4 ++-- include/poller.php | 5 ++++- index.php | 2 +- util/db_update.php | 3 +-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/boot.php b/boot.php index 8e80bd4124..db5903829d 100644 --- a/boot.php +++ b/boot.php @@ -591,7 +591,7 @@ function is_ajax() { return (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'); } -function check_db() { +function check_db($via_worker) { $build = get_config('system', 'build'); if (!x($build)) { @@ -600,7 +600,7 @@ function check_db() { } if ($build != DB_UPDATE_VERSION) { // When we cannot execute the database update via the worker, we will do it directly - if (!proc_run(PRIORITY_CRITICAL, 'include/dbupdate.php')) { + if (!proc_run(PRIORITY_CRITICAL, 'include/dbupdate.php') && $via_worker) { update_db(get_app()); } } diff --git a/include/poller.php b/include/poller.php index 312347d71a..d07107e072 100644 --- a/include/poller.php +++ b/include/poller.php @@ -889,7 +889,10 @@ function poller_run_cron() { poller_kill_stale_workers(); } -if (array_search(__file__,get_included_files())===0){ +if (array_search(__file__,get_included_files())===0) { + // Check the database structure and possibly fixes it + check_db(true); + poller_run($_SERVER["argv"],$_SERVER["argc"]); poller_unclaim_process(); diff --git a/index.php b/index.php index d3d2e42ae6..49a3b216da 100644 --- a/index.php +++ b/index.php @@ -196,7 +196,7 @@ if ($install && $a->module!="view") { $a->module = 'maintenance'; } else { check_url($a); - check_db(); + check_db(false); check_plugins($a); } diff --git a/util/db_update.php b/util/db_update.php index 1e717e9875..5b31080506 100644 --- a/util/db_update.php +++ b/util/db_update.php @@ -29,7 +29,6 @@ echo "New DB VERSION: " . DB_UPDATE_VERSION . "\n"; if ($build != DB_UPDATE_VERSION) { echo "Updating database..."; - check_db($a); + update_db($a); echo "Done\n"; } - -- 2.39.5