diff --git a/classes/class_cache_redis.php b/classes/class_cache_redis.php index 7bdad02e..c730d44b 100644 --- a/classes/class_cache_redis.php +++ b/classes/class_cache_redis.php @@ -40,7 +40,7 @@ class class_cache_redis { if (isset($config['timeout']) && is_numeric($config['timeout'])) { $params[] = $config['timeout']; } - if ($this->isFpmMode()) { + if (nexus()->isFpmMode()) { try { $connectResult = $redis->pconnect(...$params); } catch (\Exception $e) { @@ -68,11 +68,6 @@ class class_cache_redis { return true; } - private function isFpmMode(): bool - { - return php_sapi_name() === 'fpm-fcgi'; - } - function getIsEnabled() { return $this->isEnabled; } diff --git a/include/core.php b/include/core.php index e73519d1..ff137ba9 100644 --- a/include/core.php +++ b/include/core.php @@ -6,11 +6,15 @@ require_once $rootpath . 'vendor/autoload.php'; $USERUPDATESET = array(); $query_name=array(); \Nexus\Nexus::boot(); -if (!file_exists($rootpath . '.env')) { - $installScriptRelativePath = 'install/install.php'; - $installScriptFile = $rootpath . "public/$installScriptRelativePath"; - if (file_exists($installScriptFile)) { - nexus_redirect($installScriptRelativePath); +if (nexus()->isFpmMode()) { + if (!file_exists($rootpath . '.env') + || (getenv('RUNNING_IN_DOCKER') && !file_exists($rootpath . \Nexus\Install\Install::INSTALL_LOCK_FILE)) + ) { + $installScriptRelativePath = 'install/install.php'; + $installScriptFile = $rootpath . "public/$installScriptRelativePath"; + if (file_exists($installScriptFile)) { + nexus_redirect($installScriptRelativePath); + } } } require $rootpath . 'nexus/Database/helpers.php'; diff --git a/nexus/Install/Install.php b/nexus/Install/Install.php index 3e752dcd..2a930ec7 100644 --- a/nexus/Install/Install.php +++ b/nexus/Install/Install.php @@ -49,7 +49,9 @@ class Install 'pcntl_signal', 'pcntl_alarm', 'pcntl_async_signals' ]; - protected string $lockFile = 'install.lock'; + const INSTALL_LOCK_FILE = 'dont_delete_install.lock'; + + protected string $lockFile = self::INSTALL_LOCK_FILE; public function __construct() { diff --git a/nexus/Nexus.php b/nexus/Nexus.php index 281b5892..4a01ce41 100644 --- a/nexus/Nexus.php +++ b/nexus/Nexus.php @@ -176,6 +176,11 @@ final class Nexus return false; } + public function isFpmMode(): bool + { + return php_sapi_name() === 'fpm-fcgi'; + } + private function generateRequestId(): string { $prefix = ($_SERVER['SCRIPT_FILENAME'] ?? '') . implode('', $_SERVER['argv'] ?? []);