diff options
author | Dave Miller <justdave@bugzilla.org> | 2023-11-18 03:23:41 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-18 03:23:41 -0500 |
commit | 20124a085dd571607bc517b4affd92ae61e73627 (patch) | |
tree | 020810b05e46daba8005440ce311b19e9c0a1a5d | |
parent | 04f3d70b036a640fa743b70f886157e56baac3ae (diff) | |
download | bugs-20124a085dd571607bc517b4affd92ae61e73627.tar bugs-20124a085dd571607bc517b4affd92ae61e73627.tar.gz bugs-20124a085dd571607bc517b4affd92ae61e73627.tar.bz2 bugs-20124a085dd571607bc517b4affd92ae61e73627.tar.xz bugs-20124a085dd571607bc517b4affd92ae61e73627.zip |
Bug 1786951: Make the update check work on the 5.0.4 branch (#147)
* Bug 1786951: Make the update check work on the 5.0.4 branch
-rw-r--r-- | Bugzilla/Update.pm | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Bugzilla/Update.pm b/Bugzilla/Update.pm index 72a7108a8..c01f45e4c 100644 --- a/Bugzilla/Update.pm +++ b/Bugzilla/Update.pm @@ -56,7 +56,7 @@ sub get_notifications { # On which branch is the current installation running? my @current_version = - (BUGZILLA_VERSION =~ m/^(\d+)\.(\d+)(?:(rc|\.)(\d+))?\+?$/); + (BUGZILLA_VERSION =~ m/^(\d+)\.(\d+)(?:\.(\d+))?(?:(rc|\.)(\d+))?\+?$/); my @release; if (Bugzilla->params->{'upgrade_notification'} eq 'development_snapshot') { @@ -73,7 +73,8 @@ sub get_notifications { elsif (Bugzilla->params->{'upgrade_notification'} eq 'stable_branch_release') { # We want the latest stable version for the current branch. # If we are running a development snapshot, we won't match anything. - my $branch_version = $current_version[0] . '.' . $current_version[1]; + # This is the 5.0.4 branch and it won't branch again so just hardcode this. + my $branch_version = '5.0.4'; # We do a string comparison instead of a numerical one, because # e.g. 2.2 == 2.20, but 2.2 ne 2.20 (and 2.2 is indeed much older). @@ -97,12 +98,12 @@ sub get_notifications { # Only notify the administrator if the latest version available # is newer than the current one. my @new_version = - ($release[0]->{'latest_ver'} =~ m/^(\d+)\.(\d+)(?:(rc|\.)(\d+))?\+?$/); + ($release[0]->{'latest_ver'} =~ m/^(\d+)\.(\d+)(?:\.(\d+))?(?:(rc|\.)(\d+))?\+?$/); # We convert release candidates 'rc' to integers (rc ? 0 : 1) in order # to compare versions easily. - $current_version[2] = ($current_version[2] && $current_version[2] eq 'rc') ? 0 : 1; - $new_version[2] = ($new_version[2] && $new_version[2] eq 'rc') ? 0 : 1; + @current_version = map { s/^(?:rc|)$/0/; s/^\.$/1/; $_; } @current_version; + @new_version = map { s/^(?:rc|)$/0/; s/^\.$/1/; $_; } @new_version; my $is_newer = _compare_versions(\@current_version, \@new_version); return ($is_newer == 1) ? {'data' => $release[0]} : undef; |