Update Installer.php

This commit is contained in:
Shlee 2022-06-16 11:02:47 +09:30 committed by GitHub
parent 56ebd8c06c
commit 83bb370ec9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 3 deletions

View File

@ -81,6 +81,7 @@ class Installer extends Command
$this->mediaSettings();
$this->dbMigrations();
$this->resetArtisanCache();
$this->validateEnv();
} else {
$this->info('Installer: Simple...');
$this->checkDiskPermissions();
@ -92,6 +93,7 @@ class Installer extends Command
$this->instanceSettings();
$this->dbMigrations();
$this->resetArtisanCache();
$this->validateEnv();
}
}
@ -394,15 +396,33 @@ class Installer extends Command
protected function resetArtisanCache()
{
$this->call('config:cache');
$this->call('route:cache');
$this->call('view:cache');
$this->call('config:cache');
$this->call('route:cache');
$this->call('view:cache');
}
protected function validateEnv()
{
$this->checkEnvKeys('APP_KEY', "key:generate failed?");
$this->checkEnvKeys('APP_ENV', "APP_ENV value should be production");
$this->checkEnvKeys('APP_DEBUG', "APP_DEBUG value should be false");
}
#####
# Installer Functions
#####
protected function checkEnvKeys($key, $error)
{
$envPath = app()->environmentFilePath();
$payload = file_get_contents($envPath);
if ($existing = $this->existingEnv($key, $payload)) {
} else {
$this->info("$key empty - $error");
}
}
protected function updateEnvFile($key, $value)
{
$envPath = app()->environmentFilePath();