my $dbh = Bugzilla->dbh;
return if $dbh->bz_column_info('groups', 'owner_user_id');
$dbh->bz_add_column('groups', 'owner_user_id', {TYPE => 'INT3'});
- my $nobody = Bugzilla::User->check('nobody@mozilla.org');
+ my $nobody = Bugzilla::User->check(Bugzilla->localconfig->nobody_user);
$dbh->do('UPDATE groups SET owner_user_id = ?', undef, $nobody->id);
}
{name => 'memcached_namespace', default => "bugzilla:",},
{name => 'urlbase', default => '',},
{name => 'canonical_urlbase', lazy => 1},
+ {name => 'nobody_user', default => 'nobody@mozilla.org'},
{name => 'attachment_base', default => '',},
{name => 'ses_username', default => '',},
{name => 'ses_password', default => '',},
$answers{user_info_class} //= 'GitHubAuth,CGI';
$answers{user_verify_class} //= 'GitHubAuth,DB';
- if ($first_time++) {
+ if ($first_time++ == 0) {
capture_merged {
Bugzilla::Config::update_params();
};
}
else {
Bugzilla::Config::SetParam($_, $answers{$_}) for keys %answers;
+ Bugzilla::Config::write_params();
}
}
# Add default searches to new user's footer
my $dbh = Bugzilla->dbh;
- my $sharer = Bugzilla::User->new({name => 'nobody@mozilla.org'}) or return;
+ my $sharer = Bugzilla::User->new({name => Bugzilla->localconfig->nobody_user})
+ or return;
my $group = Bugzilla::Group->new({name => 'everyone'}) or return;
foreach my $definition (@default_named_queries) {
sub _bug_is_unassigned {
my ($self) = @_;
my $assignee = $self->assigned_to->login;
- return $assignee eq 'nobody@mozilla.org' || $assignee =~ /@(?!invalid).+\.bugs$/;
+ return $assignee eq Bugzilla->localconfig->nobody_user || $assignee =~ /@(?!invalid).+\.bugs$/;
}
sub _bug_has_current_patch {
# and the assignee isn't a real person
return
- unless $new_bug->assigned_to->login eq 'nobody@mozilla.org'
+ unless $new_bug->assigned_to->login eq Bugzilla->localconfig->nobody_user
|| $new_bug->assigned_to->login =~ /@(?!invalid).+\.bugs$/;
# and the user can set the status to NEW
my ($investigate_bug, $ssh_key_bug);
my $old_user = Bugzilla->user;
eval {
- Bugzilla->set_user(Bugzilla::User->new({name => 'nobody@mozilla.org'}));
+ Bugzilla->set_user(Bugzilla::User->new(
+ {name => Bugzilla->localconfig->nobody_user}));
my $new_user = Bugzilla->user;
# HACK: User needs to be in the editbugs and primary bug's group to allow
print "Press <Ctrl-C> to stop or <Enter> to continue...\n";
getc();
-my $nobody = Bugzilla::User->check({name => 'nobody@mozilla.org'});
+my $nobody = Bugzilla::User->check({name => Bugzilla->localconfig->nobody_user});
my $field = Bugzilla::Field->check({name => 'status_whiteboard'});
my $when = $dbh->selectrow_array('SELECT LOCALTIMESTAMP(0)');
use Bugzilla::Util qw(trim);
my $dbh = Bugzilla->dbh;
-my $nobody = Bugzilla::User->check({name => 'nobody@mozilla.org'});
+my $nobody = Bugzilla::User->check({name => Bugzilla->localconfig->nobody_user});
my $field = Bugzilla::Field->check({name => 'attachments.mimetype'});
# grab list of suitable attachments
[% group.name FILTER html %]</span>
</td>
<td nowrap>
- [% IF group.owner.login == 'nobody@mozilla.org' %]
+ [% IF group.owner.login == Bugzilla.localconfig.nobody_user %]
–
[% ELSE %]
[% INCLUDE global/user.html.tmpl who = group.owner %]
# these are used in a few places
is_cced = bug.cc.contains(user.login);
- unassigned = (bug.assigned_to.login == "nobody@mozilla.org")
+ unassigned = (bug.assigned_to.login == Bugzilla.localconfig.nobody_user)
|| (bug.assigned_to.login.search('@(?!invalid).+\.bugs$'));
# custom fields that have custom rendering, or should not be rendered
our $VERSION = '2';
use constant REQUIRE_WATCH_USER => 1;
-use constant DEFAULT_ASSIGNEE => 'nobody@mozilla.org';
use constant REL_COMPONENT_WATCHER => 15;
sub template_before_process {
my ($self, $args) = @_;
return unless $args->{file} eq 'admin/components/create.html.tmpl';
- $args->{vars}{comp}{default_assignee}{login} = DEFAULT_ASSIGNEE;
+ $args->{vars}{comp}{default_assignee}{login} = Bugzilla->localconfig->nobody_user;
}
#
}
sub is_bug_assigned {
- return $_[0]->assigned_to->email ne 'nobody@mozilla.org';
+ return $_[0]->assigned_to->email ne Bugzilla->localconfig->nobody_user;
}
sub is_attachment_phab_revision {
<>;
# we need to be logged in to do user searching and update bugs
-my $nobody = Bugzilla::User->check({name => 'nobody@mozilla.org'});
+my $nobody = Bugzilla::User->check({name => Bugzilla->localconfig->nobody_user});
$nobody->{groups} = [Bugzilla::Group->get_all];
Bugzilla->set_user($nobody);
# we always need to be authenticated to perform user matching
my $user = Bugzilla->user;
if (!$user->id) {
- Bugzilla->set_user(Bugzilla::User->check({name => 'nobody@mozilla.org'}));
+ Bugzilla->set_user(Bugzilla::User->check(
+ {name => Bugzilla->localconfig->nobody_user}));
push @reviewers, @{$bug->mentors};
Bugzilla->set_user($user);
}
Bugzilla->usage_mode(USAGE_MODE_CMDLINE);
my $dbh = Bugzilla->dbh;
-my $user = Bugzilla::User->check({name => 'nobody@mozilla.org'});
+my $user = Bugzilla::User->check({name => Bugzilla->localconfig->nobody_user});
my $tf_vis = $dbh->selectall_arrayref(<<SQL);
SELECT
# update bugs
-my $nobody = Bugzilla::User->check({name => 'nobody@mozilla.org'});
+my $nobody = Bugzilla::User->check({name => Bugzilla->localconfig->nobody_user});
# put our nobody user into all groups to avoid permissions issues
$nobody->{groups} = [Bugzilla::Group->get_all];
components
ON components.watch_user = profiles.userid
WHERE
- profiles.login_name != 'nobody@mozilla.org'
+ profiles.login_name != ?
AND components.id IS NULL
AND NOT profiles.login_name LIKE '%.bugs'
AND NOT profiles.login_name LIKE '%.tld'
profiles.userid
EOF
+my $nobody = Bugzilla->localconfig->nobody_user;
if ($dump_sql) {
+ $sql =~ s/[?]/"$nobody"/;
$sql =~ s/[?]/$date/g;
print $sql;
exit;
}
say STDERR "looking for users inactive since $date";
-my $users = $dbh->selectall_arrayref($sql, {Slice => {}}, $date, $date);
+my $users = $dbh->selectall_arrayref($sql, {Slice => {}}, $nobody, $date, $date);
my $total = scalar @$users;
die "no matching users found.\n" unless $total;
my $dbh = Bugzilla->dbh;
my @remove_group_names;
-my $nobody_name = 'nobody@mozilla.org';
+my $nobody_name = Bugzilla->localconfig->nobody_user;
my $admin_name = 'automation@bmo.tld';
GetOptions(
my @users = (
{
- login => 'nobody@mozilla.org',
+ login => Bugzilla->localconfig->nobody_user,
realname => 'Nobody; OK to take it and work on it',
password => '*'
},
name => 'General',
description => 'For bugs in Firefox which do not fit into '
. 'other more specific Firefox components',
- initialowner => 'nobody@mozilla.org',
+ initialowner => Bugzilla->localconfig->nobody_user,
initialqaowner => '',
initial_cc => [],
watch_user => 'general@firefox.bugs'
description =>
'This is the component for issues specific to bugzilla.mozilla.org '
. 'that do not belong in other components.',
- initialowner => 'nobody@mozilla.org',
+ initialowner => Bugzilla->localconfig->nobody_user,
initialqaowner => '',
initial_cc => [],
watch_user => 'general@bugzilla.bugs'
= $dbh->selectcol_arrayref(q{SELECT bug_id FROM bugs WHERE bugs.op_sys = ?},
undef, $from_os);
my $field = Bugzilla::Field->check({name => 'op_sys', cache => 1});
-my $nobody = Bugzilla::User->check({name => 'nobody@mozilla.org', cache => 1});
+my $nobody = Bugzilla::User->check(
+ {name => Bugzilla->localconfig->nobody_user, cache => 1});
my $bug_count = @$bug_ids;
if ($bug_count == 0) {
= $dbh->selectrow_array("SELECT id FROM fielddefs WHERE name = 'component'");
$component_field_id or die "Can't find field ID for 'component' field\n";
-my $user_id = $dbh->selectrow_array(
- "SELECT userid FROM profiles WHERE login_name='nobody\@mozilla.org'");
-$user_id or die "Can't find user ID for 'nobody\@mozilla.org'\n";
+my $nobody = Bugzilla->localconfig->nobody_user;
+my $user_id
+ = $dbh->selectrow_array("SELECT userid FROM profiles WHERE login_name=?",
+ undef, $nobody);
+$user_id or die "Can't find user ID for '$nobody'\n";
$dbh->bz_start_transaction();
assignee => '',
product => '',
component => '',
- unassigned => 'nobody@mozilla.org',
+ unassigned => Bugzilla->localconfig->nobody_user,
# severities
severity => 'major,critical,blocker',
$dbh->bz_commit_transaction();
# nobody@mozilla.org cannot receive email
- next if $group->owner->login eq 'nobody@mozilla.org';
+ next if $group->owner->login eq Bugzilla->localconfig->nobody_user;
_send_email($group, \@users_removed);
}
}
# We will need these for entering into bugs_activity
-my $who = Bugzilla::User->new({name => 'nobody@mozilla.org'});
+my $who = Bugzilla::User->new({name => Bugzilla->localconfig->nobody_user});
my $field = Bugzilla::Field->new({name => $field_name});
my $product_id = $dbh->selectrow_array("SELECT id FROM products WHERE name = ?",
keywords => [],
cc => [],
comment => 'This is a brand new bug',
- assigned_to => 'nobody@mozilla.org',
+ assigned_to => Bugzilla->localconfig->nobody_user,
});
ok($bug_1->id, "got a new bug");
keywords => [],
cc => [],
comment => "This is related to ${urlbase}show_bug.cgi?id=$bug_1_id",
- assigned_to => 'nobody@mozilla.org',
+ assigned_to => Bugzilla->localconfig->nobody_user,
});
my $bug_2_id = $bug_2->id;
use Test2::Tools::Mock;
use Try::Tiny;
use Capture::Tiny qw(capture_merged);
-use Bugzilla::Test::MockParams;
BEGIN {
$ENV{LOCALCONFIG_ENV} = 'BMO';
$ENV{BMO_db_name} = ':memory:';
}
use Bugzilla;
+use Bugzilla::Test::MockParams;
BEGIN { Bugzilla->extensions }
<td>
<em>If you want to assign this [% terms.bug %] to yourself,
check the box below.</em><br>
- [% IF bug.assigned_to.login == "nobody@mozilla.org" || bug.assigned_to.login.search('@(?!invalid).+\.bugs$') %]
+ [% IF bug.assigned_to.login == Bugzilla.localconfig.nobody_user || bug.assigned_to.login.search('@(?!invalid).+\.bugs$') %]
[% take_if_patch = 1 %]
[% END %]
<input type="checkbox" id="takebug" name="takebug" value="1" [% IF take_if_patch %] data-take-if-patch="1" [% END %]>
localconfig_canonical_urlbase => <<'END',
The URL that is the canonical initial leading part of all URLs.
This will be the production URL for a dev site, for instance.
+END
+ localconfig_nobody_user => <<'END',
+This is the email address of the "nobody" user, which is used as e.g. the
+default user that bugs are assigned to.
END
localconfig_use_suexec => <<'END',
Set this to 1 if Bugzilla runs in an Apache SuexecUserGroup environment.