]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1852154: Warn admin if end-of-support date is approaching (#135)
authorDave Miller <justdave@bugzilla.org>
Mon, 26 Aug 2024 01:25:10 +0000 (21:25 -0400)
committerGitHub <noreply@github.com>
Mon, 26 Aug 2024 01:25:10 +0000 (21:25 -0400)
* Also restores the update-check output on the home page, apparently BMO had removed it.
a=dylan

Bugzilla/Update.pm
template/en/default/index.html.tmpl

index 9f928816225f488c38aff162ee8b2173b2341f24..775eb67143e6b887e792eedef6620870d49fc801 100644 (file)
@@ -52,7 +52,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);
   }
@@ -72,6 +73,35 @@ 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.
+    my $branch_version = $current_version[0] . '.' . $current_version[1];
+
+    # 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') {
@@ -84,6 +114,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') {
index c4f0af2d4f2e43d95ff57d555a1d6bd651c80f81..5e7098dc763af7514c0755b088962a7127ee42dd 100644 (file)
    no_yui = 1
 %]
 
+[% IF release %]
+  <div id="new_release">
+    [% IF release.data %]
+      [% IF release.eos_date %]
+        <p>[% terms.Bugzilla %] [%+ release.branch_version FILTER html %] will
+        no longer receive security updates after [% release.eos_date FILTER html %].
+        You are highly encouraged to upgrade in order to keep your
+        system secure.</p>
+      [% END %]
+      [% IF release.deprecated %]
+        <p>Bugzilla [%+ release.deprecated FILTER html %] is no longer
+        supported. You are highly encouraged to upgrade in order to keep your
+        system secure.</p>
+      [% END %]
+
+      <p>A new Bugzilla version ([% release.data.latest_ver FILTER html %])
+      is available at
+      <a href="[% release.data.url FILTER html %]">[% release.data.url FILTER html %]</a>.<br>
+      Release date: [% release.data.date FILTER html %]</p>
+
+      <p class="notice">This message is only shown to logged in users with admin privs.
+      You can configure this notification from the
+      <a href="editparams.cgi?section=general#upgrade_notification_desc">Parameters</a> page.</p>
+    [% ELSIF release.error == "cannot_download" %]
+      <p>The remote file <a href="[% constants.REMOTE_FILE FILTER html %]">
+      [%~ constants.REMOTE_FILE FILTER html %]</a> cannot be downloaded
+      (reason: [% release.reason FILTER html %]).<br>
+      Either the remote server is temporarily unavailable, or your web server cannot access
+      the web. If you are behind a proxy, set the
+      <a href="editparams.cgi?section=advanced#proxy_url_desc">proxy_url</a> parameter correctly.</p>
+    [% ELSIF release.error == "no_write" %]
+      <p>The local XML file '[% constants.LOCAL_FILE FILTER html %]' cannot be created
+      (reason: [% release.reason FILTER html %]).<br>
+      Please make sure the web server can write into this directory.
+    [% ELSIF release.error == "no_update" %]
+      <p>The local XML file '[% constants.LOCAL_FILE FILTER html %]' cannot be updated.
+      Please make sure the web server can edit this file.</p>
+    [% ELSIF release.error == "no_access" %]
+      <p>The local XML file '[% constants.LOCAL_FILE FILTER html %]' cannot be read.
+      Please make sure this file has the correct rights set on it.</p>
+    [% ELSIF release.error == "corrupted" %]
+      <p>The local XML file '[% constants.LOCAL_FILE FILTER html %]' has an invalid XML format.
+      Please delete it and try accessing this page again.</p>
+    [% ELSIF release.error == "unknown_parameter" %]
+      <p>'[% Param("upgrade_notification") FILTER html %]' is not a valid notification
+      parameter. Please check this parameter in the
+      <a href="editparams.cgi?section=general#upgrade_notification_desc">Parameters</a> page.</p>
+    [% END %]
+  </div>
+[% END %]
+
 <div id="page-index">
   <table>
     <tr>