From 7a31a6305e08f4750c8c2bf5d8de7311e8f8bfd1 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 15 Sep 2025 15:20:13 -0400 Subject: [PATCH] Bug 40813: Add ability to embed page start and end timing It would be useful to know what time a page load was initiated and rendering completed for debugging purposes. The most reasonable solution I've found is to get a time from the start of get_template_and_user and the end of intranet-bottom.inc. This adds timing to nearly all Koha pages with just a few lines of code. Test Plan: 1) Apply this patch 2) Restart all the things! 3) Load mainpage.pl 4) Note the "start" and "end" values at the bottom of the page --- C4/Auth.pm | 3 +++ .../prog/en/includes/intranet-bottom.inc | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/C4/Auth.pm b/C4/Auth.pm index affc7ee43a2..4f38ff13993 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -189,6 +189,7 @@ Output.pm module. =cut sub get_template_and_user { + my $start_time = dt_from_string; my $in = shift; my ( $user, $cookie, $sessionID, $flags ); @@ -692,6 +693,8 @@ sub get_template_and_user { $template->param( logged_in_user => $patron ); $template->param( sessionID => $sessionID ); + $template->param( start_time => $start_time ); + return ( $template, $borrowernumber, $cookie, $flags ); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc index d267032d37c..28e0e919fe2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc @@ -1,5 +1,6 @@ [% USE raw %] [% USE Koha %] +[% USE KohaDates %] [% USE KohaPlugins %] [% USE Asset %] [% USE AdditionalContents %] @@ -192,6 +193,23 @@ [% END %] [% KohaPlugins.get_plugins_intranet_js | $raw %] +[% IF start_time %] + +[% END %] + + -- 2.39.5 (Apple Git-154)