From 8479522970b11195d8f238f9a6bdb31a6edb5696 Mon Sep 17 00:00:00 2001 From: wuyanwen Date: Sat, 14 Dec 2019 15:03:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=89=E8=A3=85=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/catcher/command/InstallCommand.php | 40 ++++++++++++----------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/extend/catcher/command/InstallCommand.php b/extend/catcher/command/InstallCommand.php index cd5fb59..78e2c0e 100644 --- a/extend/catcher/command/InstallCommand.php +++ b/extend/catcher/command/InstallCommand.php @@ -17,7 +17,7 @@ class InstallCommand extends Command protected function configure() { - $this->setName('install:project') + $this->setName('catch:install') // ->addArgument('module', Argument::REQUIRED, 'module name') ->setDescription('install project'); } @@ -143,27 +143,29 @@ class InstallCommand extends Command */ protected function secondStep(): void { - $connections = \config('database.connections'); + if (file_exists(root_path() . '.env')) { + $connections = \config('database.connections'); - [ - $connections['mysql']['hostname'], - $connections['mysql']['database'], - $connections['mysql']['username'], - $connections['mysql']['password'], - $connections['mysql']['hostport'], - $connections['mysql']['charset'], - $connections['mysql']['prefix'], - ] = $this->databaseLink; + [ + $connections['mysql']['hostname'], + $connections['mysql']['database'], + $connections['mysql']['username'], + $connections['mysql']['password'], + $connections['mysql']['hostport'], + $connections['mysql']['charset'], + $connections['mysql']['prefix'], + ] = $this->databaseLink; - \config([ - 'connections' => $connections, - ],'database'); + \config([ + 'connections' => $connections, + ], 'database'); - foreach (CatchAdmin::getModulesDirectory() as $directory) { - $moduleInfo = CatchAdmin::getModuleInfo($directory); - if (is_dir(CatchAdmin::moduleMigrationsDirectory($moduleInfo['alias']))) { - $output = Console::call('catch-migrate:run', [$moduleInfo['alias']]); - $this->output->info(sprintf('module [%s] migrations %s', $moduleInfo['alias'], $output->fetch())); + foreach (CatchAdmin::getModulesDirectory() as $directory) { + $moduleInfo = CatchAdmin::getModuleInfo($directory); + if (is_dir(CatchAdmin::moduleMigrationsDirectory($moduleInfo['alias']))) { + $output = Console::call('catch-migrate:run', [$moduleInfo['alias']]); + $this->output->info(sprintf('module [%s] migrations %s', $moduleInfo['alias'], $output->fetch())); + } } } }