From 4319dbadd8043504ca10cea94450f0aab43b5001 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Fri, 14 Aug 2015 20:22:02 -0700 Subject: [PATCH] gitweb: do not cache last refresh time Create a new PI so that the last refresh time will be shown accurately even when the summary page is cached. Signed-off-by: Kyle J. McKay --- gitweb/gitweb.perl | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index b16f3c7986..c69ad3c475 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -2226,6 +2226,7 @@ BEGIN {%expand_pi_subs = ( 'age_string_age' => \&age_string_age, 'compute_timed_interval' => \&compute_timed_interval, 'compute_commands_count' => \&compute_commands_count, + 'format_lastrefresh_row' => \&format_lastrefresh_row, )} # Expands any processing instructions and returns the result @@ -5203,6 +5204,16 @@ sub format_timestamp_html { return $strtime; } +sub format_lastrefresh_row { + return "" if $cache_mode_active; + my %rd = parse_file_date('.last_refresh'); + if (defined $rd{'rfc2822'}) { + return "last refresh" . + "".format_timestamp_html(\%rd,0).""; + } + return ""; +} + # Outputs the author name and date in long form sub git_print_authorship { my $co = shift; @@ -7478,11 +7489,7 @@ sub git_summary { print "last change" . "".format_timestamp_html(\%cd)."\n"; } - my %rd = parse_file_date('.last_refresh'); - if (defined $rd{'rfc2822'}) { - print "last refresh" . - "".format_timestamp_html(\%rd,0)."\n"; - } + print format_lastrefresh_row(), "\n"; # use per project git URL list in $projectroot/$project/cloneurl # or make project git URL from git base URL and project name -- 2.11.4.GIT