From 1436e536cbc5603e1fe88b08582290cf1b422736 Mon Sep 17 00:00:00 2001 From: Carlos Proensa Date: Sun, 22 Sep 2019 02:21:09 +0200 Subject: [PATCH] Clean up duplicated query call Move the call to `file_get_visible_attachments()` outside of the loop, to avoid duplicated database queries. Fixes: #26167 --- api/soap/mc_issue_api.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/soap/mc_issue_api.php b/api/soap/mc_issue_api.php index 34c038ebd4..3b15983d7e 100644 --- a/api/soap/mc_issue_api.php +++ b/api/soap/mc_issue_api.php @@ -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']; @@ -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 '';