Skip to content

Commit

Permalink
Clean up duplicated query call
Browse files Browse the repository at this point in the history
Move the call to `file_get_visible_attachments()` outside of the loop,
to avoid duplicated database queries.

Fixes: #26167
  • Loading branch information
cproensa authored and dregad committed Sep 27, 2019
1 parent 668a9b1 commit 1436e53
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api/soap/mc_issue_api.php
Expand Up @@ -109,6 +109,8 @@ function mci_issue_get_history( $p_issue_id, $p_user_id, $p_lang ) {

$t_history = array();

$t_files = file_get_visible_attachments( $p_issue_id );

foreach( $t_history_rows as $t_history_row ) {
$t_type = (int)$t_history_row['type'];

Expand Down Expand Up @@ -204,8 +206,6 @@ function mci_issue_get_history( $p_issue_id, $p_user_id, $p_lang ) {
break;
}

$t_files = file_get_visible_attachments( $p_issue_id );

$fn_process_value = function( $p_issue_id, $p_type, $p_field, $p_value, $p_lang, $p_new_value ) use ( $t_files ) {
if( is_blank( $p_value ) ) {
return '';
Expand Down

0 comments on commit 1436e53

Please sign in to comment.