refactor(proxy): simplify getNewerBranchInfo method parameters and streamline version checks
This commit is contained in:
parent
29bf4d29f0
commit
f8dd44410a
1 changed files with 3 additions and 4 deletions
|
|
@ -63,14 +63,13 @@ public function handle(): void
|
||||||
}
|
}
|
||||||
|
|
||||||
$currentBranch = $matches[1]; // e.g., "3.6"
|
$currentBranch = $matches[1]; // e.g., "3.6"
|
||||||
$currentPatch = $matches[2]; // e.g., "0"
|
|
||||||
|
|
||||||
// Find the latest version for this branch
|
// Find the latest version for this branch
|
||||||
$latestForBranch = $this->traefikVersions["v{$currentBranch}"] ?? null;
|
$latestForBranch = $this->traefikVersions["v{$currentBranch}"] ?? null;
|
||||||
|
|
||||||
if (! $latestForBranch) {
|
if (! $latestForBranch) {
|
||||||
// User is on a branch we don't track - check if newer branches exist
|
// User is on a branch we don't track - check if newer branches exist
|
||||||
$newerBranchInfo = $this->getNewerBranchInfo($current, $currentBranch);
|
$newerBranchInfo = $this->getNewerBranchInfo($currentBranch);
|
||||||
|
|
||||||
if ($newerBranchInfo) {
|
if ($newerBranchInfo) {
|
||||||
$this->storeOutdatedInfo($current, $newerBranchInfo['latest'], 'minor_upgrade', $newerBranchInfo['target']);
|
$this->storeOutdatedInfo($current, $newerBranchInfo['latest'], 'minor_upgrade', $newerBranchInfo['target']);
|
||||||
|
|
@ -86,7 +85,7 @@ public function handle(): void
|
||||||
$latest = ltrim($latestForBranch, 'v');
|
$latest = ltrim($latestForBranch, 'v');
|
||||||
|
|
||||||
// Always check for newer branches first
|
// Always check for newer branches first
|
||||||
$newerBranchInfo = $this->getNewerBranchInfo($current, $currentBranch);
|
$newerBranchInfo = $this->getNewerBranchInfo($currentBranch);
|
||||||
|
|
||||||
if (version_compare($current, $latest, '<')) {
|
if (version_compare($current, $latest, '<')) {
|
||||||
// Patch update available
|
// Patch update available
|
||||||
|
|
@ -103,7 +102,7 @@ public function handle(): void
|
||||||
/**
|
/**
|
||||||
* Get information about newer branches if available.
|
* Get information about newer branches if available.
|
||||||
*/
|
*/
|
||||||
private function getNewerBranchInfo(string $current, string $currentBranch): ?array
|
private function getNewerBranchInfo(string $currentBranch): ?array
|
||||||
{
|
{
|
||||||
$newestBranch = null;
|
$newestBranch = null;
|
||||||
$newestVersion = null;
|
$newestVersion = null;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue