From b0935c1e52eea1dfc70652bf6fcb7c8b856a8826 Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Sun, 8 Apr 2018 06:57:06 +0300 Subject: Bug 1446236 - Add & use simpler method to check if an extension is present (#35) --- Bugzilla/Search.pm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index 643d591ca..e15c60f7f 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -34,7 +34,6 @@ use Date::Format; use Date::Parse; use Scalar::Util qw(blessed); use List::MoreUtils qw(all firstidx part uniq); -use List::Util qw(any); use POSIX qw(INT_MAX); use Storable qw(dclone); use Time::HiRes qw(gettimeofday tv_interval); @@ -803,8 +802,7 @@ sub data { # 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. - state $have_tracking_flags = any { $_->NAME eq 'TrackingFlags' } @{ Bugzilla->extensions }; - if ($have_tracking_flags) { + if (Bugzilla->has_extension('TrackingFlags')) { my %tf_map = map { $_ => 1 } Bugzilla::Extension::TrackingFlags::Flag->get_all_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 @@ -867,7 +865,7 @@ sub data { $self->{data} = [map { $data{$_} } @$bug_ids]; # BMO - get tracking flags values, and insert into result - if ($have_tracking_flags && @{ $self->{tracking_flags} }) { + if (Bugzilla->has_extension('TrackingFlags') && @{ $self->{tracking_flags} }) { # read values my $values; $sql = " -- cgit v1.2.3-24-g4f1b