diff options
author | Dylan William Hardison <dylan@mozilla.com> | 2014-08-20 07:26:22 +0200 |
---|---|---|
committer | Byron Jones <glob@mozilla.com> | 2014-08-20 07:26:22 +0200 |
commit | 3c28be9dca0e8d2a17acd70aff8cfac2b6b1b358 (patch) | |
tree | 190264c2f4edd70845696d54240e007efe23934c /extensions/BMO/bin | |
parent | 2bc51e2b17245527ffb9bb63dbbeabf977086ade (diff) | |
download | bugzilla-3c28be9dca0e8d2a17acd70aff8cfac2b6b1b358.tar.gz bugzilla-3c28be9dca0e8d2a17acd70aff8cfac2b6b1b358.tar.xz |
Bug 1022707: Duplicate review flags on attachments in Toolkit and Firefox for Metro
Diffstat (limited to 'extensions/BMO/bin')
-rwxr-xr-x | extensions/BMO/bin/bug_1022707.pl | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/extensions/BMO/bin/bug_1022707.pl b/extensions/BMO/bin/bug_1022707.pl new file mode 100755 index 000000000..c27757220 --- /dev/null +++ b/extensions/BMO/bin/bug_1022707.pl @@ -0,0 +1,50 @@ +#!/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 strict; +use warnings; + +use FindBin qw($RealBin); +use lib "$RealBin/../../.."; + +use Bugzilla; +use Bugzilla::Constants qw( USAGE_MODE_CMDLINE ); +BEGIN { Bugzilla->extensions() } + +Bugzilla->usage_mode(USAGE_MODE_CMDLINE); + +my $dbh = Bugzilla->dbh; + +my $sql = q{ + SELECT flags.id FROM flags + INNER JOIN bugs ON bugs.bug_id = flags.bug_id + WHERE type_id = 748 + AND bugs.product_id != 21 +}; + +print "Searching for suitable flags..\n"; +my $flag_ids = $dbh->selectcol_arrayref($sql); +my $total = @$flag_ids; + +die "No suitable flags found\n" unless $total; +print "About to fix $total flags\n"; +print "Press <enter> to start, or ^C to cancel...\n"; +readline; + +my $update_fsa_sql= "UPDATE flag_state_activity SET type_id = 4 WHERE " . $dbh->sql_in('flag_id', $flag_ids); +my $update_flags_sql = "UPDATE flags SET type_id = 4 WHERE " . $dbh->sql_in('id', $flag_ids); + +$dbh->bz_start_transaction(); +$dbh->do($update_fsa_sql); +$dbh->do($update_flags_sql); +$dbh->bz_commit_transaction(); + +Bugzilla->memcached->clear_all(); + +print "Done.\n"; |