diff options
author | Byron Jones <bjones@mozilla.com> | 2014-03-04 08:50:54 +0100 |
---|---|---|
committer | Byron Jones <bjones@mozilla.com> | 2014-03-04 08:50:54 +0100 |
commit | 9193214274889f2b7636146e72d8200e9bfaeb7b (patch) | |
tree | e570cc86aa8df53dd0e7e9d902d88450c5dc25c7 /sanitycheck.cgi | |
parent | 75eaf0d6c8ecf764d73cb870e504e84826d44751 (diff) | |
download | bugzilla-9193214274889f2b7636146e72d8200e9bfaeb7b.tar.gz bugzilla-9193214274889f2b7636146e72d8200e9bfaeb7b.tar.xz |
Bug 966180: backport bug 956233 to bmo (enable USE_MEMCACHE on most objects)
Diffstat (limited to 'sanitycheck.cgi')
-rwxr-xr-x | sanitycheck.cgi | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/sanitycheck.cgi b/sanitycheck.cgi index 36751d821..f718312f4 100755 --- a/sanitycheck.cgi +++ b/sanitycheck.cgi @@ -91,6 +91,7 @@ else { } } my $vars = {}; +my $clear_memcached = 0; print $cgi->header() unless Bugzilla->usage_mode == USAGE_MODE_CMDLINE; @@ -167,6 +168,7 @@ if ($cgi->param('createmissinggroupcontrolmapentries')) { } Status('group_control_map_entries_repaired', {counter => $counter}); + $clear_memcached = 1 if $counter; } ########################################################################### @@ -193,6 +195,7 @@ if ($cgi->param('repair_creation_date')) { $sth_UpdateDate->execute($date, $bugid); } Status('bug_creation_date_fixed', {bug_count => scalar(@$bug_ids)}); + $clear_memcached = 1 if @$bug_ids; } ########################################################################### @@ -209,6 +212,7 @@ if ($cgi->param('repair_everconfirmed')) { $dbh->do("UPDATE bugs SET everconfirmed = 1 WHERE bug_status IN ($confirmed_open_states)"); Status('everconfirmed_end'); + $clear_memcached = 1; } ########################################################################### @@ -224,11 +228,12 @@ if ($cgi->param('repair_bugs_fulltext')) { ON bugs_fulltext.bug_id = bugs.bug_id WHERE bugs_fulltext.bug_id IS NULL'); - foreach my $bugid (@$bug_ids) { - Bugzilla::Bug->new($bugid)->_sync_fulltext( new_bug => 1 ); - } + foreach my $bugid (@$bug_ids) { + Bugzilla::Bug->new($bugid)->_sync_fulltext( new_bug => 1 ); + } - Status('bugs_fulltext_fixed', {bug_count => scalar(@$bug_ids)}); + Status('bugs_fulltext_fixed', {bug_count => scalar(@$bug_ids)}); + $clear_memcached = 1 if @$bug_ids; } ########################################################################### @@ -264,7 +269,10 @@ if ($cgi->param('rescanallBugMail')) { Bugzilla::BugMail::Send($bugid, $vars); } - Status('send_bugmail_end') if scalar(@$list); + if (@$list) { + Status('send_bugmail_end'); + Bugzilla->memcached->clear_all(); + } unless (Bugzilla->usage_mode == USAGE_MODE_CMDLINE) { $template->process('global/footer.html.tmpl', $vars) @@ -298,6 +306,7 @@ if ($cgi->param('remove_invalid_bug_references')) { if (scalar(@$bug_ids)) { $dbh->do("DELETE FROM $table WHERE $field IN (" . join(',', @$bug_ids) . ")"); + $clear_memcached = 1; } } @@ -328,6 +337,7 @@ if ($cgi->param('remove_invalid_attach_references')) { $dbh->bz_commit_transaction(); Status('attachment_reference_deletion_end'); + $clear_memcached = 1 if @$attach_ids; } ########################################################################### @@ -354,12 +364,17 @@ if ($cgi->param('remove_old_whine_targets')) { $dbh->do("DELETE FROM whine_schedules WHERE mailto_type = $type AND mailto IN (" . join(',', @$old_ids) . ")"); + $clear_memcached = 1; } } $dbh->bz_commit_transaction(); Status('whines_obsolete_target_deletion_end'); } +# If any repairs were attempted or made, we need to clear memcached to ensure +# state is consistent. +Bugzilla->memcached->clear_all() if $clear_memcached; + ########################################################################### # Repair hook ########################################################################### @@ -735,6 +750,7 @@ if (scalar(@invalid_flags)) { # Silently delete these flags, with no notification to requesters/setters. $dbh->do('DELETE FROM flags WHERE id IN (' . join(',', @flag_ids) .')'); Status('flag_deletion_end'); + Bugzilla->memcached->clear_all(); } else { foreach my $flag (@$invalid_flags) { |