mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 19:51:09 -04:00
restrict update if the system requirements do not match
This commit is contained in:
@ -47,6 +47,13 @@ class UpdateCommand extends Command
|
||||
$this->installed = $this->getInstalledVersion();
|
||||
$this->version = $this->getLatestVersion();
|
||||
|
||||
if ($this->version == 'extension_required') {
|
||||
$this->info('Sorry! Your system does not meet the minimum requirements for this update.');
|
||||
$this->info('Please retry after installing the required version/extensions.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$this->version) {
|
||||
$this->info('No Update Available! You are already on the latest version.');
|
||||
return;
|
||||
@ -93,6 +100,24 @@ class UpdateCommand extends Command
|
||||
try {
|
||||
$response = Updater::checkForUpdate($this->installed);
|
||||
|
||||
$extensions = $response->version->extensions;
|
||||
|
||||
$is_required = false;
|
||||
|
||||
foreach ($extensions as $key => $extension) {
|
||||
|
||||
if(!$extension) {
|
||||
$is_required = true;
|
||||
$this->info('❌ '.$key);
|
||||
}
|
||||
|
||||
$this->info('✅ '.$key);
|
||||
}
|
||||
|
||||
if($is_required) {
|
||||
return 'extension_required';
|
||||
}
|
||||
|
||||
if ($response->success) {
|
||||
return $response->version->version;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user