aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sanitycheck.cgi')
-rwxr-xr-xsanitycheck.cgi26
1 files changed, 21 insertions, 5 deletions
diff --git a/sanitycheck.cgi b/sanitycheck.cgi
index 256438bd8..2f87fb828 100755
--- a/sanitycheck.cgi
+++ b/sanitycheck.cgi
@@ -73,6 +73,7 @@ else {
}
}
my $vars = {};
+my $clear_memcached = 0;
print $cgi->header() unless Bugzilla->usage_mode == USAGE_MODE_CMDLINE;
@@ -149,6 +150,7 @@ if ($cgi->param('createmissinggroupcontrolmapentries')) {
}
Status('group_control_map_entries_repaired', {counter => $counter});
+ $clear_memcached = 1 if $counter;
}
###########################################################################
@@ -175,6 +177,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;
}
###########################################################################
@@ -191,6 +194,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;
}
###########################################################################
@@ -206,11 +210,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;
}
###########################################################################
@@ -246,7 +251,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)
@@ -280,6 +288,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;
}
}
@@ -310,6 +319,7 @@ if ($cgi->param('remove_invalid_attach_references')) {
$dbh->bz_commit_transaction();
Status('attachment_reference_deletion_end');
+ $clear_memcached = 1 if @$attach_ids;
}
###########################################################################
@@ -336,12 +346,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
###########################################################################
@@ -717,6 +732,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) {