From 6324cca5028ce403eeb08a1ef53ab337b868795a Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Mon, 13 Apr 2026 16:55:12 +0100 Subject: [PATCH] Recognize '2.0' in compatibility inference and CLI badges MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extends the 1.7/1.8 compatibility machinery to treat a grav >= 2.0 dependency as ['2.0']. SelfupgradeCommand's preflight already keys off the target package's major.minor, so upgrading 1.8 → 2.0 now correctly flags plugins that only declare 1.7 or 1.8 as blocking. - GPM/Local/Package::inferCompatibility(): grav >= 2.0 → ['2.0'] - Installer/Install::inferCompatibleVersions(): grav >= 2.0 → ['2.0'] - IndexCommand / InfoCommand / UpdateCommand: magenta '2.0' badge Ships as part of the final 1.8 beta so the installed base has a clean upgrade gate when users run `bin/gpm selfupgrade` against a Grav 2.0 release. The actual migration wizard is a 2.0-only deliverable and is NOT backported here. --- system/src/Grav/Common/GPM/Local/Package.php | 4 ++++ system/src/Grav/Console/Gpm/IndexCommand.php | 3 +++ system/src/Grav/Console/Gpm/InfoCommand.php | 3 +++ system/src/Grav/Console/Gpm/UpdateCommand.php | 3 +++ system/src/Grav/Installer/Install.php | 4 ++++ 5 files changed, 17 insertions(+) diff --git a/system/src/Grav/Common/GPM/Local/Package.php b/system/src/Grav/Common/GPM/Local/Package.php index 594db0997..4f1958daa 100644 --- a/system/src/Grav/Common/GPM/Local/Package.php +++ b/system/src/Grav/Common/GPM/Local/Package.php @@ -91,6 +91,10 @@ class Package extends BasePackage continue; } + if (version_compare($m[1], '2.0', '>=')) { + return ['grav' => ['2.0'], 'api' => []]; + } + if (version_compare($m[1], '1.8', '>=')) { return ['grav' => ['1.8'], 'api' => []]; } diff --git a/system/src/Grav/Console/Gpm/IndexCommand.php b/system/src/Grav/Console/Gpm/IndexCommand.php index 5669271d6..2ba19f255 100644 --- a/system/src/Grav/Console/Gpm/IndexCommand.php +++ b/system/src/Grav/Console/Gpm/IndexCommand.php @@ -260,6 +260,9 @@ class IndexCommand extends GpmCommand if (in_array('1.8', $compat['grav'], true)) { $badges[] = '1.8'; } + if (in_array('2.0', $compat['grav'], true)) { + $badges[] = '2.0'; + } return implode(' ', $badges); } diff --git a/system/src/Grav/Console/Gpm/InfoCommand.php b/system/src/Grav/Console/Gpm/InfoCommand.php index 56d2a017e..2fa48e82e 100644 --- a/system/src/Grav/Console/Gpm/InfoCommand.php +++ b/system/src/Grav/Console/Gpm/InfoCommand.php @@ -150,6 +150,9 @@ class InfoCommand extends GpmCommand if (in_array('1.8', $compat['grav'], true)) { $badges[] = '1.8'; } + if (in_array('2.0', $compat['grav'], true)) { + $badges[] = '2.0'; + } $compatStr = implode(' ', $badges); } else { $compatStr = '1.7'; diff --git a/system/src/Grav/Console/Gpm/UpdateCommand.php b/system/src/Grav/Console/Gpm/UpdateCommand.php index 15ea1c196..11e9bdd14 100644 --- a/system/src/Grav/Console/Gpm/UpdateCommand.php +++ b/system/src/Grav/Console/Gpm/UpdateCommand.php @@ -222,6 +222,9 @@ class UpdateCommand extends GpmCommand if (in_array('1.8', $compat['grav'], true)) { $badges[] = '1.8'; } + if (in_array('2.0', $compat['grav'], true)) { + $badges[] = '2.0'; + } $compatStr = ' ' . implode(' ', $badges); } diff --git a/system/src/Grav/Installer/Install.php b/system/src/Grav/Installer/Install.php index 858c6153d..6d8d1e445 100644 --- a/system/src/Grav/Installer/Install.php +++ b/system/src/Grav/Installer/Install.php @@ -1448,6 +1448,10 @@ ERR; continue; } + if (version_compare($m[1], '2.0', '>=')) { + return ['grav' => ['2.0'], 'api' => []]; + } + if (version_compare($m[1], '1.8', '>=')) { return ['grav' => ['1.8'], 'api' => []]; }