Try to clear caches before updating (#522)

* Try to clear caches before updating

* Add clear-compiled to maintenance cache list

* Formatting
This commit is contained in:
Nabeel S
2020-01-30 14:59:48 -05:00
committed by GitHub
parent 3c1b433c29
commit 51b50972c8
4 changed files with 39 additions and 0 deletions

View File

@@ -3,6 +3,7 @@
namespace App\Services\Installer;
use App\Contracts\Service;
use Illuminate\Support\Facades\Artisan;
use Nwidart\Modules\Facades\Module;
class InstallerService extends Service
@@ -38,6 +39,23 @@ class InstallerService extends Service
return false;
}
/**
* Clear whatever caches we can by calling Artisan
*/
public function clearCaches(): void
{
$commands = [
'clear-compiled',
'cache:clear',
'route:clear',
'view:clear',
];
foreach ($commands as $cmd) {
Artisan::call($cmd);
}
}
/**
* Disable the installer and importer modules
*/