Skip to content

Commit

Permalink
Improve sql performance print_project_option_list
Browse files Browse the repository at this point in the history
Cache subprojects before processing them to reduce the number of SQL
queries executed.

Previously, only first level projects got cached, resulting in repeated
queries (one for each project).

Fixes #20139

Signed-off-by: Damien Regad <dregad@mantisbt.org>
  • Loading branch information
cproensa authored and dregad committed Dec 20, 2015
1 parent 4ac4237 commit 770df68
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions core/print_api.php
Expand Up @@ -617,6 +617,7 @@ function print_subproject_option_list( $p_parent_id, $p_project_id = null, $p_fi
array_push( $p_parents, $p_parent_id );
$t_user_id = auth_get_current_user_id();
$t_project_ids = user_get_accessible_subprojects( $t_user_id, $p_parent_id );
project_cache_array_rows( $t_project_ids );
$t_can_report = true;

foreach( $t_project_ids as $t_id ) {
Expand Down

0 comments on commit 770df68

Please sign in to comment.