diff options
author | Perl Tidy <perltidy@bugzilla.org> | 2018-12-05 21:38:52 +0100 |
---|---|---|
committer | Dylan William Hardison <dylan@hardison.net> | 2018-12-05 23:49:08 +0100 |
commit | 8ec8da0491ad89604700b3e29a227966f6d84ba1 (patch) | |
tree | 9d270f173330ca19700e0ba9f2ee931300646de1 /scripts/delete_comments_csv.pl | |
parent | a7bb5a65b71644d9efce5fed783ed545b9336548 (diff) | |
download | bugzilla-8ec8da0491ad89604700b3e29a227966f6d84ba1.tar.gz bugzilla-8ec8da0491ad89604700b3e29a227966f6d84ba1.tar.xz |
no bug - reformat all the code using the new perltidy rules
Diffstat (limited to 'scripts/delete_comments_csv.pl')
-rwxr-xr-x | scripts/delete_comments_csv.pl | 33 |
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; |