# BMO - to avoid massive amounts of joins, if we're selecting a lot of
# tracking flags, replace them with placeholders. the values will be
# retrieved later and injected into the result.
- my %tf_map
- = map { $_ => 1 } Bugzilla::Extension::TrackingFlags::Flag->get_all_names();
+ my %tf_map = map { $_ => 1 } Bugzilla->tracking_flag_names;
my @tf_selected = grep { exists $tf_map{$_} } @orig_fields;
# mysql has a limit of 61 joins, and we want to avoid massive amounts of joins
}
sub _tracking_flag_names {
- return Bugzilla::Extension::TrackingFlags::Flag->get_all_names();
+ my ($class) = @_;
+ my $memcached = $class->memcached;
+ my $cache = $class->request_cache;
+ my $tf_names = $cache->{tracking_flags_names};
+
+ return @$tf_names if $tf_names;
+ $tf_names //= $memcached->get_config({key => 'tracking_flag_names'});
+ $tf_names //= Bugzilla->dbh->selectcol_arrayref(
+ "SELECT name FROM tracking_flags ORDER BY name");
+
+ $cache->{tracking_flags_names} = $tf_names;
+
+ return @$tf_names;
}
sub page_before_template {
values %{$cache->{'tracking_flags'}};
}
-# avoids the overhead of pre-loading if just the field names are required
-sub get_all_names {
- my $self = shift;
- my $cache = Bugzilla->request_cache;
- if (!exists $cache->{'tracking_flags_names'}) {
- $cache->{'tracking_flags_names'} = Bugzilla->dbh->selectcol_arrayref(
- "SELECT name FROM tracking_flags ORDER BY name");
- }
- return @{$cache->{'tracking_flags_names'}};
-}
-
sub remove_from_db {
my $self = shift;
my $dbh = Bugzilla->dbh;