From aa0ec15e6743343a55688d6776a0397d2c9f8e94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 10 Mar 2024 19:27:29 +0100 Subject: [PATCH] Allow to override the root user CLI check with COMPOSER_ALLOW_SUPERUSER --- src/EventListener/ConsoleEnsureWebserverUserListener.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/EventListener/ConsoleEnsureWebserverUserListener.php b/src/EventListener/ConsoleEnsureWebserverUserListener.php index dbd164c4..7c119304 100644 --- a/src/EventListener/ConsoleEnsureWebserverUserListener.php +++ b/src/EventListener/ConsoleEnsureWebserverUserListener.php @@ -55,6 +55,11 @@ class ConsoleEnsureWebserverUserListener //Check if we are trying to run as root if ($this->isRunningAsRoot()) { + //If the COMPOSER_ALLOW_SUPERUSER environment variable is set, we allow running as root + if ($_SERVER['COMPOSER_ALLOW_SUPERUSER'] ?? false) { + return; + } + $io->warning('You are running this command as root. This is not recommended, as it can cause permission problems. Please run this command as the webserver user "'. ($webserver_user ?? '??') . '" instead.'); $io->info('You might have already caused permission problems by running this command as wrong user. If you encounter issues with Part-DB, delete the var/cache directory completely and let it be recreated by Part-DB.'); if ($input->isInteractive() && !$io->confirm('Do you want to continue?', false)) {