mirror of
https://github.com/getgrav/grav.git
synced 2026-07-09 12:42:53 +02:00
@@ -404,7 +404,7 @@ class SelfupgradeCommand extends GpmCommand
|
||||
$isMajorMinorUpgrade = $preflight['is_major_minor_upgrade'] ?? false;
|
||||
|
||||
// Fall back to calculating it if not provided (for backwards compatibility)
|
||||
if (!isset($preflight['is_major_minor_upgrade'])) {
|
||||
if (!isset($preflight['is_major_minor_upgrade']) && $this->upgrader) {
|
||||
$local = $this->upgrader->getLocalVersion();
|
||||
$remote = $this->upgrader->getRemoteVersion();
|
||||
$localParts = explode('.', $local);
|
||||
@@ -418,8 +418,8 @@ class SelfupgradeCommand extends GpmCommand
|
||||
$isMajorMinorUpgrade = ($localMajor !== $remoteMajor) || ($localMinor !== $remoteMinor);
|
||||
}
|
||||
|
||||
$local = $this->upgrader->getLocalVersion();
|
||||
$remote = $this->upgrader->getRemoteVersion();
|
||||
$local = $this->upgrader ? $this->upgrader->getLocalVersion() : 'unknown';
|
||||
$remote = $this->upgrader ? $this->upgrader->getRemoteVersion() : 'unknown';
|
||||
|
||||
$io->newLine();
|
||||
$io->writeln('<yellow>The following packages need updating before Grav upgrade:</yellow>');
|
||||
|
||||
@@ -106,7 +106,7 @@ class StubSafeUpgradeService extends SafeUpgradeService
|
||||
parent::__construct([]);
|
||||
}
|
||||
|
||||
public function preflight(): array
|
||||
public function preflight(?string $targetVersion = null): array
|
||||
{
|
||||
return $this->report;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,8 @@ class SelfupgradeCommandTest extends \PHPUnit\Framework\TestCase
|
||||
$result = $command->runHandle([
|
||||
'plugins_pending' => [],
|
||||
'psr_log_conflicts' => [],
|
||||
'warnings' => []
|
||||
'warnings' => [],
|
||||
'is_major_minor_upgrade' => false
|
||||
]);
|
||||
|
||||
self::assertTrue($result);
|
||||
@@ -34,7 +35,8 @@ class SelfupgradeCommandTest extends \PHPUnit\Framework\TestCase
|
||||
$result = $command->runHandle([
|
||||
'plugins_pending' => ['foo' => ['type' => 'plugin', 'current' => '1', 'available' => '2']],
|
||||
'psr_log_conflicts' => ['bar' => ['requires' => '^1.0']],
|
||||
'warnings' => ['pending']
|
||||
'warnings' => ['pending'],
|
||||
'is_major_minor_upgrade' => true
|
||||
]);
|
||||
|
||||
self::assertFalse($result);
|
||||
@@ -51,7 +53,8 @@ class SelfupgradeCommandTest extends \PHPUnit\Framework\TestCase
|
||||
$result = $command->runHandle([
|
||||
'plugins_pending' => ['foo' => ['type' => 'plugin', 'current' => '1', 'available' => '2']],
|
||||
'psr_log_conflicts' => [],
|
||||
'warnings' => []
|
||||
'warnings' => [],
|
||||
'is_major_minor_upgrade' => true
|
||||
]);
|
||||
|
||||
self::assertFalse($result);
|
||||
@@ -67,7 +70,8 @@ class SelfupgradeCommandTest extends \PHPUnit\Framework\TestCase
|
||||
$result = $command->runHandle([
|
||||
'plugins_pending' => [],
|
||||
'psr_log_conflicts' => ['foo' => ['requires' => '^1.0']],
|
||||
'warnings' => []
|
||||
'warnings' => [],
|
||||
'is_major_minor_upgrade' => false
|
||||
]);
|
||||
|
||||
self::assertFalse($result);
|
||||
@@ -93,7 +97,8 @@ class SelfupgradeCommandTest extends \PHPUnit\Framework\TestCase
|
||||
$result = $command->runHandle([
|
||||
'plugins_pending' => [],
|
||||
'psr_log_conflicts' => ['foo' => ['requires' => '^1.0']],
|
||||
'warnings' => []
|
||||
'warnings' => [],
|
||||
'is_major_minor_upgrade' => false
|
||||
]);
|
||||
|
||||
self::assertTrue($result);
|
||||
@@ -110,7 +115,8 @@ class SelfupgradeCommandTest extends \PHPUnit\Framework\TestCase
|
||||
$result = $command->runHandle([
|
||||
'plugins_pending' => [],
|
||||
'psr_log_conflicts' => ['foo' => ['requires' => '^1.0']],
|
||||
'warnings' => []
|
||||
'warnings' => [],
|
||||
'is_major_minor_upgrade' => false
|
||||
]);
|
||||
|
||||
self::assertTrue($result);
|
||||
|
||||
Reference in New Issue
Block a user