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

View File

@ -64,18 +64,14 @@ class SelfUpdateController extends BaseController
$this->testWritable();
// Check if new version is available
//if($updater->source()->isNewVersionAvailable()) {
// Get the new version available
$versionAvailable = $updater->source()->getVersionAvailable();
// Get the new version available
$versionAvailable = $updater->source()->getVersionAvailable();
// Create a release
$release = $updater->source()->fetch($versionAvailable);
// Create a release
$release = $updater->source()->fetch($versionAvailable);
$updater->source()->update($release);
$updater->source()->update($release);
//}
$cacheCompiled = base_path('bootstrap/cache/compiled.php');
if (file_exists($cacheCompiled)) { unlink ($cacheCompiled); }
@ -105,6 +101,7 @@ class SelfUpdateController extends BaseController
if ($file->isFile() && ! $file->isWritable()) {
// 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");
return false;
}

View File

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