Maintenance. */ require __DIR__ . '/app/bootstrap.php'; if (!hash_equals(archive_worker_key(), (string)($_GET['key'] ?? ''))) { http_response_code(404); exit; } // The dispatcher hung up after a fraction of a second. Without this, PHP would // kill this process the moment it noticed the disconnect. ignore_user_abort(true); @set_time_limit(0); // Nothing is ever read from the response — the caller is not listening. http_response_code(204); if (function_exists('fastcgi_finish_request')) { @fastcgi_finish_request(); } // One backup at a time. The client refuses concurrent runs itself, but with an // exception in the log; taking the lock here keeps that noise out and lets an // overlapping worker leave quietly. $lock = fopen(DATA_DIR . '/manage.lock', 'c'); if ($lock === false || !flock($lock, LOCK_EX | LOCK_NB)) { exit; } $done = manage_run_due(); flock($lock, LOCK_UN); fclose($lock); if ($done !== []) { manageClientLog('INFO', 'Scheduled run finished', ['jobs' => $done]); }