diff options
author | David Lawrence <dkl@mozilla.com> | 2016-09-01 21:20:42 +0200 |
---|---|---|
committer | David Lawrence <dkl@mozilla.com> | 2016-09-01 21:20:42 +0200 |
commit | bb40800f890ac0b4f448eed5e1a181ef30c72863 (patch) | |
tree | 382fca07d2bf725b0407e0d936d1c8b4fb1606fb /scripts | |
parent | 37dd5bae9ddf3788852276aec0c5b64f9a347877 (diff) | |
download | bugzilla-bb40800f890ac0b4f448eed5e1a181ef30c72863.tar.gz bugzilla-bb40800f890ac0b4f448eed5e1a181ef30c72863.tar.xz |
Bug 1298978 - Bulk assign P3 to all open intermittent bugs without a priority set in Firefox components
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/1298978.pl | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/scripts/1298978.pl b/scripts/1298978.pl new file mode 100755 index 000000000..c4ae39f07 --- /dev/null +++ b/scripts/1298978.pl @@ -0,0 +1,91 @@ +#!/usr/bin/perl +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This Source Code Form is "Incompatible With Secondary Licenses", as +# defined by the Mozilla Public License, v. 2.0. + +use 5.10.1; +use strict; +use warnings; + +use FindBin '$RealBin'; +use lib "$RealBin/../..", "$RealBin/../../lib"; + +use Bugzilla; +use Bugzilla::Bug; +use Bugzilla::Constants; +use Bugzilla::Group; +use Bugzilla::Search; + +use constant QUERY => { + 'keywords' => 'intermittent-failure', + 'keywords_type' => 'allwords', + 'priority' => '--', + 'product' => [ + 'Core', + 'Firefox', + 'Firefox for Android', + 'Firefox for iOS', + 'Toolkit', + ], + 'resolution' => '---', + 'short_desc' => '^intermittent', + 'short_desc_type' => 'regexp', +}; + +use constant COMMENT => "Bulk assigning P3 to all open intermittent bugs without a priority set in Firefox components per bug 1298978."; + +Bugzilla->usage_mode(USAGE_MODE_CMDLINE); + +my $dbh = Bugzilla->dbh; + +# Make all changes as the automation user +my $auto_user = Bugzilla::User->check({ name => 'automation@bmo.tld' }); +$auto_user->{groups} = [ Bugzilla::Group->get_all ]; +$auto_user->{bless_groups} = [ Bugzilla::Group->get_all ]; +Bugzilla->set_user($auto_user); + +my $search = new Bugzilla::Search(fields => ['bug_id'], params => QUERY); +my ($data) = $search->data; + +my $bug_count = @$data; +if ($bug_count == 0) { + warn "There are no bugs to update.\n"; + exit 1; +} + +print STDERR <<EOF; +About to update $bug_count bugs. + +Press <Ctrl-C> to stop or <Enter> to continue... +EOF +getc(); + +my $timestamp = $dbh->selectrow_array('SELECT LOCALTIMESTAMP(0)'); + +$dbh->bz_start_transaction; +foreach my $row (@$data) { + my $bug_id = shift @$row; + warn "Updating bug $bug_id\n"; + my $bug = Bugzilla::Bug->new($bug_id); + $bug->set_priority('P3'); + $bug->add_comment(COMMENT); + $bug->update($timestamp); + $dbh->do("UPDATE bugs SET lastdiffed = ? WHERE bug_id = ?", + undef, $timestamp, $bug_id); +} +$dbh->bz_commit_transaction; + +Bugzilla->memcached->clear_all(); + +__END__ + +=head1 NAME + +close_bugs_wontfix.pl - close bugs matching query as RESOLVED/WONTFIX. + +=head1 SYNOPSIS + + close_bugs_wontfix.pl |