Skip to content

Commit

Permalink
Fix #11528: Don't call config_flush_cache() in bug_actiongroup_ext.php
Browse files Browse the repository at this point in the history
There is no need to call config_flush_cache() in bug_actiongroup_ext.php
because the configuration cache already takes into account whether a
configuration setting is per-user and per-project.

Additionally, bug_actiongroup_ext.php has been cleaned up to reduce code
complexity and increase the efficiency of this page.
  • Loading branch information
davidhicks committed Feb 20, 2010
1 parent 313ea5f commit 99c5561
Showing 1 changed file with 8 additions and 30 deletions.
38 changes: 8 additions & 30 deletions bug_actiongroup_ext.php
Expand Up @@ -76,48 +76,26 @@

$t_failed_ids = array();

# validate all bugs before we start the processing, we may fail the whole action
# group, or some of the bugs.
foreach( $t_projects_bugs as $t_project_id => $t_bug_ids ) {
if ( $t_bug->project_id != helper_get_current_project() ) {
# in case the current project is not the same project of the bug we are viewing...
# ... override the current project. This to avoid problems with categories and handlers lists etc.
$g_project_override = $t_bug->project_id;
/** @todo (thraxisp) the next line goes away if the cache was smarter and used project */
config_flush_cache(); # flush the config cache so that configs are refetched
}

foreach( $t_bug_ids as $t_bug_id ) {
foreach( $t_projects_bugs as $t_project_id => $t_bugs ) {
$g_project_override = $t_project_id;
foreach( $t_bugs as $t_bug_id ) {
$t_result = bug_group_action_validate( $f_action, $t_bug_id );
if ( $t_result !== true ) {
if( $t_result !== true ) {
foreach( $t_result as $t_key => $t_value ) {
$t_failed_ids[$t_key] = $t_value;
}
}
}
}

// process bugs that are not already failed by validation.
foreach( $t_projects_bugs as $t_project_id => $t_bug_ids ) {
if ( $t_bug->project_id != helper_get_current_project() ) {
// in case the current project is not the same project of the bug we are viewing...
// ... override the current project. This to avoid problems with categories and handlers lists etc.
$g_project_override = $t_bug->project_id;
/** @todo (thraxisp) the next line goes away if the cache was smarter and used project */
config_flush_cache(); // flush the config cache so that configs are refetched
}

foreach( $t_bug_ids as $t_bug_id ) {
# do not process this bug if validation failed for it.
if ( !isset( $t_failed_ids[$t_bug_id] ) ) {
if( !isset( $t_failed_ids[$t_bug_id] ) ) {
$t_result = bug_group_action_process( $f_action, $t_bug_id );
if ( $t_result !== true ) {
if( $t_result !== true ) {
$t_failed_ids[] = $t_result;
}
}
}
}

$g_project_override = null;

form_security_purge( $t_form_name );

if ( count( $t_failed_ids ) > 0 ) {
Expand Down

0 comments on commit 99c5561

Please sign in to comment.