[PATCH 13/18] gitweb: Add commented url & url hash to page footer
From: "John 'Warthog9' Hawley" <warthog9@eaglescrag.net>
Date: 2016-06-15 22:50:13
Subsystem:
the rest · Maintainer:
Linus Torvalds
This is mostly a debugging tool, but it adds a small bit of information to the footer: <!-- Full URL: |http://localhost/gitweb-caching/gitweb.cgi?p=/project.git;a=summary| URL Hash: |7a31cfb8a43f5643679eec88aa9d7981| --> The first bit tells you what the url that generated the page actually was, the second is the hash used to store the file with the first two characters being used as the directory: <cachedir>/7a/31cfb8a43f5643679eec88aa9d7981 Also useful for greping through the existing cache and finding files with unique paths that you may want to explicitly flush. Signed-off-by: John 'Warthog9' Hawley <warthog9@eaglescrag.net> --- gitweb/gitweb.perl | 7 +++++++ gitweb/lib/cache.pl | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index e8c028b..7f8292e 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl@@ -303,6 +303,9 @@ our $fullhashpath = *STDOUT; our $fullhashbinpath = *STDOUT; our $fullhashbinpathfinal = *STDOUT; +our $full_url; +our $urlhash; + # configuration for 'highlight' (http://www.andre-simon.de/) # match by basename our %highlight_basename = (
@@ -3663,6 +3666,10 @@ sub git_footer_html { print "<div class=\"page_footer\">\n"; print "<div class=\"cachetime\">Cache Last Updated: ". gmtime( time ) ." GMT</div>\n"; + print "<!--\n". + " Full URL: |$full_url|\n". + " URL Hash: |$urlhash|\n". + "-->\n" if ($cache_enable); if (defined $project) { my $descr = git_get_project_description($project); if (defined $descr) {
diff --git a/gitweb/lib/cache.pl b/gitweb/lib/cache.pl
index fafc028..63dbe9e 100644
--- a/gitweb/lib/cache.pl
+++ b/gitweb/lib/cache.pl@@ -30,8 +30,8 @@ sub cache_fetch { print "Cache directory created successfully\n"; } - our $full_url = "$my_url?". $ENV{'QUERY_STRING'}; - our $urlhash = md5_hex($full_url); + $full_url = "$my_url?". $ENV{'QUERY_STRING'}; + $urlhash = md5_hex($full_url); our $fullhashdir = "$cachedir/". substr( $urlhash, 0, 2) ."/"; eval { mkpath( $fullhashdir, 0, 0777 ) };
--
1.7.2.3