summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2017-04-28 19:49:48 +0200
committerDylan William Hardison <dylan@hardison.net>2017-05-01 22:17:05 +0200
commit54af7955b30636d31fa82693c25df11085f43a6d (patch)
tree79f5c38cf2753e14ec63949c3a717943a34b91b1
parent20938c2a5dcac6a0851b8f81560790ad227ac29d (diff)
downloadbugzilla-54af7955b30636d31fa82693c25df11085f43a6d.tar.gz
bugzilla-54af7955b30636d31fa82693c25df11085f43a6d.tar.xz
Bug 1360619 - Move Firefox OS to graveyard
Repurpose an old script as a bug resolving implement.
-rwxr-xr-xscripts/resolve_bugs.pl (renamed from scripts/close_bugs_wontfix.pl)35
1 files changed, 23 insertions, 12 deletions
diff --git a/scripts/close_bugs_wontfix.pl b/scripts/resolve_bugs.pl
index 1c80a965d..5a9199d39 100755
--- a/scripts/close_bugs_wontfix.pl
+++ b/scripts/resolve_bugs.pl
@@ -17,18 +17,22 @@ use Bugzilla::Bug;
use Bugzilla::Constants;
use Bugzilla::Group;
use Bugzilla::Search;
+use Getopt::Long;
-use constant QUERY => {
- short_desc => '[B2G]',
- resolution => '---',
- short_desc_type => 'allwordssubstr',
- product => 'Mozilla Localizations'
-};
-
-use constant COMMENT => "We've stopped shipping Firefox OS for phones. Thus resolving this as WONTFIX.";
+my ($product, $comment);
+my $resolution = 'WONTFIX';
Bugzilla->usage_mode(USAGE_MODE_CMDLINE);
+GetOptions(
+ 'product|p=s' => \$product,
+ 'resolution|r=s' => \$resolution,
+ 'comment|m=s' => \$comment,
+);
+
+die "--product (-p) is required!\n" unless $product;
+die "--comment (-m) is required!\n" unless $comment;
+
my $dbh = Bugzilla->dbh;
# Make all changes as the automation user
@@ -37,7 +41,10 @@ $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 $search = Bugzilla::Search->new(
+ fields => ['bug_id'],
+ params => { resolution => '---', product => $product },
+);
my ($data) = $search->data;
my $bug_count = @$data;
@@ -47,7 +54,7 @@ if ($bug_count == 0) {
}
print STDERR <<EOF;
-About to close $bug_count bugs as WONTFIX.
+About to resolve $bug_count bugs as $resolution
Press <Ctrl-C> to stop or <Enter> to continue...
EOF
@@ -60,11 +67,15 @@ foreach my $row (@$data) {
my $bug_id = shift @$row;
warn "Updating bug $bug_id\n";
my $bug = Bugzilla::Bug->new($bug_id);
- $bug->set_bug_status('RESOLVED', { resolution => 'WONTFIX' });
- $bug->add_comment(COMMENT);
+ $bug->set_bug_status('RESOLVED', { resolution => $resolution });
+ $bug->add_comment($comment);
$bug->update($timestamp);
$dbh->do("UPDATE bugs SET lastdiffed = ? WHERE bug_id = ?",
undef, $timestamp, $bug_id);
+ # make sure memory is cleaned up.
+ Bugzilla::Hook::process('request_cleanup');
+ Bugzilla::Bug->CLEANUP;
+ Bugzilla->clear_request_cache(except => [qw(user dbh dbh_main dbh_shadow memcached)]);
}
$dbh->bz_commit_transaction;