mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-28 04:01:10 -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->installed = $this->getInstalledVersion();
|
||||||
$this->version = $this->getLatestVersion();
|
$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) {
|
if (!$this->version) {
|
||||||
$this->info('No Update Available! You are already on the latest version.');
|
$this->info('No Update Available! You are already on the latest version.');
|
||||||
return;
|
return;
|
||||||
@ -93,6 +100,24 @@ class UpdateCommand extends Command
|
|||||||
try {
|
try {
|
||||||
$response = Updater::checkForUpdate($this->installed);
|
$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) {
|
if ($response->success) {
|
||||||
return $response->version->version;
|
return $response->version->version;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user