summaryrefslogtreecommitdiffstats
path: root/sanitycheck.cgi
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 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) {