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
78be753e
Commit
78be753e
authored
Feb 28, 2010
by
Max Kanat-Alexander
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 508823: Make it so that you don't ever have to reset template_inner (like
Bugzilla->template_inner("")). r=LpSolit, a=LpSolit
parent
5080ecd2
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
28 additions
and
19 deletions
+28
-19
Bugzilla.pm
Bugzilla.pm
+4
-4
BugMail.pm
Bugzilla/BugMail.pm
+0
-1
Flag.pm
Bugzilla/Flag.pm
+0
-1
Template.pm
Bugzilla/Template.pm
+20
-3
Hook.pm
Bugzilla/Template/Plugin/Hook.pm
+4
-3
Token.pm
Bugzilla/Token.pm
+0
-3
Extension.pm
extensions/Voting/Extension.pm
+0
-1
relogin.cgi
relogin.cgi
+0
-1
whine.pl
whine.pl
+0
-1
whineatnews.pl
whineatnews.pl
+0
-1
No files found.
Bugzilla.pm
View file @
78be753e
...
...
@@ -176,17 +176,17 @@ sub init_page {
sub
template
{
my
$class
=
shift
;
$class
->
request_cache
->
{
language
}
=
""
;
$class
->
request_cache
->
{
template
}
||=
Bugzilla::
Template
->
create
();
return
$class
->
request_cache
->
{
template
};
}
sub
template_inner
{
my
(
$class
,
$lang
)
=
@_
;
$lang
=
defined
(
$lang
)
?
$lang
:
(
$class
->
request_cache
->
{
language
}
||
""
);
$class
->
request_cache
->
{
language
}
=
$lang
;
my
$cache
=
$class
->
request_cache
;
my
$current_lang
=
$cache
->
{
template_current_lang
}
->
[
0
];
$lang
||=
$current_lang
||
''
;
$class
->
request_cache
->
{
"template_inner_$lang"
}
||=
Bugzilla::
Template
->
create
();
||=
Bugzilla::
Template
->
create
(
language
=>
$lang
);
return
$class
->
request_cache
->
{
"template_inner_$lang"
};
}
...
...
Bugzilla/BugMail.pm
View file @
78be753e
...
...
@@ -647,7 +647,6 @@ sub sendMail {
my
$template
=
Bugzilla
->
template_inner
(
$user
->
settings
->
{
'lang'
}
->
{
'value'
});
$template
->
process
(
"email/newchangedmail.txt.tmpl"
,
$vars
,
\
$msg
)
||
ThrowTemplateError
(
$template
->
error
());
Bugzilla
->
template_inner
(
""
);
MessageToMTA
(
$msg
);
...
...
Bugzilla/Flag.pm
View file @
78be753e
...
...
@@ -1012,7 +1012,6 @@ sub notify {
$template
->
process
(
"request/email.txt.tmpl"
,
$vars
,
\
$message
)
||
ThrowTemplateError
(
$template
->
error
());
Bugzilla
->
template_inner
(
""
);
MessageToMTA
(
$message
);
}
}
...
...
Bugzilla/Template.pm
View file @
78be753e
...
...
@@ -84,9 +84,9 @@ sub _load_constants {
# settings of the user and of the available languages
# If no Accept-Language is present it uses the defined default
# Templates may also be found in the extensions/ tree
sub
getTemplateIncludePath
{
sub
_include_path
{
my
$lang
=
shift
||
''
;
my
$cache
=
Bugzilla
->
request_cache
;
my
$lang
=
$cache
->
{
'language'
}
||
''
;
$cache
->
{
"template_include_path_$lang"
}
||=
template_include_path
({
language
=>
$lang
});
return
$cache
->
{
"template_include_path_$lang"
};
...
...
@@ -428,6 +428,17 @@ $Template::Stash::SCALAR_OPS->{ truncate } =
###############################################################################
sub
process
{
my
$self
=
shift
;
# All of this current_langs stuff allows template_inner to correctly
# determine what-language Template object it should instantiate.
my
$current_langs
=
Bugzilla
->
request_cache
->
{
template_current_lang
}
||=
[]
;
unshift
(
@$current_langs
,
$self
->
context
->
{
bz_language
});
my
$retval
=
$self
->
SUPER::
process
(
@_
);
shift
@$current_langs
;
return
$retval
;
}
# Construct the Template object
# Note that all of the failure cases here can't use templateable errors,
...
...
@@ -442,7 +453,8 @@ sub create {
my
$config
=
{
# Colon-separated list of directories containing templates.
INCLUDE_PATH
=>
$opts
{
'include_path'
}
||
getTemplateIncludePath
(),
INCLUDE_PATH
=>
$opts
{
'include_path'
}
||
_include_path
(
$opts
{
'language'
}),
# Remove white-space before template directives (PRE_CHOMP) and at the
# beginning and end of templates and template blocks (TRIM) for better
...
...
@@ -787,6 +799,11 @@ sub create {
Bugzilla::Hook::
process
(
'template_before_create'
,
{
config
=>
$config
});
my
$template
=
$class
->
new
(
$config
)
||
die
(
"Template creation failed: "
.
$class
->
error
());
# Pass on our current language to any template hooks or inner templates
# called by this Template object.
$template
->
context
->
{
bz_language
}
=
$opts
{
language
}
||
''
;
return
$template
;
}
...
...
Bugzilla/Template/Plugin/Hook.pm
View file @
78be753e
...
...
@@ -62,7 +62,7 @@ sub process {
# Get the hooks out of the cache if they exist. Otherwise, read them
# from the disk.
my
$cache
=
Bugzilla
->
request_cache
->
{
template_plugin_hook_cache
}
||=
{};
my
$lang
=
Bugzilla
->
request_cache
->
{
language
}
||
''
;
my
$lang
=
$context
->
{
bz_
language
}
||
''
;
$cache
->
{
"${lang}__$extension_template"
}
||=
$self
->
_get_hooks
(
$extension_template
);
...
...
@@ -75,7 +75,7 @@ sub process {
sub
_get_hooks
{
my
(
$self
,
$extension_template
)
=
@_
;
my
$template_sets
=
_template_hook_include_path
();
my
$template_sets
=
$self
->
_template_hook_include_path
();
my
@hooks
;
foreach
my
$dir_set
(
@$template_sets
)
{
foreach
my
$template_dir
(
@$dir_set
)
{
...
...
@@ -93,8 +93,9 @@ sub _get_hooks {
}
sub
_template_hook_include_path
{
my
$self
=
shift
;
my
$cache
=
Bugzilla
->
request_cache
;
my
$language
=
$
cache
->
{
language
}
||
''
;
my
$language
=
$
self
->
_context
->
{
bz_
language
}
||
''
;
my
$cache_key
=
"template_plugin_hook_include_path_$language"
;
$cache
->
{
$cache_key
}
||=
template_include_path
({
language
=>
$language
,
...
...
Bugzilla/Token.pm
View file @
78be753e
...
...
@@ -122,7 +122,6 @@ sub IssueEmailChangeToken {
$template
->
process
(
"account/email/change-new.txt.tmpl"
,
$vars
,
\
$message
)
||
ThrowTemplateError
(
$template
->
error
());
Bugzilla
->
template_inner
(
""
);
MessageToMTA
(
$message
);
}
...
...
@@ -160,7 +159,6 @@ sub IssuePasswordToken {
$vars
,
\
$message
)
||
ThrowTemplateError
(
$template
->
error
());
Bugzilla
->
template_inner
(
""
);
MessageToMTA
(
$message
);
}
...
...
@@ -300,7 +298,6 @@ sub Cancel {
$template
->
process
(
"account/cancel-token.txt.tmpl"
,
$vars
,
\
$message
)
||
ThrowTemplateError
(
$template
->
error
());
Bugzilla
->
template_inner
(
""
);
MessageToMTA
(
$message
);
# Delete the token from the database.
...
...
extensions/Voting/Extension.pm
View file @
78be753e
...
...
@@ -800,7 +800,6 @@ sub _remove_votes {
$template
->
process
(
"voting/votes-removed.txt.tmpl"
,
$vars
,
\
$msg
);
push
(
@messages
,
$msg
);
}
Bugzilla
->
template_inner
(
""
);
my
$votes
=
$dbh
->
selectrow_array
(
"SELECT SUM(vote_count) "
.
"FROM votes WHERE bug_id = ?"
,
...
...
relogin.cgi
View file @
78be753e
...
...
@@ -164,7 +164,6 @@ elsif ($action eq 'begin-sudo') {
my
$message
;
my
$mail_template
=
Bugzilla
->
template_inner
(
$target_user
->
settings
->
{
'lang'
}
->
{
'value'
});
$mail_template
->
process
(
'email/sudo.txt.tmpl'
,
{
reason
=>
$reason
},
\
$message
);
Bugzilla
->
template_inner
(
""
);
MessageToMTA
(
$message
);
$vars
->
{
'message'
}
=
'sudo_started'
;
...
...
whine.pl
View file @
78be753e
...
...
@@ -395,7 +395,6 @@ sub mail {
$template
->
process
(
"whine/multipart-mime.txt.tmpl"
,
$args
,
\
$msg
)
or
die
(
$template
->
error
());
Bugzilla
->
template_inner
(
""
);
MessageToMTA
(
$msg
);
delete
$args
->
{
'boundary'
};
...
...
whineatnews.pl
View file @
78be753e
...
...
@@ -89,7 +89,6 @@ foreach my $email (sort (keys %bugs)) {
$template
->
process
(
"email/whine.txt.tmpl"
,
$vars
,
\
$msg
)
or
die
(
$template
->
error
());
Bugzilla
->
template_inner
(
""
);
MessageToMTA
(
$msg
);
print
"$email "
.
join
(
" "
,
@
{
$bugs
{
$email
}})
.
"\n"
;
...
...
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