summaryrefslogtreecommitdiffstats
path: root/scripts/delete_comments_csv.pl
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/delete_comments_csv.pl')
-rwxr-xr-xscripts/delete_comments_csv.pl33
1 files changed, 17 insertions, 16 deletions
diff --git a/scripts/delete_comments_csv.pl b/scripts/delete_comments_csv.pl
index 5e3c0c3df..826c92d1d 100755
--- a/scripts/delete_comments_csv.pl
+++ b/scripts/delete_comments_csv.pl
@@ -19,7 +19,7 @@ use Text::CSV_XS;
Bugzilla->usage_mode(USAGE_MODE_CMDLINE);
-my $auto_user = Bugzilla::User->check({ name => 'automation@bmo.tld' });
+my $auto_user = Bugzilla::User->check({name => 'automation@bmo.tld'});
Bugzilla->set_user($auto_user);
my $dbh = Bugzilla->dbh;
@@ -33,21 +33,22 @@ $dbh->bz_start_transaction;
my $csv = Text::CSV_XS->new();
while (my $line = <CSV>) {
- $csv->parse($line);
- my @values = $csv->fields();
- next if !@values;
- my ($bug_id, $comment_id) = @values;
- next if $bug_id !~ /^\d+$/;
- print "Deleting comment '$comment_id' from bug '$bug_id' ";
- my $bug = Bugzilla::Bug->check({ id => $bug_id });
- my $comment = Bugzilla::Comment->new($comment_id);
- if (!$comment || $comment->bug_id ne $bug_id) {
- print "... commment '$comment_id' does not exist ... skipping.\n";
- next;
- }
- $comment->remove_from_db();
- $bug->_sync_fulltext( update_comments => 1 );
- print "... done.\n";
+ $csv->parse($line);
+ my @values = $csv->fields();
+ next if !@values;
+ my ($bug_id, $comment_id) = @values;
+ next if $bug_id !~ /^\d+$/;
+ print "Deleting comment '$comment_id' from bug '$bug_id' ";
+ my $bug = Bugzilla::Bug->check({id => $bug_id});
+ my $comment = Bugzilla::Comment->new($comment_id);
+
+ if (!$comment || $comment->bug_id ne $bug_id) {
+ print "... commment '$comment_id' does not exist ... skipping.\n";
+ next;
+ }
+ $comment->remove_from_db();
+ $bug->_sync_fulltext(update_comments => 1);
+ print "... done.\n";
}
$dbh->bz_commit_transaction;