diff options
author | Dave Miller <justdave@bugzilla.org> | 2024-08-25 21:24:08 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-25 21:24:08 -0400 |
commit | 37fc276406fba13f1477d7df7171920e5e3815d0 (patch) | |
tree | f9f8ae807a2749d94324ec0e67edf520322293d2 /Bugzilla/Update.pm | |
parent | 1631b86eeb52c2f8dac560b7dc6893cdf56ce94c (diff) | |
download | bugs-37fc276406fba13f1477d7df7171920e5e3815d0.tar bugs-37fc276406fba13f1477d7df7171920e5e3815d0.tar.gz bugs-37fc276406fba13f1477d7df7171920e5e3815d0.tar.bz2 bugs-37fc276406fba13f1477d7df7171920e5e3815d0.tar.xz bugs-37fc276406fba13f1477d7df7171920e5e3815d0.zip |
[5.0.4] Bug 1852154: Warn admin if end-of-support date is approaching (#191)
a=dylan
Diffstat (limited to 'Bugzilla/Update.pm')
-rw-r--r-- | Bugzilla/Update.pm | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/Bugzilla/Update.pm b/Bugzilla/Update.pm index c01f45e4c..1c092ebe4 100644 --- a/Bugzilla/Update.pm +++ b/Bugzilla/Update.pm @@ -49,7 +49,8 @@ sub get_notifications { 'latest_ver' => $branch->{'att'}->{'vid'}, 'status' => $branch->{'att'}->{'status'}, 'url' => $branch->{'att'}->{'url'}, - 'date' => $branch->{'att'}->{'date'} + 'date' => $branch->{'att'}->{'date'}, + 'eos_date' => exists($branch->{'att'}->{'eos-date'}) ? $branch->{'att'}->{'eos-date'} : undef, }; push(@releases, $release); } @@ -68,6 +69,36 @@ sub get_notifications { } } elsif (Bugzilla->params->{'upgrade_notification'} eq 'latest_stable_release') { + # We want the latest stable version for the current branch. + # If we are running a development snapshot, we won't match anything. + # 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). + @release = grep {$_->{'branch_ver'} eq $branch_version} @releases; + + # If the branch has an end-of-support date listed, we should + # strongly suggest to upgrade to the latest stable release + # available. + if (scalar(@release) && $release[0]->{'status'} ne 'closed' + && defined($release[0]->{'eos_date'})) { + my $eos_date = $release[0]->{'eos_date'}; + @release = grep {$_->{'status'} eq 'stable'} @releases; + return {'data' => $release[0], + 'branch_version' => $branch_version, + 'eos_date' => $eos_date}; + }; + + # If the branch is now closed, we should strongly suggest + # to upgrade to the latest stable release available. + if (scalar(@release) && $release[0]->{'status'} eq 'closed') { + @release = grep {$_->{'status'} eq 'stable'} @releases; + return {'data' => $release[0], 'deprecated' => $branch_version}; + } + + # If we get here, then we want to recommend the lastest stable + # release without any other messages. @release = grep {$_->{'status'} eq 'stable'} @releases; } elsif (Bugzilla->params->{'upgrade_notification'} eq 'stable_branch_release') { @@ -80,6 +111,18 @@ sub get_notifications { # e.g. 2.2 == 2.20, but 2.2 ne 2.20 (and 2.2 is indeed much older). @release = grep {$_->{'branch_ver'} eq $branch_version} @releases; + # If the branch has an end-of-support date listed, we should + # strongly suggest to upgrade to the latest stable release + # available. + if (scalar(@release) && $release[0]->{'status'} ne 'closed' + && defined($release[0]->{'eos_date'})) { + my $eos_date = $release[0]->{'eos_date'}; + @release = grep {$_->{'status'} eq 'stable'} @releases; + return {'data' => $release[0], + 'branch_version' => $branch_version, + 'eos_date' => $eos_date}; + }; + # If the branch is now closed, we should strongly suggest # to upgrade to the latest stable release available. if (scalar(@release) && $release[0]->{'status'} eq 'closed') { |