Skip to content

Commit

Permalink
Cache reporter user data in view_all_bug_page
Browse files Browse the repository at this point in the history
Add the reporter id to the array of users to be cached from the bug
filter result.  This saves later individual sql queries from
user_cache_row()

Changed the temporary arrays to be associative indexed by id, so we
don't need to call 'array_unqiue' later.

Fixes #20258

Signed-off-by: Damien Regad <dregad@mantisbt.org>
  • Loading branch information
cproensa authored and dregad committed Dec 9, 2015
1 parent 47c512f commit 7f997e8
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions view_all_bug_page.php
Expand Up @@ -74,17 +74,19 @@
}

$t_bugslist = array();
$t_users_handlers = array();
$t_project_ids = array();
$t_unique_user_ids = array();
$t_unique_project_ids = array();
$t_row_count = count( $t_rows );
for( $i=0; $i < $t_row_count; $i++ ) {
array_push( $t_bugslist, $t_rows[$i]->id );
$t_users_handlers[] = $t_rows[$i]->handler_id;
$t_project_ids[] = $t_rows[$i]->project_id;
$t_handler_id = $t_rows[$i]->handler_id;
$t_unique_user_ids[$t_handler_id] = $t_handler_id;
$t_reporter_id = $t_rows[$i]->reporter_id;
$t_unique_user_ids[$t_reporter_id] = $t_reporter_id;
$t_project_id = $t_rows[$i]->project_id;
$t_unique_project_ids[$t_project_id] = $t_project_id;
}
$t_unique_users_handlers = array_unique( $t_users_handlers );
$t_unique_project_ids = array_unique( $t_project_ids );
user_cache_array_rows( $t_unique_users_handlers );
user_cache_array_rows( $t_unique_user_ids );
project_cache_array_rows( $t_unique_project_ids );

gpc_set_cookie( config_get( 'bug_list_cookie' ), implode( ',', $t_bugslist ) );
Expand Down

0 comments on commit 7f997e8

Please sign in to comment.