Closed Bug 239112 Opened 20 years ago Closed 20 years ago

hook system not using correct template name

Categories

(Bugzilla :: User Interface, defect)

2.17.7
All
FreeBSD
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: nb+bz, Assigned: myk)

Details

Attachments

(3 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113
Build Identifier: 

The hooks system in Bugzilla 2.17.7 doesn't work as documented.  The
documentation (docs/html/cust-hooks.html) says that a hook's directory is at
template/en/extension/hook/PATH_TO_STANDARD_TEMPLATE/STANDARD_TEMPLATE_NAME/HOOK_NAME/

The example given is template/en/extension/hook/global/useful-links.html.tmpl/edit/

But a hook placed in that location doesn't get found by the templates system.
Instrumenting the hooks code (in Bugzilla/Template/Plugin/Hook.pm) shows me that
it is in fact looking in:
template/en/extension/hook/global/variables.none.tmpl/edit/

I'm guessing that variables.none.tmpl is the first template processed for that
page, but I don't know.

I don't know much about the Templates Toolkit.  Maybe this is something to do
with the version I am running.  checksetup.pl says:

Checking for       AppConfig (v1.52)   ok: found v1.55
Checking for             CGI (v2.93)   ok: found v3.04
Checking for    Data::Dumper (any)     ok: found v2.102
Checking for    Date::Format (v2.21)   ok: found v2.22
Checking for             DBI (v1.32)   ok: found v1.35
Checking for      DBD::mysql (v2.1010) ok: found v2.1026
Checking for      File::Spec (v0.82)   ok: found v0.86
Checking for      File::Temp (any)     ok: found v0.12
Checking for        Template (v2.08)   ok: found v2.08
Checking for      Text::Wrap (v2001.0131) ok: found v2001.0929
Checking for              GD (v1.20)   ok: found v2.07
Checking for     Chart::Base (v0.99)   ok: found v2.2
Checking for     XML::Parser (any)      not found
Checking for       GD::Graph (any)      not found
Checking for GD::Text::Align (any)      not found
Checking for     PatchReader (any)      not found

This is a vanilla Bugzilla 2.17.7 on FreeBSD 4.8-STABLE, Perl 5.6.1.

Reproducible: Always
Steps to Reproduce:
1. Add a file
template/en/extension/hook/useful-links.html.tmpl/edit/spong.html.tmpl, with any
old content.
2. Load any bug page as an administrator.
Actual Results:  
Nothing.  In particular, spong.html.tmpl didn't get compiled (or even read), and
nothing magic appeared in the relevant place on the lower nav bar.

Expected Results:  
spong.html.tmpl should have been processed by the templates system and the
result appeared at the end of the list of items to edit on the lower nav bar.
Here is my Hook.pm, which writes log messages to data/logfile showing how it
searches for hook templates.
OS: other → FreeBSD
Version: unspecified → 2.17.7
There's a bug in versions of TT prior to 2.12 that causes this problem.  The
solution is to upgrade to TT 2.12 or later or apply a patch that I'll attach to
this bug shortly.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
I guess that means we need to either:

- bump the required version of TT to 2.12 (something I want for charting, but 
  which has been resisted because the FLUSH patch on b.m.o. only works on 2.08)

or

- document the need for this patch, and how to apply it, on earlier versions.

Gerv
This problem isn't significant enough to force us to 2.12.  We should document
it, though.
Flags: documentation?
Could you make the patch coexist with either version?
So I've upgraded to TT 2.13, but I think the TT version dependency needs sorting
out in Bugzilla.  Either the hooks doc needs to say "by the way, you'll need TT
2.12 or later for this" or the main TT dependency needs to move up.  Otherwise
anyone trying to use hooks will have the same problems I did. Should I file a
separate bug for that?
The docs should mention the problem and point to the patch, hence the
documentation flag on this bug.  No need for a new one.
I see that 2.18rc1 docs don't mention this.  Can this patch, or something like
it, get into 2.18?
r=gerv. Requesting approval.

Gerv
Flags: approval2.18?
go for it.  set the documentation flags to + when you check it in.
Flags: approval2.18? → documentation2.18?
Flags: documentation?
Flags: documentation2.18?
Flags: documentation2.18+
Flags: documentation+
Checking perl modules ...
Checking for       AppConfig (v1.52)   ok: found v1.56
Checking for             CGI (v2.93)   ok: found v3.10
Checking for    Data::Dumper (any)     ok: found v2.12
Checking for    Date::Format (v2.21)   ok: found v2.22
Checking for             DBI (v1.36)   ok: found v1.48
Checking for      DBD::mysql (v2.1010) ok: found v2.1021
Checking for      File::Spec (v0.82)   ok: found v3.09
Checking for      File::Temp (any)     ok: found v0.16
Checking for        Template (v2.08)   ok: found v2.14
Checking for      Text::Wrap (v2001.0131) ok: found v2001.0929
 
The following Perl modules are optional:
Checking for              GD (v1.20)    not found
Checking for     Chart::Base (v1.0)     not found
Checking for     XML::Parser (any)     ok: found v2.31
Checking for       GD::Graph (any)      not found
Checking for GD::Text::Align (any)      not found
Checking for     PatchReader (v0.9.4)   not found

I use the bugzilla 2.18.1 and os is linux,but the hooks system in Bugzilla
2.18.1 doesn't work as documented,can you tall why?

czy: please post your question to the newsgroup
news://news.mozilla.org/netscape.public.mozilla.webtools , giving a lot more
details.

Gerv
QA Contact: matty_is_a_geek → default-qa
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: