From: Don Armstrong Date: Thu, 19 Feb 2009 05:04:07 +0000 (-0800) Subject: Calculate last modified using summary as well as log (closes: #515063) X-Git-Tag: release/2.6.0~461^2~54 X-Git-Url: https://git.donarmstrong.com/?p=debbugs.git;a=commitdiff_plain;h=61d7e6604f554cc879d8d863d561cdb936b90345 Calculate last modified using summary as well as log (closes: #515063) --- diff --git a/cgi/bugreport.cgi b/cgi/bugreport.cgi index 3c6b61e..a151b21 100755 --- a/cgi/bugreport.cgi +++ b/cgi/bugreport.cgi @@ -15,7 +15,7 @@ use Debbugs::Config qw(:globals :text); use Debbugs::Log qw(read_log_records); use Debbugs::CGI qw(:url :html :util); use Debbugs::CGI::Bugreport qw(:all); -use Debbugs::Common qw(buglog getmaintainers make_list); +use Debbugs::Common qw(buglog getmaintainers make_list bug_status); use Debbugs::Packages qw(getpkgsrc); use Debbugs::Status qw(splitpackages get_bug_status isstrongseverity); @@ -23,6 +23,8 @@ use Scalar::Util qw(looks_like_number); use Debbugs::Text qw(:templates); +use List::Util qw(max); + use CGI::Simple; my $q = new CGI::Simple; @@ -63,6 +65,34 @@ my %bugusertags; my %ut; my %seen_users; +my $buglog = buglog($ref); +my $bug_status = bug_status($ref); +if (not defined $buglog or not defined $bug_status) { + print $q->header(-status => "404 No such bug", + -type => "text/html", + -charset => 'utf-8', + ); + print fill_in_template(template=>'cgi/no_such_bug', + variables => {modify_time => strftime('%a, %e %b %Y %T UTC', gmtime), + bug_num => $ref, + }, + ); + exit 0; +} + +# the log should almost always be newer, but just in case +my $log_mtime = +(stat $buglog)[9] || time; +my $status_mtime = +(stat $bug_status)[9] || time; +my $mtime = strftime '%a, %d %b %Y %T GMT', gmtime(max($status_mtime,$log_mtime)); + +if ($q->request_method() eq 'HEAD' and not defined($att) and not $mbox) { + print $q->header(-type => "text/html", + -charset => 'utf-8', + (length $mtime)?(-last_modified => $mtime):(), + ); + exit 0; +} + for my $user (map {split /[\s*,\s*]+/} make_list($param{users}||[])) { next unless length($user); add_user($user,\%ut,\%bugusertags,\%seen_users); @@ -94,33 +124,6 @@ $mbox = 1 if $mbox_status_message or $mbox_maint; my $archive = $param{'archive'} eq 'yes'; my $repeatmerged = $param{'repeatmerged'} eq 'yes'; -my $buglog = buglog($ref); -if (not defined $buglog) { - print $q->header(-status => "404 No such bug", - -type => "text/html", - -charset => 'utf-8', - ); - print fill_in_template(template=>'cgi/no_such_bug', - variables => {modify_time => strftime('%a, %e %b %Y %T UTC', gmtime), - bug_num => $ref, - }, - ); - exit 0; -} - -my @stat = stat $buglog; -my $mtime = ''; -if (@stat) { - $mtime = strftime '%a, %d %b %Y %T GMT', gmtime($stat[9]); -} - -if ($q->request_method() eq 'HEAD' and not defined($att) and not $mbox) { - print $q->header(-type => "text/html", - -charset => 'utf-8', - (length $mtime)?(-last_modified => $mtime):(), - ); - exit 0; -} my $buglogfh; diff --git a/debian/changelog b/debian/changelog index 2344152..8c0355c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -242,6 +242,7 @@ debbugs (2.4.2) UNRELEASED; urgency=low * Indicate the update location of source (closes: #512306) * Use get_addresses to parse X-Debbugs-Cc: to allow multiple Cc:'s (closes: #514183) + * Calculate last modified using summary as well as log (closes: #515063) -- Colin Watson Fri, 20 Jun 2003 18:57:25 +0100