mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 12:07:23 +08:00
improve check install status when running in docker
This commit is contained in:
@@ -40,7 +40,7 @@ class class_cache_redis {
|
|||||||
if (isset($config['timeout']) && is_numeric($config['timeout'])) {
|
if (isset($config['timeout']) && is_numeric($config['timeout'])) {
|
||||||
$params[] = $config['timeout'];
|
$params[] = $config['timeout'];
|
||||||
}
|
}
|
||||||
if ($this->isFpmMode()) {
|
if (nexus()->isFpmMode()) {
|
||||||
try {
|
try {
|
||||||
$connectResult = $redis->pconnect(...$params);
|
$connectResult = $redis->pconnect(...$params);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@@ -68,11 +68,6 @@ class class_cache_redis {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function isFpmMode(): bool
|
|
||||||
{
|
|
||||||
return php_sapi_name() === 'fpm-fcgi';
|
|
||||||
}
|
|
||||||
|
|
||||||
function getIsEnabled() {
|
function getIsEnabled() {
|
||||||
return $this->isEnabled;
|
return $this->isEnabled;
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-5
@@ -6,11 +6,15 @@ require_once $rootpath . 'vendor/autoload.php';
|
|||||||
$USERUPDATESET = array();
|
$USERUPDATESET = array();
|
||||||
$query_name=array();
|
$query_name=array();
|
||||||
\Nexus\Nexus::boot();
|
\Nexus\Nexus::boot();
|
||||||
if (!file_exists($rootpath . '.env')) {
|
if (nexus()->isFpmMode()) {
|
||||||
$installScriptRelativePath = 'install/install.php';
|
if (!file_exists($rootpath . '.env')
|
||||||
$installScriptFile = $rootpath . "public/$installScriptRelativePath";
|
|| (getenv('RUNNING_IN_DOCKER') && !file_exists($rootpath . \Nexus\Install\Install::INSTALL_LOCK_FILE))
|
||||||
if (file_exists($installScriptFile)) {
|
) {
|
||||||
nexus_redirect($installScriptRelativePath);
|
$installScriptRelativePath = 'install/install.php';
|
||||||
|
$installScriptFile = $rootpath . "public/$installScriptRelativePath";
|
||||||
|
if (file_exists($installScriptFile)) {
|
||||||
|
nexus_redirect($installScriptRelativePath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
require $rootpath . 'nexus/Database/helpers.php';
|
require $rootpath . 'nexus/Database/helpers.php';
|
||||||
|
|||||||
@@ -49,7 +49,9 @@ class Install
|
|||||||
'pcntl_signal', 'pcntl_alarm', 'pcntl_async_signals'
|
'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()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -176,6 +176,11 @@ final class Nexus
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isFpmMode(): bool
|
||||||
|
{
|
||||||
|
return php_sapi_name() === 'fpm-fcgi';
|
||||||
|
}
|
||||||
|
|
||||||
private function generateRequestId(): string
|
private function generateRequestId(): string
|
||||||
{
|
{
|
||||||
$prefix = ($_SERVER['SCRIPT_FILENAME'] ?? '') . implode('', $_SERVER['argv'] ?? []);
|
$prefix = ($_SERVER['SCRIPT_FILENAME'] ?? '') . implode('', $_SERVER['argv'] ?? []);
|
||||||
|
|||||||
Reference in New Issue
Block a user