summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2014-02-25 07:31:55 +0100
committerByron Jones <bjones@mozilla.com>2014-02-25 07:31:55 +0100
commitab86aba0236ca96d58d75b839c003f093a12a297 (patch)
tree5b672f901931cce0dc02c402f2bb5c08e20d27d4 /contrib
parent0e67941defa509229a33b3b20d2ff2660f8728cb (diff)
downloadbugzilla-ab86aba0236ca96d58d75b839c003f093a12a297.tar.gz
bugzilla-ab86aba0236ca96d58d75b839c003f093a12a297.tar.xz
Bug 975943: add special support for a "deleted" comment tag
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/sanitizeme.pl17
1 files changed, 17 insertions, 0 deletions
diff --git a/contrib/sanitizeme.pl b/contrib/sanitizeme.pl
index 7033006dd..28c2f38f2 100755
--- a/contrib/sanitizeme.pl
+++ b/contrib/sanitizeme.pl
@@ -27,8 +27,10 @@ use strict;
use lib qw(.);
use Bugzilla;
+use Bugzilla::Bug;
use Bugzilla::Constants;
use Bugzilla::Util;
+use List::MoreUtils qw(uniq);
use Getopt::Long;
@@ -79,6 +81,7 @@ if ($dry_run) {
eval {
delete_non_public_products();
delete_secure_bugs();
+ delete_deleted_comments();
delete_insider_comments() unless $keep_insider;
delete_security_groups();
delete_sensitive_user_data();
@@ -129,6 +132,20 @@ sub delete_secure_bugs {
print "\rDone \n" unless $from_cron;
}
+sub delete_deleted_comments {
+ # Delete all comments tagged as 'deleted'
+ my $comment_ids = $dbh->selectcol_arrayref("SELECT comment_id FROM longdescs_tags WHERE tag='deleted'");
+ return unless @$comment_ids;
+ print "Deleting 'deleted' comments...\n";
+ my @bug_ids = uniq @{
+ $dbh->selectcol_arrayref("SELECT bug_id FROM longdescs WHERE comment_id IN (" . join(',', @$comment_ids) . ")")
+ };
+ $dbh->do("DELETE FROM longdescs WHERE comment_id IN (" . join(',', @$comment_ids) . ")");
+ foreach my $bug_id (@bug_ids) {
+ Bugzilla::Bug->new($bug_id)->_sync_fulltext(update_comments => 1);
+ }
+}
+
sub delete_insider_comments {
# Delete all 'insidergroup' comments and attachments
print "Deleting 'insidergroup' comments and attachments...\n";