View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0023904 | mantisbt | performance | public | 2018-01-28 12:18 | 2019-03-16 20:20 |
Reporter | bcuesta | Assigned To | cproensa | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 2.2.0 | ||||
Target Version | 2.20.0 | Fixed in Version | 2.20.0 | ||
Summary | 0023904: Massive queries to user table in edit project | ||||
Description | Entering edit project page (manage_proj_edit_page.php) launch a sql for each user assigned to the project for getting email. In private projects with many users assigned, this cause performance problems. | ||||
Tags | No tags attached. | ||||
Attached Files | |||||
I suggest apply the attachment patch. I revolved the problem with it. fix_projedit_massivequeries_1.0.0.diff (1,748 bytes)
diff --git a/mantisbt/2.2.0/core/project_api.php b/mantisbt/2.2.0/core/project_api.php index bf42e9a..4a97e91 100644 --- a/mantisbt/2.2.0/core/project_api.php +++ b/mantisbt/2.2.0/core/project_api.php @@ -703,7 +703,7 @@ function project_get_all_user_rows( $p_project_id = ALL_PROJECTS, $p_access_leve if( $p_include_global_users ) { db_param_push(); - $t_query = 'SELECT id, username, realname, access_level + $t_query = 'SELECT id, username, realname, access_level, email FROM {user} WHERE enabled = ' . db_param() . ' AND access_level ' . $t_global_access_clause; @@ -717,7 +717,7 @@ function project_get_all_user_rows( $p_project_id = ALL_PROJECTS, $p_access_leve if( $c_project_id != ALL_PROJECTS ) { # Get the project overrides db_param_push(); - $t_query = 'SELECT u.id, u.username, u.realname, l.access_level + $t_query = 'SELECT u.id, u.username, u.realname, l.access_level, u.email FROM {project_user_list} l, {user} u WHERE l.user_id = u.id AND u.enabled = ' . db_param() . ' diff --git a/mantisbt/2.2.0/manage_proj_edit_page.php b/mantisbt/2.2.0/manage_proj_edit_page.php index 309b41c..1928f41 100644 --- a/mantisbt/2.2.0/manage_proj_edit_page.php +++ b/mantisbt/2.2.0/manage_proj_edit_page.php @@ -768,8 +768,9 @@ event_signal( 'EVENT_MANAGE_PROJECT_PAGE', array( $f_project_id ) ); </td> <td> <?php - $t_email = user_get_email( $t_user['id'] ); - print_email_link( $t_email, $t_email ); + // FIXED: Evitar consulta masiva innecesaria + // $t_email = user_get_email( $t_user['id'] ); + print_email_link( $t_user['email'], $t_user['email'] ); ?> </td> <td><?php echo get_enum_element( 'access_levels', $t_user['access_level'] ) ?></td> |
|