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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ivan Ivlev
bugzilla
Commits
5fc1b86c
Commit
5fc1b86c
authored
Nov 16, 2012
by
Frédéric Buclin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 797636: Improve performance for buglists
r=dkl a=LpSolit
parent
7605239f
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
65 additions
and
84 deletions
+65
-84
Bugzilla.pm
Bugzilla.pm
+12
-36
Config.pm
Bugzilla/Config.pm
+4
-2
Template.pm
Bugzilla/Template.pm
+2
-3
Context.pm
Bugzilla/Template/Context.pm
+7
-0
Util.pm
Bugzilla/Util.pm
+11
-10
time.html.tmpl
template/en/default/bug/time.html.tmpl
+2
-6
filterexceptions.pl
template/en/default/filterexceptions.pl
+1
-2
table.html.tmpl
template/en/default/list/table.html.tmpl
+26
-25
No files found.
Bugzilla.pm
View file @
5fc1b86c
...
@@ -167,7 +167,7 @@ sub init_page {
...
@@ -167,7 +167,7 @@ sub init_page {
my
$t_output
;
my
$t_output
;
$template
->
process
(
"global/message.$extension.tmpl"
,
$vars
,
\
$t_output
)
$template
->
process
(
"global/message.$extension.tmpl"
,
$vars
,
\
$t_output
)
||
ThrowTemplateError
(
$template
->
error
);
||
ThrowTemplateError
(
$template
->
error
);
print
$t_output
.
"\n"
;
say
$t_output
;
exit
;
exit
;
}
}
}
}
...
@@ -177,9 +177,7 @@ sub init_page {
...
@@ -177,9 +177,7 @@ sub init_page {
#####################################################################
#####################################################################
sub
template
{
sub
template
{
my
$class
=
shift
;
return
$_
[
0
]
->
request_cache
->
{
template
}
||=
Bugzilla::
Template
->
create
();
$class
->
request_cache
->
{
template
}
||=
Bugzilla::
Template
->
create
();
return
$class
->
request_cache
->
{
template
};
}
}
sub
template_inner
{
sub
template_inner
{
...
@@ -187,9 +185,7 @@ sub template_inner {
...
@@ -187,9 +185,7 @@ sub template_inner {
my
$cache
=
$class
->
request_cache
;
my
$cache
=
$class
->
request_cache
;
my
$current_lang
=
$cache
->
{
template_current_lang
}
->
[
0
];
my
$current_lang
=
$cache
->
{
template_current_lang
}
->
[
0
];
$lang
||=
$current_lang
||
''
;
$lang
||=
$current_lang
||
''
;
$class
->
request_cache
->
{
"template_inner_$lang"
}
return
$cache
->
{
"template_inner_$lang"
}
||=
Bugzilla::
Template
->
create
(
language
=>
$lang
);
||=
Bugzilla::
Template
->
create
(
language
=>
$lang
);
return
$class
->
request_cache
->
{
"template_inner_$lang"
};
}
}
our
$extension_packages
;
our
$extension_packages
;
...
@@ -248,9 +244,7 @@ sub feature {
...
@@ -248,9 +244,7 @@ sub feature {
}
}
sub
cgi
{
sub
cgi
{
my
$class
=
shift
;
return
$_
[
0
]
->
request_cache
->
{
cgi
}
||=
new
Bugzilla::
CGI
();
$class
->
request_cache
->
{
cgi
}
||=
new
Bugzilla::
CGI
();
return
$class
->
request_cache
->
{
cgi
};
}
}
sub
input_params
{
sub
input_params
{
...
@@ -274,15 +268,11 @@ sub localconfig {
...
@@ -274,15 +268,11 @@ sub localconfig {
}
}
sub
params
{
sub
params
{
my
$class
=
shift
;
return
$_
[
0
]
->
request_cache
->
{
params
}
||=
Bugzilla::Config::
read_param_file
();
$class
->
request_cache
->
{
params
}
||=
Bugzilla::Config::
read_param_file
();
return
$class
->
request_cache
->
{
params
};
}
}
sub
user
{
sub
user
{
my
$class
=
shift
;
return
$_
[
0
]
->
request_cache
->
{
user
}
||=
new
Bugzilla::
User
;
$class
->
request_cache
->
{
user
}
||=
new
Bugzilla::
User
;
return
$class
->
request_cache
->
{
user
};
}
}
sub
set_user
{
sub
set_user
{
...
@@ -291,8 +281,7 @@ sub set_user {
...
@@ -291,8 +281,7 @@ sub set_user {
}
}
sub
sudoer
{
sub
sudoer
{
my
$class
=
shift
;
return
$_
[
0
]
->
request_cache
->
{
sudoer
};
return
$class
->
request_cache
->
{
sudoer
};
}
}
sub
sudo_request
{
sub
sudo_request
{
...
@@ -414,28 +403,20 @@ sub logout_request {
...
@@ -414,28 +403,20 @@ sub logout_request {
}
}
sub
job_queue
{
sub
job_queue
{
my
$class
=
shift
;
require
Bugzilla::
JobQueue
;
require
Bugzilla::
JobQueue
;
$class
->
request_cache
->
{
job_queue
}
||=
Bugzilla::
JobQueue
->
new
();
return
$_
[
0
]
->
request_cache
->
{
job_queue
}
||=
Bugzilla::
JobQueue
->
new
();
return
$class
->
request_cache
->
{
job_queue
};
}
}
sub
dbh
{
sub
dbh
{
my
$class
=
shift
;
# If we're not connected, then we must want the main db
# If we're not connected, then we must want the main db
$class
->
request_cache
->
{
dbh
}
||=
$class
->
dbh_main
;
return
$_
[
0
]
->
request_cache
->
{
dbh
}
||=
$_
[
0
]
->
dbh_main
;
return
$class
->
request_cache
->
{
dbh
};
}
}
sub
dbh_main
{
sub
dbh_main
{
my
$class
=
shift
;
return
$_
[
0
]
->
request_cache
->
{
dbh_main
}
||=
Bugzilla::DB::
connect_main
();
$class
->
request_cache
->
{
dbh_main
}
||=
Bugzilla::DB::
connect_main
();
return
$class
->
request_cache
->
{
dbh_main
};
}
}
sub
languages
{
sub
languages
{
my
$class
=
shift
;
return
Bugzilla::Install::Util::
supported_languages
();
return
Bugzilla::Install::Util::
supported_languages
();
}
}
...
@@ -615,13 +596,8 @@ sub has_flags {
...
@@ -615,13 +596,8 @@ sub has_flags {
}
}
sub
local_timezone
{
sub
local_timezone
{
my
$class
=
shift
;
return
$_
[
0
]
->
request_cache
->
{
local_timezone
}
||=
DateTime::
TimeZone
->
new
(
name
=>
'local'
);
if
(
!
defined
$class
->
request_cache
->
{
local_timezone
})
{
$class
->
request_cache
->
{
local_timezone
}
=
DateTime::
TimeZone
->
new
(
name
=>
'local'
);
}
return
$class
->
request_cache
->
{
local_timezone
};
}
}
# This creates the request cache for non-mod_perl installations.
# This creates the request cache for non-mod_perl installations.
...
...
Bugzilla/Config.pm
View file @
5fc1b86c
...
@@ -13,7 +13,6 @@ use strict;
...
@@ -13,7 +13,6 @@ use strict;
use
base
qw(Exporter)
;
use
base
qw(Exporter)
;
use
Bugzilla::
Constants
;
use
Bugzilla::
Constants
;
use
Bugzilla::
Hook
;
use
Bugzilla::
Hook
;
use
Bugzilla::Install::
Filesystem
qw(fix_file_permissions)
;
use
Data::
Dumper
;
use
Data::
Dumper
;
use
File::
Temp
;
use
File::
Temp
;
...
@@ -279,7 +278,10 @@ sub write_params {
...
@@ -279,7 +278,10 @@ sub write_params {
rename
$tmpname
,
$param_file
rename
$tmpname
,
$param_file
or
die
"Can't rename $tmpname to $param_file: $!"
;
or
die
"Can't rename $tmpname to $param_file: $!"
;
fix_file_permissions
(
$param_file
);
# It's not common to edit parameters and loading
# Bugzilla::Install::Filesystem is slow.
require
Bugzilla::Install::
Filesystem
;
Bugzilla::Install::Filesystem::
fix_file_permissions
(
$param_file
);
# And now we have to reset the params cache so that Bugzilla will re-read
# And now we have to reset the params cache so that Bugzilla will re-read
# them.
# them.
...
...
Bugzilla/Template.pm
View file @
5fc1b86c
...
@@ -562,10 +562,9 @@ $Template::Stash::SCALAR_OPS->{ 0 } =
...
@@ -562,10 +562,9 @@ $Template::Stash::SCALAR_OPS->{ 0 } =
$
Template::Stash::
SCALAR_OPS
->
{
truncate
}
=
$
Template::Stash::
SCALAR_OPS
->
{
truncate
}
=
sub
{
sub
{
my
(
$string
,
$length
,
$ellipsis
)
=
@_
;
my
(
$string
,
$length
,
$ellipsis
)
=
@_
;
$ellipsis
||=
""
;
return
$string
if
!
$length
||
length
(
$string
)
<=
$length
;
return
$string
if
!
$length
||
length
(
$string
)
<=
$length
;
$ellipsis
||=
''
;
my
$strlen
=
$length
-
length
(
$ellipsis
);
my
$strlen
=
$length
-
length
(
$ellipsis
);
my
$newstr
=
substr
(
$string
,
0
,
$strlen
)
.
$ellipsis
;
my
$newstr
=
substr
(
$string
,
0
,
$strlen
)
.
$ellipsis
;
return
$newstr
;
return
$newstr
;
...
...
Bugzilla/Template/Context.pm
View file @
5fc1b86c
...
@@ -84,6 +84,13 @@ sub stash {
...
@@ -84,6 +84,13 @@ sub stash {
return
$stash
;
return
$stash
;
}
}
sub
filter
{
my
(
$self
,
$name
,
$args
)
=
@_
;
# If we pass an alias for the filter name, the filter code is cached
# instead of looking for it at each call.
$self
->
SUPER::
filter
(
$name
,
$args
,
$name
);
}
# We need a DESTROY sub for the same reason that Bugzilla::CGI does.
# We need a DESTROY sub for the same reason that Bugzilla::CGI does.
sub
DESTROY
{
sub
DESTROY
{
my
$self
=
shift
;
my
$self
=
shift
;
...
...
Bugzilla/Util.pm
View file @
5fc1b86c
...
@@ -34,7 +34,6 @@ use Digest;
...
@@ -34,7 +34,6 @@ use Digest;
use
Email::
Address
;
use
Email::
Address
;
use
List::
Util
qw(first)
;
use
List::
Util
qw(first)
;
use
Scalar::
Util
qw(tainted blessed)
;
use
Scalar::
Util
qw(tainted blessed)
;
use
Template::
Filters
;
use
Text::
Wrap
;
use
Text::
Wrap
;
use
Encode
qw(encode decode resolve_alias)
;
use
Encode
qw(encode decode resolve_alias)
;
use
Encode::
Guess
;
use
Encode::
Guess
;
...
@@ -64,7 +63,11 @@ sub detaint_signed {
...
@@ -64,7 +63,11 @@ sub detaint_signed {
# visible strings.
# visible strings.
# Bug 319331: Handle BiDi disruptions.
# Bug 319331: Handle BiDi disruptions.
sub
html_quote
{
sub
html_quote
{
my
(
$var
)
=
Template::Filters::
html_filter
(
@_
);
my
$var
=
shift
;
$var
=~
s/&/&/g
;
$var
=~
s/</</g
;
$var
=~
s/>/>/g
;
$var
=~
s/"/"/g
;
# Obscure '@'.
# Obscure '@'.
$var
=~
s/\@/\@/g
;
$var
=~
s/\@/\@/g
;
if
(
Bugzilla
->
params
->
{
'utf8'
})
{
if
(
Bugzilla
->
params
->
{
'utf8'
})
{
...
@@ -705,10 +708,12 @@ sub get_text {
...
@@ -705,10 +708,12 @@ sub get_text {
sub
template_var
{
sub
template_var
{
my
$name
=
shift
;
my
$name
=
shift
;
my
$
cache
=
Bugzilla
->
request_cache
->
{
util_template_var
}
||=
{}
;
my
$
request_cache
=
Bugzilla
->
request_cache
;
my
$
template
=
Bugzilla
->
template_inner
;
my
$
cache
=
$request_cache
->
{
util_template_var
}
||=
{}
;
my
$lang
=
$
template
->
context
->
{
bz_language
}
;
my
$lang
=
$
request_cache
->
{
template_current_lang
}
->
[
0
]
;
return
$cache
->
{
$lang
}
->
{
$name
}
if
defined
$cache
->
{
$lang
};
return
$cache
->
{
$lang
}
->
{
$name
}
if
defined
$cache
->
{
$lang
};
my
$template
=
Bugzilla
->
template_inner
(
$lang
);
my
%
vars
;
my
%
vars
;
# Note: If we suddenly start needing a lot of template_var variables,
# Note: If we suddenly start needing a lot of template_var variables,
# they should move into their own template, not field-descs.
# they should move into their own template, not field-descs.
...
@@ -722,11 +727,7 @@ sub template_var {
...
@@ -722,11 +727,7 @@ sub template_var {
sub
display_value
{
sub
display_value
{
my
(
$field
,
$value
)
=
@_
;
my
(
$field
,
$value
)
=
@_
;
my
$value_descs
=
template_var
(
'value_descs'
);
return
template_var
(
'value_descs'
)
->
{
$field
}
->
{
$value
}
//
$value
;
if
(
defined
$value_descs
->
{
$field
}
->
{
$value
})
{
return
$value_descs
->
{
$field
}
->
{
$value
};
}
return
$value
;
}
}
sub
disable_utf8
{
sub
disable_utf8
{
...
...
template/en/default/bug/time.html.tmpl
View file @
5fc1b86c
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
# This Source Code Form is "Incompatible With Secondary Licenses", as
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.
# defined by the Mozilla Public License, v. 2.0.
#%]
#%]
[% BLOCK formattimeunit %]
[% BLOCK formattimeunit %]
[%# INTERFACE:
[%# INTERFACE:
# time_unit: the number converting, converts to 2 decimal places
# time_unit: the number converting, converts to 2 decimal places
...
@@ -13,11 +13,7 @@
...
@@ -13,11 +13,7 @@
# 1 decimal place
# 1 decimal place
#%]
#%]
[% time_unit = time_unit FILTER format('%.2f') %]
[% time_unit = time_unit FILTER format('%.2f') %]
[% IF time_unit.match('0\Z') %]
[% time_unit.replace('0\Z', '') %]
[% time_unit FILTER format('%.1f') %]
[% ELSE %]
[% time_unit FILTER format('%.2f') %]
[% END %]
[% END %]
[% END %]
[% BLOCK calculatepercentage %]
[% BLOCK calculatepercentage %]
...
...
template/en/default/filterexceptions.pl
View file @
5fc1b86c
...
@@ -261,8 +261,7 @@
...
@@ -261,8 +261,7 @@
'bug/time.html.tmpl'
=>
[
'bug/time.html.tmpl'
=>
[
'time_unit FILTER format(\'%.1f\')'
,
"time_unit.replace('0\\Z', '')"
,
'time_unit FILTER format(\'%.2f\')'
,
'(act / (act + rem)) * 100
'(act / (act + rem)) * 100
FILTER format("%d")'
,
FILTER format("%d")'
,
],
],
...
...
template/en/default/list/table.html.tmpl
View file @
5fc1b86c
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
[% field_descs.reporter_realname = field_descs.reporter %]
[% field_descs.reporter_realname = field_descs.reporter %]
[% field_descs.qa_contact_realname = field_descs.qa_contact %]
[% field_descs.qa_contact_realname = field_descs.qa_contact %]
[%# Setting maxlength => 0 means no limit. We set it for performance reasons. %]
[% abbrev =
[% abbrev =
{
{
"bug_severity" => { maxlength => 3 , title => "Sev" } ,
"bug_severity" => { maxlength => 3 , title => "Sev" } ,
...
@@ -41,19 +42,19 @@
...
@@ -41,19 +42,19 @@
"qa_contact" => { maxlength => 30 , ellipsis => "..." , title => "QAContact" } ,
"qa_contact" => { maxlength => 30 , ellipsis => "..." , title => "QAContact" } ,
"qa_contact_realname" => { maxlength => 20 , ellipsis => "..." , title => "QAContact" } ,
"qa_contact_realname" => { maxlength => 20 , ellipsis => "..." , title => "QAContact" } ,
"resolution" => { maxlength => 4 } ,
"resolution" => { maxlength => 4 } ,
"short_desc" => { wrap => 1 } ,
"short_desc" => {
maxlength => 0,
wrap => 1 } ,
"short_short_desc" => { maxlength => 60 , ellipsis => "..." , wrap => 1 } ,
"short_short_desc" => { maxlength => 60 , ellipsis => "..." , wrap => 1 } ,
"status_whiteboard" => { title => "Whiteboard" , wrap => 1 } ,
"status_whiteboard" => {
maxlength => 0,
title => "Whiteboard" , wrap => 1 } ,
"keywords" => { wrap => 1 } ,
"keywords" => {
maxlength => 0,
wrap => 1 } ,
"flagtypes.name" => { wrap => 1 } ,
"flagtypes.name" => {
maxlength => 0,
wrap => 1 } ,
"component" => { maxlength => 8 , title => "Comp" } ,
"component" => { maxlength => 8 , title => "Comp" } ,
"product" => { maxlength => 8 } ,
"product" => { maxlength => 8 } ,
"version" => { maxlength => 5 , title => "Vers" } ,
"version" => { maxlength => 5 , title => "Vers" } ,
"op_sys" => { maxlength => 4 } ,
"op_sys" => { maxlength => 4 } ,
"bug_file_loc" => { maxlength => 30 } ,
"bug_file_loc" => { maxlength => 30 } ,
"target_milestone" => { title => "TargetM" } ,
"target_milestone" => {
maxlength => 0,
title => "TargetM" } ,
"longdescs.count" => { title => "# Comments" },
"longdescs.count" => {
maxlength => 0,
title => "# Comments" },
"percentage_complete" => { format_value => "%d %%" } ,
"percentage_complete" => {
maxlength => 0,
format_value => "%d %%" } ,
}
}
%]
%]
...
@@ -137,13 +138,13 @@
...
@@ -137,13 +138,13 @@
[% END %]
[% END %]
[% BLOCK order_arrow %]
[% BLOCK order_arrow %]
[% IF order.
mat
ch("^$id DESC") %]
[% IF order.
sear
ch("^$id DESC") %]
<span class="bz_sort_order_primary">▼</span>
<span class="bz_sort_order_primary">▼</span>
[% ELSIF order.
mat
ch("^$id(,\\s*|\$)") %]
[% ELSIF order.
sear
ch("^$id(,\\s*|\$)") %]
<span class="bz_sort_order_primary">▲</span>
<span class="bz_sort_order_primary">▲</span>
[% ELSIF order.
mat
ch("\\b$id DESC") %]
[% ELSIF order.
sear
ch("\\b$id DESC") %]
<span class="bz_sort_order_secondary">▼</span>
<span class="bz_sort_order_secondary">▼</span>
[% ELSIF order.
mat
ch("\\b$id(,\\s*|\$)") %]
[% ELSIF order.
sear
ch("\\b$id(,\\s*|\$)") %]
<span class="bz_sort_order_secondary">▲</span>
<span class="bz_sort_order_secondary">▲</span>
[% END %]
[% END %]
[% END %]
[% END %]
...
@@ -178,41 +179,41 @@
...
@@ -178,41 +179,41 @@
</td>
</td>
[% FOREACH column = displaycolumns %]
[% FOREACH column = displaycolumns %]
<td [% 'style="white-space: nowrap"' IF NOT abbrev.$column.wrap %]
[% col_abbrev = abbrev.$column %]
<td [% 'style="white-space: nowrap"' IF NOT col_abbrev.wrap %]
class="bz_[% column FILTER css_class_quote %]_column">
class="bz_[% column FILTER css_class_quote %]_column">
[% IF
abbrev.$column
.maxlength %]
[% IF
col_abbrev
.maxlength %]
<span title="[%- display_value(column, bug.$column) FILTER html %]">
<span title="[%- display_value(column, bug.$column) FILTER html %]">
[% END %]
[% END %]
[% IF
abbrev.$column.format_value %]
[% IF
col_abbrev.format_value %]
[%- bug.$column FILTER format(
abbrev.$column.format_value) FILTER html -%]
[%- bug.$column FILTER format(
col_abbrev.format_value) FILTER html -%]
[% ELSIF column == 'actual_time' ||
[% ELSIF column == 'actual_time' ||
column == 'remaining_time' ||
column == 'remaining_time' ||
column == 'estimated_time' %]
column == 'estimated_time' %]
[% PROCESS formattimeunit time_unit=bug.$column %]
[% PROCESS formattimeunit time_unit=bug.$column %]
[%# Display the login name of the user if their real name is empty. %]
[%# Display the login name of the user if their real name is empty. %]
[% ELSIF column.
mat
ch('_realname$') && bug.$column == '' %]
[% ELSIF column.
sear
ch('_realname$') && bug.$column == '' %]
[% SET login_column = column.remove('_realname$') %]
[% SET login_column = column.remove('_realname$') %]
[% bug.${login_column}.truncate(
abbrev.$column.maxlength,
[% bug.${login_column}.truncate(
col_abbrev.maxlength,
abbrev.$column
.ellipsis) FILTER html %]
col_abbrev
.ellipsis) FILTER html %]
[% ELSIF column == 'short_desc' || column == "short_short_desc" %]
[% ELSIF column == 'short_desc' || column == "short_short_desc" %]
<a href="show_bug.cgi?id=[% bug.bug_id FILTER html %]">
<a href="show_bug.cgi?id=[% bug.bug_id FILTER html %]">
[%- bug.$column.truncate(
abbrev.$column.maxlength, abbrev.$column
.ellipsis) FILTER html -%]
[%- bug.$column.truncate(
col_abbrev.maxlength, col_abbrev
.ellipsis) FILTER html -%]
</a>
</a>
[% ELSE %]
[% ELSE %]
[%- display_value(column, bug.$column).truncate(
abbrev.$column.maxlength, abbrev.$column
.ellipsis) FILTER html -%]
[%- display_value(column, bug.$column).truncate(
col_abbrev.maxlength, col_abbrev
.ellipsis) FILTER html -%]
[% END %]
[% END %]
[% IF
abbrev.$column
.maxlength %]
[% IF
col_abbrev
.maxlength %]
</span>
</span>
[% END %]
[% END %]
</td>
</td>
[% END %]
[% END %]
</tr>
</tr>
[% END %]
[% IF loop.last() && time_info.time_present == 1 %]
[% IF time_info.time_present %]
[% PROCESS time_summary_line %]
[% PROCESS time_summary_line %]
[% END %]
[% END %]
[% END %]
</table>
</table>
...
...
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