改进 适配 php8.2

This commit is contained in:
iVampireSP.com 2023-01-08 17:03:01 +08:00
parent a3e2665646
commit 1b48ded856
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132

View File

@ -81,7 +81,7 @@ public function handle(): int
$cache_path = base_path('config'); $cache_path = base_path('config');
// exec // exec
$cmd = "rm -rf ${cache_path}"; $cmd = "rm -rf {$cache_path}";
exec($cmd); exec($cmd);
@ -94,8 +94,8 @@ public function handle(): int
if ($node_type === 'slave') { if ($node_type === 'slave') {
// 下载 .env 文件 // 下载 .env 文件
$this->info('正在下载 .env 文件。'); $this->info('正在下载 .env 文件。');
$env_cache_key = "${node_type}_env"; $env_cache_key = "{$node_type}_env";
$env_md5_key = "${node_type}_env_md5"; $env_md5_key = "{$node_type}_env_md5";
$env = Cluster::get($env_cache_key); $env = Cluster::get($env_cache_key);
$env_md5 = Cluster::get($env_md5_key); $env_md5 = Cluster::get($env_md5_key);
@ -118,7 +118,7 @@ public function handle(): int
$env = file_get_contents(base_path('.env')); $env = file_get_contents(base_path('.env'));
// REPLACE NODE_IP 这一行 // REPLACE NODE_IP 这一行
$env = preg_replace('/^NODE_IP=.*$/m', "NODE_IP=${node_ip}", $env); $env = preg_replace('/^NODE_IP=.*$/m', "NODE_IP={$node_ip}", $env);
file_put_contents(base_path('.env'), $env); file_put_contents(base_path('.env'), $env);