move is_fpm_mode() to global functions

This commit is contained in:
xiaomlove
2025-11-02 23:08:03 +07:00
parent b4d3618560
commit 941b04174e
4 changed files with 7 additions and 7 deletions

View File

@@ -40,7 +40,7 @@ class class_cache_redis {
if (isset($config['timeout']) && is_numeric($config['timeout'])) {
$params[] = $config['timeout'];
}
if (nexus()->isFpmMode()) {
if (is_fpm_mode()) {
try {
$connectResult = $redis->pconnect(...$params);
} catch (\Exception $e) {

View File

@@ -6,7 +6,7 @@ require_once $rootpath . 'vendor/autoload.php';
$USERUPDATESET = array();
$query_name=array();
\Nexus\Nexus::boot();
if (nexus()->isFpmMode()) {
if (is_fpm_mode()) {
if (!file_exists($rootpath . '.env')
|| (getenv('RUNNING_IN_DOCKER') && !file_exists($rootpath . \Nexus\Install\Install::INSTALL_LOCK_FILE))
) {

View File

@@ -1671,3 +1671,8 @@ JS;
\Nexus\Nexus::js("js/crypto-js.js", 'footer', true);
\Nexus\Nexus::js($js, 'footer', false);
}
function is_fpm_mode(): bool
{
return php_sapi_name() === 'fpm-fcgi';
}

View File

@@ -176,11 +176,6 @@ 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'] ?? []);