summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGregory Szorc <gps@mozilla.com>2015-01-09 15:54:15 +0100
committerDavid Lawrence <dkl@mozilla.com>2015-01-09 15:54:15 +0100
commitec05da49c920d01f931d36c66d4f3edc495f21fb (patch)
tree935fa4be64ea0f5a976df8cd3b2fc8d16c950e1e
parent2bf5ed2df1e4929b4c27ad8844932979d482fe26 (diff)
downloadbugzilla-ec05da49c920d01f931d36c66d4f3edc495f21fb.tar.gz
bugzilla-ec05da49c920d01f931d36c66d4f3edc495f21fb.tar.xz
Bug 1119443: Docker's generate_bmo_data.pl doesn't have similar bug status settings
-rwxr-xr-xcontrib/docker/generate_bmo_data.pl93
1 files changed, 93 insertions, 0 deletions
diff --git a/contrib/docker/generate_bmo_data.pl b/contrib/docker/generate_bmo_data.pl
index 9676d5895..88e5ccbde 100755
--- a/contrib/docker/generate_bmo_data.pl
+++ b/contrib/docker/generate_bmo_data.pl
@@ -20,6 +20,7 @@ use Bugzilla::Constants;
use Bugzilla::Keyword;
use Bugzilla::Config qw(:admin);
use Bugzilla::User::Setting;
+use Bugzilla::Status;
my $dbh = Bugzilla->dbh;
@@ -547,6 +548,98 @@ foreach my $flag (@flagtypes) {
}
###########################################################
+# Create bug status
+###########################################################
+
+my @statuses = (
+ {
+ value => undef,
+ transitions => [['UNCONFIRMED', 0], ['NEW', 0], ['ASSIGNED', 0]],
+ },
+ {
+ value => 'UNCONFIRMED',
+ sortkey => 100,
+ isactive => 1,
+ isopen => 1,
+ transitions => [['NEW', 0], ['ASSIGNED', 0], ['RESOLVED', 0]],
+ },
+ {
+ value => 'NEW',
+ sortkey => 200,
+ isactive => 1,
+ isopen => 1,
+ transitions => [['UNCONFIRMED', 0], ['ASSIGNED', 0], ['RESOLVED', 0]],
+ },
+ {
+ value => 'ASSIGNED',
+ sortkey => 300,
+ isactive => 1,
+ isopen => 1,
+ transitions => [['UNCONFIRMED', 0], ['NEW', 0], ['RESOLVED', 0]],
+ },
+ {
+ value => 'REOPENED',
+ sortkey => 400,
+ isactive => 1,
+ isopen => 1,
+ transitions => [['UNCONFIRMED', 0], ['NEW', 0], ['ASSIGNED', 0], ['RESOLVED', 0]],
+ },
+ {
+ value => 'RESOLVED',
+ sortkey => 500,
+ isactive => 1,
+ isopen => 0,
+ transitions => [['UNCONFIRMED', 0], ['REOPENED', 0], ['VERIFIED', 0]],
+ },
+ {
+ value => 'VERIFIED',
+ sortkey => 600,
+ isactive => 1,
+ isopen => 0,
+ transitions => [['UNCONFIRMED', 0], ['REOPENED', 0], ['RESOLVED', 0]],
+ },
+ {
+ value => 'CLOSED',
+ sortkey => 700,
+ isactive => 1,
+ isopen => 0,
+ transitions => [['UNCONFIRMED', 0], ['REOPENED', 0], ['RESOLVED', 0]],
+ },
+);
+
+if (!$dbh->selectrow_array("SELECT 1 FROM bug_status WHERE value = 'ASSIGNED'")) {
+ $dbh->do('DELETE FROM bug_status');
+ $dbh->do('DELETE FROM status_workflow');
+
+ print "creating status workflow...\n";
+
+ # One pass to add the status entries.
+ foreach my $status (@statuses) {
+ next if !$status->{value};
+ $dbh->do('INSERT INTO bug_status (value, sortkey, isactive, is_open) VALUES (?, ?, ?, ?)',
+ undef, ( $status->{value}, $status->{sortkey}, $status->{isactive}, $status->{isopen} ));
+ }
+
+ # Another pass to add the transitions.
+ foreach my $status (@statuses) {
+ my $old_id;
+ if ($status->{value}) {
+ my $from_status = new Bugzilla::Status({ name => $status->{value} });
+ $old_id = $from_status->{id};
+ } else {
+ $old_id = undef;
+ }
+
+ foreach my $transition (@{$status->{transitions}}) {
+ my $to_status = new Bugzilla::Status({ name => $transition->[0] });
+
+ $dbh->do('INSERT INTO status_workflow (old_status, new_status, require_comment) VALUES (?, ?, ?)',
+ undef, ( $old_id, $to_status->{id}, $transition->[1] ));
+ }
+ }
+}
+
+###########################################################
# Create Keywords
###########################################################