From bff5b94ff0ade98ecd922cd782b8fd7c00c49325 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 16 Dec 2020 07:35:54 +1100 Subject: [PATCH] Better error handling with self updater --- app/Console/Commands/PostUpdate.php | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/app/Console/Commands/PostUpdate.php b/app/Console/Commands/PostUpdate.php index a20f38f8ddd7..b735f41e64f0 100644 --- a/app/Console/Commands/PostUpdate.php +++ b/app/Console/Commands/PostUpdate.php @@ -52,21 +52,29 @@ class PostUpdate extends Command info("I wasn't able to migrate the data."); } + putenv('COMPOSER_HOME=' . __DIR__ . '/vendor/bin/composer'); + + $input = new ArrayInput(['command' => 'install', '--no-dev' => 'true']); + $application = new Application(); + $application->setAutoExit(false); + $application->run($input, $output); + + info(print_r($output->fetch(),1)); + try { Artisan::call('optimize'); } catch (\Exception $e) { info("I wasn't able to optimize."); } + try { + Artisan::call('view:clear'); + } catch (\Exception $e) { + info("I wasn't able to clear the views."); + } + /* For the following to work, the web user (www-data) must own all the directories */ - putenv('COMPOSER_HOME=' . __DIR__ . '/vendor/bin/composer'); - - $input = new ArrayInput(['command' => 'install', '--no-dev' => 'true']); - $application = new Application(); - $application->setAutoExit(false); - $application->run($input); - VersionCheck::dispatch(); echo "Done.";