Clean up update

This commit is contained in:
David Bomba 2021-04-30 14:29:27 +10:00
parent dab7f5afba
commit 2eae22221f
3 changed files with 17 additions and 28 deletions

View File

@ -42,12 +42,12 @@ class PostUpdate extends Command
{ {
set_time_limit(0); set_time_limit(0);
nlog('running post update'); info('running post update');
try { try {
Artisan::call('migrate', ['--force' => true]); Artisan::call('migrate', ['--force' => true]);
} catch (\Exception $e) { } catch (\Exception $e) {
nlog("I wasn't able to migrate the data."); info("I wasn't able to migrate the data.");
} }
nlog("finished migrating"); nlog("finished migrating");
@ -57,34 +57,27 @@ class PostUpdate extends Command
exec('vendor/bin/composer install --no-dev -o', $output); exec('vendor/bin/composer install --no-dev -o', $output);
info(print_r($output,1)); info(print_r($output,1));
info("finished running composer install ");
nlog($output);
nlog("finished running composer install ");
try { try {
Artisan::call('optimize'); Artisan::call('optimize');
} catch (\Exception $e) { } catch (\Exception $e) {
nlog("I wasn't able to optimize."); info("I wasn't able to optimize.");
} }
nlog("optimized"); info("optimized");
try { try {
Artisan::call('view:clear'); Artisan::call('view:clear');
} catch (\Exception $e) { } catch (\Exception $e) {
nlog("I wasn't able to clear the views."); info("I wasn't able to clear the views.");
} }
nlog("view cleared"); info("view cleared");
/* For the following to work, the web user (www-data) must own all the directories */
VersionCheck::dispatch(); VersionCheck::dispatch();
nlog("sent for version check"); info("Sent for version check");
// echo "Done.";
} }
} }

View File

@ -64,9 +64,6 @@ class SelfUpdateController extends BaseController
$this->testWritable(); $this->testWritable();
// Check if new version is available
//if($updater->source()->isNewVersionAvailable()) {
// Get the new version available // Get the new version available
$versionAvailable = $updater->source()->getVersionAvailable(); $versionAvailable = $updater->source()->getVersionAvailable();
@ -75,7 +72,6 @@ class SelfUpdateController extends BaseController
$updater->source()->update($release); $updater->source()->update($release);
//}
$cacheCompiled = base_path('bootstrap/cache/compiled.php'); $cacheCompiled = base_path('bootstrap/cache/compiled.php');
if (file_exists($cacheCompiled)) { unlink ($cacheCompiled); } if (file_exists($cacheCompiled)) { unlink ($cacheCompiled); }
@ -105,6 +101,7 @@ class SelfUpdateController extends BaseController
if ($file->isFile() && ! $file->isWritable()) { if ($file->isFile() && ! $file->isWritable()) {
// throw new FilePermissionsFailure($file); // throw new FilePermissionsFailure($file);
nlog("Cannot update system because {$file->getFileName()} is not writable");
throw new FilePermissionsFailure("Cannot update system because {$file->getFileName()} is not writable"); throw new FilePermissionsFailure("Cannot update system because {$file->getFileName()} is not writable");
return false; return false;
} }

View File

@ -284,18 +284,17 @@ class SetupController extends Controller
if (file_exists($cacheCompiled)) { if (file_exists($cacheCompiled)) {
unlink ($cacheCompiled); unlink ($cacheCompiled);
} }
$cacheServices = base_path('bootstrap/cache/services.php'); $cacheServices = base_path('bootstrap/cache/services.php');
if (file_exists($cacheServices)) { if (file_exists($cacheServices)) {
unlink ($cacheServices); unlink ($cacheServices);
} }
Artisan::call('clear-compiled'); Artisan::call('clear-compiled');
Artisan::call('cache:clear');
Artisan::call('debugbar:clear');
Artisan::call('route:clear'); Artisan::call('route:clear');
Artisan::call('view:clear'); Artisan::call('view:clear');
Artisan::call('config:clear'); Artisan::call('config:clear');
Cache::flush();
Artisan::call('migrate', ['--force' => true]); Artisan::call('migrate', ['--force' => true]);
Artisan::call('db:seed', ['--force' => true]); Artisan::call('db:seed', ['--force' => true]);