Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
8d978650
Commit
8d978650
authored
Apr 27, 2002
by
bbaetz%student.usyd.edu.au
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 97832 - turn on template compilation. This means that the minimum TT
version is now 2.07. r=myk, gerv
parent
150660ee
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
133 additions
and
16 deletions
+133
-16
checksetup.pl
checksetup.pl
+101
-15
rel_notes.txt
docs/rel_notes.txt
+25
-1
globals.pl
globals.pl
+7
-0
No files found.
checksetup.pl
View file @
8d978650
...
...
@@ -181,7 +181,7 @@ unless (have_vers("Data::Dumper",0)) { push @missing,"Data::Dumper" }
unless
(
have_vers
(
"DBD::mysql"
,
"1.2209"
))
{
push
@missing
,
"DBD::mysql"
}
unless
(
have_vers
(
"Date::Parse"
,
0
))
{
push
@missing
,
"Date::Parse"
}
unless
(
have_vers
(
"AppConfig"
,
"1.52"
))
{
push
@missing
,
"AppConfig"
}
unless
(
have_vers
(
"Template"
,
"2.0
6
"
))
{
push
@missing
,
"Template"
}
unless
(
have_vers
(
"Template"
,
"2.0
7
"
))
{
push
@missing
,
"Template"
}
unless
(
have_vers
(
"Text::Wrap"
,
"2001.0131"
))
{
push
@missing
,
"Text::Wrap"
}
unless
(
have_vers
(
"File::Spec"
,
"0.82"
))
{
push
@missing
,
"File::Spec"
}
...
...
@@ -525,6 +525,20 @@ my @my_priorities = @{*{$main::{'priorities'}}{ARRAY}};
my
@my_platforms
=
@
{
*
{
$
main::
{
'platforms'
}}{
ARRAY
}};
my
@my_opsys
=
@
{
*
{
$
main::
{
'opsys'
}}{
ARRAY
}};
if
(
$my_webservergroup
&&
(
$<
!=
0
))
{
# zach: if not root, yell at them, bug 87398
print
<<EOF;
Warning: you have entered a value for the "webservergroup" parameter
in localconfig, but you are not running this script as root.
This can cause permissions problems and decreased security. If you
experience problems running Bugzilla scripts, log in as root and re-run
this script, or remove the value of the "webservergroup" parameter.
Note that any warnings about "uninitialized values" that you may
see below are caused by this.
EOF
}
###########################################################################
# Global Utility Library
###########################################################################
...
...
@@ -737,6 +751,90 @@ END
}
}
{
eval
(
"use Date::Parse"
);
# Templates will be recompiled if the source changes, but not if the
# settings in globals.pl change, so we need to be able to force a rebuild
# if that happens
# The last time the global template params were changed. Keep in UTC,
# YYYY-MM-DD
my
$lastTemplateParamChange
=
str2time
(
"2002-04-24"
,
"UTC"
);
if
(
-
e
'data/template'
)
{
unless
(
-
d
'data/template'
&&
-
e
'data/template/.lastRebuild'
&&
(
stat
(
'data/template/.lastRebuild'
))[
9
]
>=
$lastTemplateParamChange
)
{
# If File::Path::rmtree reported errors, then I'd use that
use
File::
Find
;
sub
remove
{
return
if
$_
eq
"."
;
if
(
-
d
$_
)
{
rmdir
$_
||
die
"Couldn't rmdir $_: $!\n"
;
}
else
{
unlink
$_
||
die
"Couldn't unlink $_: $!\n"
;
}
}
finddepth
(
\&
remove
,
'data/template'
);
}
}
# Precompile stuff. This speeds up initial access (so the template isn't
# compiled multiple times simulataneously by different servers), and helps
# to get the permissions right.
eval
(
"use Template"
);
my
$redir
=
(
$^O
=~
/MSWin32/i
)
?
"NUL"
:
"/dev/null"
;
my
$template
=
Template
->
new
(
{
# Output to /dev/null here
OUTPUT
=>
$redir
,
# Colon-separated list of directories containing templates.
INCLUDE_PATH
=>
"template/en/custom:template/en/default"
,
PRE_CHOMP
=>
1
,
TRIM
=>
1
,
COMPILE_DIR
=>
"data"
,
# becomes data/template/en/{custom,default}
# These don't actually need to do anything here, just exist
FILTERS
=>
{
strike
=>
sub
{
return
$_
;
}
,
js
=>
sub
{
return
$_
;
},
html
=>
sub
{
return
$_
;
},
url_quote
=>
sub
{
return
$_
;
}
},
})
||
die
(
"Could not create Template: "
.
Template
->
error
()
.
"\n"
);
sub
compile
{
return
if
(
-
d
$_
);
return
if
(
$_
!~
/\.tmpl$/
);
s!template/en/default/!!
;
# trim the bit we don't pass to TT
$template
->
process
(
$_
,
{})
||
die
"Could not compile $_:"
.
$template
->
error
()
.
"\n"
;
}
{
use
File::
Find
;
# Disable warnings which come from running the compiled templates
# This way is OK, because they're all runtime warnings.
# The reason we get these warnings here is that none of the required
# vars will be present.
local
(
$^W
)
=
0
;
# Traverse the default hierachy. Custom templates will be picked up
# via the INCLUDE_PATH, but we know that bugzilla will only be
# calling stuff which exists in en/default
# FIXME - if we start doing dynamic INCLUDE_PATH we may have to
# recurse all of template/, changing the INCLUDE_PATH each time
find
({
wanted
=>
\&
compile
,
no_chdir
=>
1
},
"template/en/default"
);
}
# update the time on the stamp file
open
FILE
,
'>data/template/.lastRebuild'
;
close
FILE
;
utime
$lastTemplateParamChange
,
$lastTemplateParamChange
,
(
'data/template/.lastRebuild'
);
}
# Just to be sure ...
unlink
"data/versioncache"
;
...
...
@@ -852,20 +950,6 @@ sub fixPerms {
}
if
(
$my_webservergroup
)
{
unless
(
$<
==
0
)
{
# zach: if not root, yell at them, bug 87398
print
<<EOF;
Warning: you have entered a value for the "webservergroup" parameter
in localconfig, but you are not running this script as root.
This can cause permissions problems and decreased security. If you
experience problems running Bugzilla scripts, log in as root and re-run
this script, or remove the value of the "webservergroup" parameter.
Note that any warnings about "uninitialized values" that you may
see below are caused by this.
EOF
}
# Funny! getgrname returns the GID if fed with NAME ...
my
$webservergid
=
getgrnam
(
$my_webservergroup
);
# chown needs to be called with a valid uid, not 0. $< returns the
...
...
@@ -873,6 +957,7 @@ EOF
# userid.
fixPerms
(
'.htaccess'
,
$<
,
$webservergid
,
027
);
# glob('*') doesn't catch dotfiles
fixPerms
(
'data/.htaccess'
,
$<
,
$webservergid
,
027
);
fixPerms
(
'data/template'
,
$<
,
$webservergid
,
007
,
1
);
# webserver will write to these
fixPerms
(
'data/webdot/.htaccess'
,
$<
,
$webservergid
,
027
);
fixPerms
(
'data/params'
,
$<
,
$webservergid
,
017
);
fixPerms
(
'*'
,
$<
,
$webservergid
,
027
);
...
...
@@ -887,6 +972,7 @@ EOF
my
$gid
=
(
split
" "
,
$(
)[
0
];
fixPerms
(
'.htaccess'
,
$<
,
$gid
,
022
);
# glob('*') doesn't catch dotfiles
fixPerms
(
'data/.htaccess'
,
$<
,
$gid
,
022
);
fixPerms
(
'data/template'
,
$<
,
$gid
,
022
,
1
);
fixPerms
(
'data/webdot/.htaccess'
,
$<
,
$gid
,
022
);
fixPerms
(
'data/params'
,
$<
,
$gid
,
011
);
fixPerms
(
'*'
,
$<
,
$gid
,
022
);
...
...
docs/rel_notes.txt
View file @
8d978650
...
...
@@ -41,7 +41,7 @@ Perl v5.005
DBI v1.13
DBD::MySQL v1.2209
AppConfig v1.52
Template Toolkit v2.0
6
Template Toolkit v2.0
7
Text::Wrap v20001.0131
Data::Dumper, Date::Parse, CGI::Carp (any)
GD v1.19 (optional)
...
...
@@ -87,6 +87,30 @@ XML::Parser (any)
the MySQL optimiser.
(bug 96101)
- This release of Bugzilla uses the Template Toolkit. For speed,
compiled templates are cached on disk. If you modify the templates
in order to customise the look and feel of your Bugzilla instalation,
the toolkit will normally detect the changes, and recompile the
changed templates.
However, if you do not set a webservergroup in the localconfig file,
(a generally unwise thing on a production installation of Bugzilla)
the template directory would have to be world-writable for automatic
recompilation to happen.
Doing that would be a security risk. So, if you modify templates locally
and do not have a webservergroup set, you will have to rerun checksetup.pl
to recompile the templates manually. If you do not do this, the changes
you make will not appear, and an error message will be reported.
Adding new directories anywhere inside the template directory may cause
permission errors. If you see these, rerun checksetup.pl as root. If you
do not have root access, or cannot get someone who does to do this for you,
you can rename the data/template directory to data/template.old (or any
other name bugzilla doesn't use). Then rerun checksetup.pl to regenerate
the compiled templates.
(bug 97832)
************************************************************
*** USERS UPGRADING FROM 2.14.1 OR EARLIER - 2.16 ISSUES ***
************************************************************
...
...
globals.pl
View file @
8d978650
...
...
@@ -1527,6 +1527,11 @@ use Template;
# Create the global template object that processes templates and specify
# configuration parameters that apply to all templates processed in this script.
# IMPORTANT - If you make any configuration changes here, make sure to make
# them in t/004.template.t and checksetup.pl. You may also need to change the
# date settings were last changed - see the comments in checksetup.pl for
# details
$::template
||=
Template
->
new
(
{
# Colon-separated list of directories containing templates.
...
...
@@ -1539,6 +1544,8 @@ $::template ||= Template->new(
PRE_CHOMP
=>
1
,
TRIM
=>
1
,
COMPILE_DIR
=>
'data'
,
# Functions for processing text within templates in various ways.
FILTERS
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment