Bugzilla – Attachment 186490 Details for
Bug 40813
Add ability to embed page start and end timing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40813: Add ability to embed page start and end timing
Bug-40813-Add-ability-to-embed-page-start-and-end-.patch (text/plain), 6.28 KB, created by
Lucas Gass (lukeg)
on 2025-09-16 16:51:41 UTC
(
hide
)
Description:
Bug 40813: Add ability to embed page start and end timing
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2025-09-16 16:51:41 UTC
Size:
6.28 KB
patch
obsolete
>From e91f790f1f5835bcb4002aea40ac166cb960b408 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >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 +++ > .../data/mysql/atomicupdate/bug_40813.pl | 21 +++++++++++++++++++ > installer/data/mysql/mandatory/sysprefs.sql | 3 ++- > .../prog/en/includes/intranet-bottom.inc | 18 ++++++++++++++++ > .../en/modules/admin/preferences/logs.pref | 6 ++++++ > 5 files changed, 50 insertions(+), 1 deletion(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_40813.pl > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index 0599f7b0520..199d5bd2de5 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/installer/data/mysql/atomicupdate/bug_40813.pl b/installer/data/mysql/atomicupdate/bug_40813.pl >new file mode 100755 >index 00000000000..bbbf93e606c >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_40813.pl >@@ -0,0 +1,21 @@ >+use Modern::Perl; >+use Koha::Installer::Output qw(say_warning say_success say_info); >+ >+return { >+ bug_number => "40813", >+ description => "Add new system preference DumpTemplateLoadTimes", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ $dbh->do( >+ q{ >+ INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES >+ ('DumpTemplateLoadTimes', '0', NULL, 'If enabled, dump the start and end times of each page load in the template footer', 'YesNo') >+ } >+ ); >+ >+ # Other information >+ say_success( $out, "Added new system preference DumpTemplateLoadTimes" ); >+ }, >+}; >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index ea60db69b7c..49dff9cb1aa 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -230,6 +230,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('DisplayMultiPlaceHold','1','','Display the ability to place multiple holds or not','YesNo'), > ('DisplayOPACiconsXSLT','1','','If ON, displays the format, audience, and material type icons in XSLT MARC21 results and detail pages in the OPAC.','YesNo'), > ('DumpSearchQueryTemplate',0,'','Add the search query being passed to the search engine into the template for debugging','YesNo'), >+('DumpTemplateLoadTimes', '0', NULL , 'If enabled, dump the start and end times of each page load in the template footer', 'YesNo'), > ('DumpTemplateVarsIntranet', '0', NULL , 'If enabled, dump all Template Toolkit variable to a comment in the html source for the staff intranet.', 'YesNo'), > ('DumpTemplateVarsOpac', '0', NULL , 'If enabled, dump all Template Toolkit variable to a comment in the html source for the opac.', 'YesNo'), > ('EasyAnalyticalRecords','0','','If on, display in the catalogue screens tools to easily setup analytical record relationships','YesNo'), >@@ -891,4 +892,4 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'), > ('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo'), > ('z3950Status','','','This syspref allows to define custom YAML based rules for marking items unavailable in z3950 results.','Textarea') >-; >\ No newline at end of file >+; >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 %] >+<footer class="footer"> >+ <div class="container"> >+ <span class="navbar-text start_time" data-start="[% start_time %]"> >+ <span class="badge text-bg-info">Start</span> >+ [% start_time.hms(':') %] >+ </span> >+ [%- SET end_time = KohaDates.datetime_from_string %] >+ <span class="navbar-text end_time" data-end="[% end_time %]"> >+ <span class="badge text-bg-primary">End</span> >+ [% end_time.hms(':') %] >+ </span> >+ </div> >+</footer> >+[% END %] >+ >+ > </body> > <!-- prettier-ignore-start --> > </html> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref >index 58679b4ab32..f5a65a0b88b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref >@@ -134,6 +134,12 @@ Logging: > - item transfers. > > Debugging: >+ - >+ - pref: DumpTemplateLoadTimes >+ choices: >+ 1: Do >+ 0: "Don't" >+ - dump the start and end times of each page/template in the HTML footer. > - > - "When logging actions, store a stack trace that goes at most" > - pref: "ActionLogsTraceDepth" >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 40813
:
186445
|
186490