//Check if we are (not) running as the webserver user
$webserver_user=$this->getWebserverUser();
$running_user=$this->getRunningUser();
//Check if we are trying to run as root
if($this->isRunningAsRoot()){
$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)){
$io->warning('You are running this command as the user "'.$running_user.'". 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)){
$event->disableCommand();
}
return;
}
}
privatefunctionisRunningAsRoot():bool
{
//If we are on windows, we can't run as root
if(PHP_OS_FAMILY==='Windows'){
returnfalse;
}
//Try to use the posix extension if available (Linux)