summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan Hardison <dylan@mozilla.com>2016-06-30 21:19:00 +0200
committerDylan Hardison <dylan@mozilla.com>2016-06-30 21:19:00 +0200
commit8920445cb25111f5748b3713ca59e8e549d6cb08 (patch)
tree762dd9871ea977c3d5acf9543864758015fc67ce
parent584670c0f713744afc143593e3b810da6a5f6925 (diff)
downloadbugzilla-8920445cb25111f5748b3713ca59e8e549d6cb08.tar.gz
bugzilla-8920445cb25111f5748b3713ca59e8e549d6cb08.tar.xz
Bug 1283310 - Optimizations for Bugzilla::active_custom_fields()
-rw-r--r--Bugzilla.pm4
-rw-r--r--Bugzilla/Bug.pm10
-rw-r--r--Bugzilla/Field.pm3
-rw-r--r--extensions/TrackingFlags/Extension.pm1
4 files changed, 10 insertions, 8 deletions
diff --git a/Bugzilla.pm b/Bugzilla.pm
index 0f513aed6..4f80a2ed4 100644
--- a/Bugzilla.pm
+++ b/Bugzilla.pm
@@ -710,10 +710,10 @@ sub active_custom_fields {
if ($params) {
$cache_id .= ($params->{product} ? '_p' . $params->{product}->id : '') .
($params->{component} ? '_c' . $params->{component}->id : '');
+ $cache_id .= ':noext' if $params->{skip_extensions};
}
if (!exists $class->request_cache->{$cache_id}) {
- my $fields = Bugzilla::Field->match({ custom => 1, obsolete => 0});
- @$fields = grep($_->type ne FIELD_TYPE_EXTENSION, @$fields);
+ my $fields = Bugzilla::Field->match({ custom => 1, obsolete => 0, skip_extensions => 1 });
Bugzilla::Hook::process('active_custom_fields',
{ fields => \$fields, params => $params });
$class->request_cache->{$cache_id} = $fields;
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index 73dc98963..09696f97b 100644
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -83,9 +83,8 @@ use constant USE_MEMCACHED => 0;
# This is a sub because it needs to call other subroutines.
sub DB_COLUMNS {
my $dbh = Bugzilla->dbh;
- my @custom = grep {$_->type != FIELD_TYPE_MULTI_SELECT
- && $_->type != FIELD_TYPE_EXTENSION}
- Bugzilla->active_custom_fields;
+ my @custom = grep {$_->type != FIELD_TYPE_MULTI_SELECT }
+ Bugzilla->active_custom_fields({skip_extensions => 1});
my @custom_names = map {$_->name} @custom;
my @columns = (qw(
@@ -221,9 +220,8 @@ sub VALIDATOR_DEPENDENCIES {
};
sub UPDATE_COLUMNS {
- my @custom = grep {$_->type != FIELD_TYPE_MULTI_SELECT
- && $_->type != FIELD_TYPE_EXTENSION}
- Bugzilla->active_custom_fields;
+ my @custom = grep {$_->type != FIELD_TYPE_MULTI_SELECT }
+ Bugzilla->active_custom_fields({skip_extensions => 1});
my @custom_names = map {$_->name} @custom;
my @columns = qw(
alias
diff --git a/Bugzilla/Field.pm b/Bugzilla/Field.pm
index ea93327ad..0a0c7b15f 100644
--- a/Bugzilla/Field.pm
+++ b/Bugzilla/Field.pm
@@ -288,6 +288,9 @@ sub match {
if (delete $params->{is_select}) {
$params->{type} = [FIELD_TYPE_SINGLE_SELECT, FIELD_TYPE_MULTI_SELECT];
}
+ if (delete $params->{skip_extensions}) {
+ $params->{WHERE}{'type != ?'} = FIELD_TYPE_EXTENSION;
+ }
return $self->SUPER::match(@_);
}
diff --git a/extensions/TrackingFlags/Extension.pm b/extensions/TrackingFlags/Extension.pm
index 33792dc38..b150faea2 100644
--- a/extensions/TrackingFlags/Extension.pm
+++ b/extensions/TrackingFlags/Extension.pm
@@ -409,6 +409,7 @@ sub active_custom_fields {
my $product = $params->{'product'};
my $component = $params->{'component'};
+ return if $params->{skip_extensions};
# Create a hash of current fields based on field names
my %field_hash = map { $_->name => $_ } @$$fields;