]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
no bug - remove useless "file a bug if a field was changed" code (#1191)
authorDylan William Hardison <dylan@hardison.net>
Wed, 3 Apr 2019 19:29:46 +0000 (15:29 -0400)
committerGitHub <noreply@github.com>
Wed, 3 Apr 2019 19:29:46 +0000 (15:29 -0400)
For some historical reason, we had code to file a bug when
a new field was added. This is bad for a number of obvious reasons:

1. It hard-codes a domain name check
2. It hard-codes a product and component (which don't exist)
3. It hints that it is *acceptable* to allow different systems
   to have direct access to BMO's DB, which is not the case.

In short, this code should go.

extensions/BMO/Extension.pm

index 3615b29d17fe423f101722b33a5940763dd05ff5..e618e83ef43b53800a8f5570a8fc6e81b9ed9c6d 100644 (file)
@@ -1575,87 +1575,6 @@ sub _last_closed_date {
   return $self->{'last_closed_date'};
 }
 
-sub field_end_of_create {
-  my ($self, $args) = @_;
-  my $field = $args->{'field'};
-
-  # Create an IT bug so Mozilla's DBAs so they can update the grants for metrics
-
-  if ( Bugzilla->localconfig->{'urlbase'} ne 'https://bugzilla.mozilla.org/'
-    && Bugzilla->localconfig->{'urlbase'} ne 'https://bugzilla.allizom.org/')
-  {
-    return;
-  }
-
-  my $name = $field->name;
-
-  if (Bugzilla->usage_mode == USAGE_MODE_CMDLINE) {
-    Bugzilla->set_user(Bugzilla::User->check({name => 'nobody@mozilla.org'}));
-    print "Creating IT permission grant bug for new field '$name'...";
-  }
-
-  my $bug_data = {
-    short_desc   => "Custom field '$name' added to bugzilla.mozilla.org",
-    product      => 'Data & BI Services Team',
-    component    => 'Database Operations',
-    bug_type     => 'task',
-    bug_severity => 'normal',
-    op_sys       => 'All',
-    rep_platform => 'All',
-    version      => 'other',
-  };
-
-  my $comment = <<COMMENT;
-The custom field '$name' has been added to the BMO database.
-Please run the following on bugzilla1.db.scl3.mozilla.com:
-COMMENT
-
-  if ( $field->type == FIELD_TYPE_SINGLE_SELECT
-    || $field->type == FIELD_TYPE_MULTI_SELECT)
-  {
-    $comment .= <<COMMENT;
-  GRANT SELECT ON `bugs`.`$name` TO 'metrics'\@'10.22.70.20_';
-  GRANT SELECT ON `bugs`.`$name` TO 'metrics'\@'10.22.70.21_';
-COMMENT
-  }
-  if ($field->type == FIELD_TYPE_MULTI_SELECT) {
-    $comment .= <<COMMENT;
-  GRANT SELECT ON `bugs`.`bug_$name` TO 'metrics'\@'10.22.70.20_';
-  GRANT SELECT ON `bugs`.`bug_$name` TO 'metrics'\@'10.22.70.21_';
-COMMENT
-  }
-  if ($field->type != FIELD_TYPE_MULTI_SELECT) {
-    $comment .= <<COMMENT;
-  GRANT SELECT ($name) ON `bugs`.`bugs` TO 'metrics'\@'10.22.70.20_';
-  GRANT SELECT ($name) ON `bugs`.`bugs` TO 'metrics'\@'10.22.70.21_';
-COMMENT
-  }
-
-  $bug_data->{'comment'} = $comment;
-
-  my $old_error_mode = Bugzilla->error_mode;
-  Bugzilla->error_mode(ERROR_MODE_DIE);
-
-  my $new_bug = eval { Bugzilla::Bug->create($bug_data) };
-
-  my $error = $@;
-  undef $@;
-  Bugzilla->error_mode($old_error_mode);
-
-  if ($error || !($new_bug && $new_bug->{'bug_id'})) {
-    warn "Error creating IT bug for new field $name: $error";
-    if (Bugzilla->usage_mode == USAGE_MODE_CMDLINE) {
-      print "\nError: $error\n";
-    }
-  }
-  else {
-    Bugzilla::BugMail::Send($new_bug->id, {changer => Bugzilla->user});
-    if (Bugzilla->usage_mode == USAGE_MODE_CMDLINE) {
-      print "bug " . $new_bug->id . " created.\n";
-    }
-  }
-}
-
 sub webservice {
   my ($self, $args) = @_;