From ea99e895437e544c5851cfaa8308b3948825ff1a Mon Sep 17 00:00:00 2001 From: TylerMS887 <115214762+TylerMS887@users.noreply.github.com> Date: Mon, 10 Jul 2023 19:11:02 +0100 Subject: [PATCH] Update update.php --- maintenance/update.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/maintenance/update.php b/maintenance/update.php index cd47b32..a01e037 100644 --- a/maintenance/update.php +++ b/maintenance/update.php @@ -5,15 +5,23 @@ echo "BUGKILLER MAINTENANCE\n\nPlease run maintenance scripts from your server's command-line shell.\nContact your administrator if you do not have access."; exit; } -if (PHP_SAPI != 'cli') { +if (PHP_SAPI != 'cli' and PHP_SAPI != 'cli-server') { $runtype = PHP_SAPI; echo "Run this script via the command-line shell. If you do not have access to your server's shell contact your server administrator. Detected PHP_SAPI: $runtype\n"; exit; } +if (posix_getuid() !== 0 and PHP_SAPI == 'cli-server') { + echo "Please run the PHP server as root.\n"; + exit; +} if (posix_getuid() !== 0) { echo "Please run this script as root.\n"; exit; } +if (PHP_SAPI == 'cli-server') { + require "../updateFromCliServer.php"; + exit; +} echo "Bugkiller Server Updater\n"; echo "Attempting to update packages...\n"; chdir(dirname(__DIR__));