Skip to content

Commit ec05da4

Browse files
indygregdklawren
authored andcommitted
Bug 1119443: Docker's generate_bmo_data.pl doesn't have similar bug status settings
1 parent 2bf5ed2 commit ec05da4

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

contrib/docker/generate_bmo_data.pl

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Bugzilla::Keyword;
2121
use Bugzilla::Config qw(:admin);
2222
use Bugzilla::User::Setting;
23+
use Bugzilla::Status;
2324

2425
my $dbh = Bugzilla->dbh;
2526

@@ -546,6 +547,98 @@
546547
}
547548
}
548549

550+
###########################################################
551+
# Create bug status
552+
###########################################################
553+
554+
my @statuses = (
555+
{
556+
value => undef,
557+
transitions => [['UNCONFIRMED', 0], ['NEW', 0], ['ASSIGNED', 0]],
558+
},
559+
{
560+
value => 'UNCONFIRMED',
561+
sortkey => 100,
562+
isactive => 1,
563+
isopen => 1,
564+
transitions => [['NEW', 0], ['ASSIGNED', 0], ['RESOLVED', 0]],
565+
},
566+
{
567+
value => 'NEW',
568+
sortkey => 200,
569+
isactive => 1,
570+
isopen => 1,
571+
transitions => [['UNCONFIRMED', 0], ['ASSIGNED', 0], ['RESOLVED', 0]],
572+
},
573+
{
574+
value => 'ASSIGNED',
575+
sortkey => 300,
576+
isactive => 1,
577+
isopen => 1,
578+
transitions => [['UNCONFIRMED', 0], ['NEW', 0], ['RESOLVED', 0]],
579+
},
580+
{
581+
value => 'REOPENED',
582+
sortkey => 400,
583+
isactive => 1,
584+
isopen => 1,
585+
transitions => [['UNCONFIRMED', 0], ['NEW', 0], ['ASSIGNED', 0], ['RESOLVED', 0]],
586+
},
587+
{
588+
value => 'RESOLVED',
589+
sortkey => 500,
590+
isactive => 1,
591+
isopen => 0,
592+
transitions => [['UNCONFIRMED', 0], ['REOPENED', 0], ['VERIFIED', 0]],
593+
},
594+
{
595+
value => 'VERIFIED',
596+
sortkey => 600,
597+
isactive => 1,
598+
isopen => 0,
599+
transitions => [['UNCONFIRMED', 0], ['REOPENED', 0], ['RESOLVED', 0]],
600+
},
601+
{
602+
value => 'CLOSED',
603+
sortkey => 700,
604+
isactive => 1,
605+
isopen => 0,
606+
transitions => [['UNCONFIRMED', 0], ['REOPENED', 0], ['RESOLVED', 0]],
607+
},
608+
);
609+
610+
if (!$dbh->selectrow_array("SELECT 1 FROM bug_status WHERE value = 'ASSIGNED'")) {
611+
$dbh->do('DELETE FROM bug_status');
612+
$dbh->do('DELETE FROM status_workflow');
613+
614+
print "creating status workflow...\n";
615+
616+
# One pass to add the status entries.
617+
foreach my $status (@statuses) {
618+
next if !$status->{value};
619+
$dbh->do('INSERT INTO bug_status (value, sortkey, isactive, is_open) VALUES (?, ?, ?, ?)',
620+
undef, ( $status->{value}, $status->{sortkey}, $status->{isactive}, $status->{isopen} ));
621+
}
622+
623+
# Another pass to add the transitions.
624+
foreach my $status (@statuses) {
625+
my $old_id;
626+
if ($status->{value}) {
627+
my $from_status = new Bugzilla::Status({ name => $status->{value} });
628+
$old_id = $from_status->{id};
629+
} else {
630+
$old_id = undef;
631+
}
632+
633+
foreach my $transition (@{$status->{transitions}}) {
634+
my $to_status = new Bugzilla::Status({ name => $transition->[0] });
635+
636+
$dbh->do('INSERT INTO status_workflow (old_status, new_status, require_comment) VALUES (?, ?, ?)',
637+
undef, ( $old_id, $to_status->{id}, $transition->[1] ));
638+
}
639+
}
640+
}
641+
549642
###########################################################
550643
# Create Keywords
551644
###########################################################

0 commit comments

Comments
 (0)