diff options
author | lpsolit%gmail.com <> | 2008-09-08 23:21:24 +0200 |
---|---|---|
committer | lpsolit%gmail.com <> | 2008-09-08 23:21:24 +0200 |
commit | 4dd427ea99673391d923db9682836d344f178b54 (patch) | |
tree | 15cac366546a970dfbe8a0ed7163976f09dfbfb2 /attachment.cgi | |
parent | 1d66aab134be7002268c4da177bbf4870ac90d6d (diff) | |
download | bugzilla-4dd427ea99673391d923db9682836d344f178b54.tar.gz bugzilla-4dd427ea99673391d923db9682836d344f178b54.tar.xz |
Bug 453743: Decrease the number of calls to the DB about flags when viewing a bug - Patch by Frédéric Buclin <LpSolit@gmail.com> r/a=mkanat
Diffstat (limited to 'attachment.cgi')
-rwxr-xr-x | attachment.cgi | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/attachment.cgi b/attachment.cgi index c28a300a0..4f3dabd55 100755 --- a/attachment.cgi +++ b/attachment.cgi @@ -435,32 +435,14 @@ sub insert { # Validations are done later when the user submits changes. sub edit { my $attachment = validateID(); - my $dbh = Bugzilla->dbh; - # Retrieve a list of attachments for this bug as well as a summary of the bug - # to use in a navigation bar across the top of the screen. my $bugattachments = Bugzilla::Attachment->get_attachments_by_bug($attachment->bug_id); # We only want attachment IDs. @$bugattachments = map { $_->id } @$bugattachments; - my ($bugsummary, $product_id, $component_id) = - $dbh->selectrow_array('SELECT short_desc, product_id, component_id - FROM bugs - WHERE bug_id = ?', undef, $attachment->bug_id); - - # Get a list of flag types that can be set for this attachment. - my $flag_types = Bugzilla::FlagType::match({ 'target_type' => 'attachment' , - 'product_id' => $product_id , - 'component_id' => $component_id }); - foreach my $flag_type (@$flag_types) { - $flag_type->{'flags'} = Bugzilla::Flag->match({ 'type_id' => $flag_type->id, - 'attach_id' => $attachment->id }); - } - $vars->{'flag_types'} = $flag_types; - $vars->{'any_flags_requesteeble'} = grep($_->is_requesteeble, @$flag_types); + $vars->{'any_flags_requesteeble'} = grep($_->is_requesteeble, @{$attachment->flag_types}); $vars->{'attachment'} = $attachment; - $vars->{'bugsummary'} = $bugsummary; $vars->{'attachments'} = $bugattachments; print $cgi->header(); |