update include update env file

This commit is contained in:
xiaomlove
2024-12-30 01:35:05 +08:00
parent 3cf7b36ad6
commit 0f88ab8d82
8 changed files with 38 additions and 165 deletions
+5 -2
View File
@@ -13,7 +13,7 @@ class Install
{
protected $currentStep;
protected $minimumPhpVersion = '8.0.3';
protected $minimumPhpVersion = '8.2.0';
protected $progressKeyPrefix = '__step';
@@ -32,7 +32,10 @@ class Install
'UID_STARTS',
];
protected array $requiredExtensions = ['ctype', 'curl', 'fileinfo', 'json', 'mbstring', 'openssl', 'pdo_mysql', 'tokenizer', 'xml', 'mysqli', 'bcmath', 'redis', 'gd', 'gmp', 'Zend OPcache', 'pcntl', 'posix', 'sockets'];
protected array $requiredExtensions = [
'ctype', 'curl', 'fileinfo', 'json', 'mbstring', 'openssl', 'pdo_mysql', 'tokenizer', 'xml',
'mysqli', 'bcmath', 'redis', 'gd', 'gmp', 'Zend OPcache', 'pcntl', 'posix', 'sockets', 'zip', 'intl'
];
protected array $optionalExtensions = [
// ['name' => 'swoole', 'desc' => "If use swoole for Octane, make sure 'current' shows 1"],
];
+23
View File
@@ -536,6 +536,29 @@ class Update extends Install
return false;
}
public function updateEnvFile()
{
$envFile = ROOT_PATH . '.env';
$envExample = ROOT_PATH . '.env.example';
$envData = readEnvFile($envFile);
$envExampleData = readEnvFile($envExample);
foreach ($envExampleData as $key => $value) {
if (!isset($envData[$key])) {
$envData[$key] = $value;
}
}
$fp = @fopen($envFile, 'w');
if ($fp === false) {
throw new \RuntimeException("can't create env file, make sure php has permission to create file at: " . ROOT_PATH);
}
$content = "";
foreach ($envData as $key => $value) {
$content .= "{$key}={$value}\n";
}
fwrite($fp, $content);
fclose($fp);
}
+1 -1
View File
@@ -157,7 +157,7 @@ if ($currentStep == 4) {
$tableRows = $settingTableRows['table_rows'];
$pass = $settingTableRows['pass'];
$mysqlInfo = $update->getMysqlVersionInfo();
$redisInfo = $update->getREdisVersionInfo();
$redisInfo = $update->getRedisVersionInfo();
while ($isPost) {
set_time_limit(300);
try {