Commit f91e240a authored by Perl Tidy's avatar Perl Tidy Committed by Dylan William Hardison

no bug - perltidy again, using the latest release

blame jeff
parent 9d2417c9
...@@ -76,7 +76,7 @@ use constant DB_COLUMNS => qw( ...@@ -76,7 +76,7 @@ use constant DB_COLUMNS => qw(
submitter_id submitter_id
); );
use constant REQUIRED_FIELD_MAP => {bug_id => 'bug',}; use constant REQUIRED_FIELD_MAP => {bug_id => 'bug',};
use constant EXTRA_REQUIRED_FIELDS => qw(data); use constant EXTRA_REQUIRED_FIELDS => qw(data);
use constant UPDATE_COLUMNS => qw( use constant UPDATE_COLUMNS => qw(
......
...@@ -23,7 +23,7 @@ sub check_credentials { ...@@ -23,7 +23,7 @@ sub check_credentials {
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my $username = $login_data->{username}; my $username = $login_data->{username};
my $user = new Bugzilla::User({name => $username}); my $user = new Bugzilla::User({name => $username});
return {failure => AUTH_NO_SUCH_USER} unless $user; return {failure => AUTH_NO_SUCH_USER} unless $user;
......
...@@ -208,7 +208,7 @@ sub UPDATE_COLUMNS { ...@@ -208,7 +208,7 @@ sub UPDATE_COLUMNS {
my @custom my @custom
= grep { $_->type != FIELD_TYPE_MULTI_SELECT } Bugzilla->active_custom_fields; = grep { $_->type != FIELD_TYPE_MULTI_SELECT } Bugzilla->active_custom_fields;
my @custom_names = map { $_->name } @custom; my @custom_names = map { $_->name } @custom;
my @columns = qw( my @columns = qw(
assigned_to assigned_to
bug_file_loc bug_file_loc
bug_severity bug_severity
...@@ -313,10 +313,10 @@ sub new { ...@@ -313,10 +313,10 @@ sub new {
# make it the "name" param. # make it the "name" param.
if ( !defined $param if ( !defined $param
|| (!ref($param) && $param !~ /^[0-9]+$/) || (!ref($param) && $param !~ /^[0-9]+$/)
|| (ref($param) && $param->{id} !~ /^[0-9]+$/)) || (ref($param) && $param->{id} !~ /^[0-9]+$/))
{ {
if ($param) { if ($param) {
my $alias = ref($param) ? $param->{id} : $param; my $alias = ref($param) ? $param->{id} : $param;
my $bug_id = bug_alias_to_id($alias); my $bug_id = bug_alias_to_id($alias);
if (!$bug_id) { if (!$bug_id) {
my $error_self = {}; my $error_self = {};
...@@ -365,7 +365,7 @@ sub initialize { ...@@ -365,7 +365,7 @@ sub initialize {
sub object_cache_key { sub object_cache_key {
my $class = shift; my $class = shift;
my $key = $class->SUPER::object_cache_key(@_) || return; my $key = $class->SUPER::object_cache_key(@_) || return;
return $key . ',' . Bugzilla->user->id; return $key . ',' . Bugzilla->user->id;
} }
...@@ -467,7 +467,7 @@ sub match { ...@@ -467,7 +467,7 @@ sub match {
# so include them in the list if they have been specified. # so include them in the list if they have been specified.
if (exists $params->{"${field}_id"}) { if (exists $params->{"${field}_id"}) {
my $current_ids = $params->{"${field}_id"}; my $current_ids = $params->{"${field}_id"};
my @id_array = ref $current_ids ? @$current_ids : ($current_ids); my @id_array = ref $current_ids ? @$current_ids : ($current_ids);
push(@ids, @id_array); push(@ids, @id_array);
} }
...@@ -556,7 +556,7 @@ sub _extract_bug_ids { ...@@ -556,7 +556,7 @@ sub _extract_bug_ids {
push @bug_ids, $comment->extra_data; push @bug_ids, $comment->extra_data;
next; next;
} }
my $s = $comment->already_wrapped ? qr/\s/ : qr/\h/; my $s = $comment->already_wrapped ? qr/\s/ : qr/\h/;
my $text = $comment->body; my $text = $comment->body;
# Full bug links # Full bug links
...@@ -803,7 +803,7 @@ sub create { ...@@ -803,7 +803,7 @@ sub create {
if ($see_also) { if ($see_also) {
my $see_also_array = $see_also; my $see_also_array = $see_also;
if (!ref $see_also_array) { if (!ref $see_also_array) {
$see_also = trim($see_also); $see_also = trim($see_also);
$see_also_array = [split(/[\s,]+/, $see_also)]; $see_also_array = [split(/[\s,]+/, $see_also)];
} }
foreach my $value (@$see_also_array) { foreach my $value (@$see_also_array) {
...@@ -1893,7 +1893,7 @@ sub _check_keywords { ...@@ -1893,7 +1893,7 @@ sub _check_keywords {
my $keyword_array = $keywords_in; my $keyword_array = $keywords_in;
if (!ref $keyword_array) { if (!ref $keyword_array) {
$keywords_in = trim($keywords_in); $keywords_in = trim($keywords_in);
$keyword_array = [split(/[\s,]+/, $keywords_in)]; $keyword_array = [split(/[\s,]+/, $keywords_in)];
} }
...@@ -1956,7 +1956,7 @@ sub _check_qa_contact { ...@@ -1956,7 +1956,7 @@ sub _check_qa_contact {
my $id; my $id;
if ($qa_contact) { if ($qa_contact) {
$qa_contact = Bugzilla::User->check($qa_contact) if !ref $qa_contact; $qa_contact = Bugzilla::User->check($qa_contact) if !ref $qa_contact;
$id = $qa_contact->id; $id = $qa_contact->id;
# create() checks this another way, so we don't have to run this # create() checks this another way, so we don't have to run this
# check during create(). # check during create().
...@@ -2017,7 +2017,7 @@ sub _check_resolution { ...@@ -2017,7 +2017,7 @@ sub _check_resolution {
&& scalar @$dependson && scalar @$dependson
) )
{ {
my $dep_bugs = Bugzilla::Bug->new_from_list($dependson); my $dep_bugs = Bugzilla::Bug->new_from_list($dependson);
my $count_open = grep { $_->isopened } @$dep_bugs; my $count_open = grep { $_->isopened } @$dep_bugs;
if ($count_open) { if ($count_open) {
my $bug_id = ref($invocant) ? $invocant->id : undef; my $bug_id = ref($invocant) ? $invocant->id : undef;
...@@ -2641,7 +2641,7 @@ sub set_dependencies { ...@@ -2641,7 +2641,7 @@ sub set_dependencies {
my ($self, $dependson, $blocked) = @_; my ($self, $dependson, $blocked) = @_;
my %extra = (blocked => $blocked); my %extra = (blocked => $blocked);
$dependson = $self->_check_dependencies($dependson, 'dependson', \%extra); $dependson = $self->_check_dependencies($dependson, 'dependson', \%extra);
$blocked = $extra{blocked}; $blocked = $extra{blocked};
# These may already be detainted, but all setters are supposed to # These may already be detainted, but all setters are supposed to
# detaint their input if they've run a validator (just as though # detaint their input if they've run a validator (just as though
...@@ -3051,7 +3051,7 @@ sub add_comment { ...@@ -3051,7 +3051,7 @@ sub add_comment {
$params ||= {}; $params ||= {};
# Fill out info that doesn't change and callers may not pass in # Fill out info that doesn't change and callers may not pass in
$params->{'bug_id'} = $self; $params->{'bug_id'} = $self;
$params->{'thetext'} = defined($comment) ? $comment : ''; $params->{'thetext'} = defined($comment) ? $comment : '';
# Validate all the entered data # Validate all the entered data
...@@ -3139,7 +3139,7 @@ sub add_group { ...@@ -3139,7 +3139,7 @@ sub add_group {
# So we have to store and pass the name as entered by the user to # So we have to store and pass the name as entered by the user to
# the error message, if we have it. # the error message, if we have it.
my $group_name = blessed($group) ? $group->name : $group; my $group_name = blessed($group) ? $group->name : $group;
my $args = { my $args = {
name => $group_name, name => $group_name,
product => $self->product, product => $self->product,
bug_id => $self->id, bug_id => $self->id,
...@@ -3175,7 +3175,7 @@ sub remove_group { ...@@ -3175,7 +3175,7 @@ sub remove_group {
# See add_group() for the reason why we store the user input. # See add_group() for the reason why we store the user input.
my $group_name = blessed($group) ? $group->name : $group; my $group_name = blessed($group) ? $group->name : $group;
my $args = { my $args = {
name => $group_name, name => $group_name,
product => $self->product, product => $self->product,
bug_id => $self->id, bug_id => $self->id,
...@@ -4443,7 +4443,7 @@ sub LogActivityEntry { ...@@ -4443,7 +4443,7 @@ sub LogActivityEntry {
if (length($removestr) > MAX_LINE_LENGTH) { if (length($removestr) > MAX_LINE_LENGTH) {
my $commaposition = find_wrap_point($removed, MAX_LINE_LENGTH); my $commaposition = find_wrap_point($removed, MAX_LINE_LENGTH);
$removestr = substr($removed, 0, $commaposition); $removestr = substr($removed, 0, $commaposition);
$removed = substr($removed, $commaposition); $removed = substr($removed, $commaposition);
} }
else { else {
$removed = ""; # no more entries $removed = ""; # no more entries
...@@ -4451,7 +4451,7 @@ sub LogActivityEntry { ...@@ -4451,7 +4451,7 @@ sub LogActivityEntry {
if (length($addstr) > MAX_LINE_LENGTH) { if (length($addstr) > MAX_LINE_LENGTH) {
my $commaposition = find_wrap_point($added, MAX_LINE_LENGTH); my $commaposition = find_wrap_point($added, MAX_LINE_LENGTH);
$addstr = substr($added, 0, $commaposition); $addstr = substr($added, 0, $commaposition);
$added = substr($added, $commaposition); $added = substr($added, $commaposition);
} }
else { else {
$added = ""; # no more entries $added = ""; # no more entries
...@@ -4758,7 +4758,7 @@ sub ValidateDependencies { ...@@ -4758,7 +4758,7 @@ sub ValidateDependencies {
@{$deps{$target}} = @{$deptree{$target}}; @{$deps{$target}} = @{$deptree{$target}};
my @stack = @{$deps{$target}}; my @stack = @{$deps{$target}};
while (@stack) { while (@stack) {
my $i = shift @stack; my $i = shift @stack;
my $dep_list = $dbh->selectcol_arrayref($sth{$target}, undef, $i); my $dep_list = $dbh->selectcol_arrayref($sth{$target}, undef, $i);
foreach my $t (@$dep_list) { foreach my $t (@$dep_list) {
......
...@@ -59,7 +59,7 @@ sub Send { ...@@ -59,7 +59,7 @@ sub Send {
# Bugzilla::User objects of people in various roles. More than one person # Bugzilla::User objects of people in various roles. More than one person
# can 'have' a role, if the person in that role has changed, or people are # can 'have' a role, if the person in that role has changed, or people are
# watching. # watching.
my @assignees = ($bug->assigned_to); my @assignees = ($bug->assigned_to);
my @qa_contacts = $bug->qa_contact || (); my @qa_contacts = $bug->qa_contact || ();
my @ccs = @{$bug->cc_users}; my @ccs = @{$bug->cc_users};
...@@ -455,7 +455,7 @@ sub _flatten_object { ...@@ -455,7 +455,7 @@ sub _flatten_object {
# the same objects are used for each recipient, so cache the flattened hash # the same objects are used for each recipient, so cache the flattened hash
my $cache = Bugzilla->request_cache->{bugmail_flat_objects} ||= {}; my $cache = Bugzilla->request_cache->{bugmail_flat_objects} ||= {};
my $key = blessed($object) . '-' . $object->id; my $key = blessed($object) . '-' . $object->id;
return $cache->{$key} ||= $object->flatten_to_hash; return $cache->{$key} ||= $object->flatten_to_hash;
} }
...@@ -559,7 +559,7 @@ sub _get_diffs { ...@@ -559,7 +559,7 @@ sub _get_diffs {
&& $diff->{field_name} eq $changes[-1]->{field_name} && $diff->{field_name} eq $changes[-1]->{field_name}
&& $diff->{bug_when} eq $changes[-1]->{bug_when} && $diff->{bug_when} eq $changes[-1]->{bug_when}
&& $diff->{who} eq $changes[-1]->{who} && $diff->{who} eq $changes[-1]->{who}
&& ($diff->{attach_id} // 0) == ($changes[-1]->{attach_id} // 0) && ($diff->{attach_id} // 0) == ($changes[-1]->{attach_id} // 0)
&& ($diff->{comment_id} // 0) == ($changes[-1]->{comment_id} // 0)) && ($diff->{comment_id} // 0) == ($changes[-1]->{comment_id} // 0))
{ {
my $old_change = pop @changes; my $old_change = pop @changes;
...@@ -575,7 +575,7 @@ sub _get_diffs { ...@@ -575,7 +575,7 @@ sub _get_diffs {
} }
sub _get_new_bugmail_fields { sub _get_new_bugmail_fields {
my $bug = shift; my $bug = shift;
my @fields = @{Bugzilla->fields({obsolete => 0, in_new_bugmail => 1})}; my @fields = @{Bugzilla->fields({obsolete => 0, in_new_bugmail => 1})};
my @diffs; my @diffs;
my $params = Bugzilla->params; my $params = Bugzilla->params;
......
...@@ -83,7 +83,7 @@ sub new { ...@@ -83,7 +83,7 @@ sub new {
if (ref $param) { if (ref $param) {
my $bug_id = $param->{bug_id}; my $bug_id = $param->{bug_id};
my $name = $param->{name} || $param->{value}; my $name = $param->{name} || $param->{value};
if (!defined $bug_id) { if (!defined $bug_id) {
ThrowCodeError('bad_arg', {argument => 'bug_id', function => "${class}::new"}); ThrowCodeError('bad_arg', {argument => 'bug_id', function => "${class}::new"});
} }
...@@ -92,7 +92,7 @@ sub new { ...@@ -92,7 +92,7 @@ sub new {
} }
my $condition = 'bug_id = ? AND value = ?'; my $condition = 'bug_id = ? AND value = ?';
my @values = ($bug_id, $name); my @values = ($bug_id, $name);
$param = {condition => $condition, values => \@values}; $param = {condition => $condition, values => \@values};
} }
......
...@@ -35,10 +35,8 @@ sub _init_bz_cgi_globals { ...@@ -35,10 +35,8 @@ sub _init_bz_cgi_globals {
# We don't precompile any functions here, that's done specially in # We don't precompile any functions here, that's done specially in
# mod_perl code. # mod_perl code.
$invocant->_setup_symbols( $invocant->_setup_symbols(qw(:no_xhtml :oldstyle_urls :private_tempfiles
qw(:no_xhtml :oldstyle_urls :private_tempfiles :unique_headers));
:unique_headers)
);
} }
BEGIN { __PACKAGE__->_init_bz_cgi_globals() if i_am_cgi(); } BEGIN { __PACKAGE__->_init_bz_cgi_globals() if i_am_cgi(); }
...@@ -357,7 +355,7 @@ sub _prevent_unsafe_response { ...@@ -357,7 +355,7 @@ sub _prevent_unsafe_response {
my $is_safe_content_type = $content_type =~ $safe_content_type_re; my $is_safe_content_type = $content_type =~ $safe_content_type_re;
# Safe referers are ones that begin with the urlbase. # Safe referers are ones that begin with the urlbase.
my $referer = $self->referer; my $referer = $self->referer;
my $is_safe_referer = $referer && $referer =~ $safe_referer_re; my $is_safe_referer = $referer && $referer =~ $safe_referer_re;
if (!$is_safe_referer && !$is_safe_content_type) { if (!$is_safe_referer && !$is_safe_content_type) {
......
...@@ -27,7 +27,7 @@ use List::Util qw(max); ...@@ -27,7 +27,7 @@ use List::Util qw(max);
sub new { sub new {
my $invocant = shift; my $invocant = shift;
my $class = ref($invocant) || $invocant; my $class = ref($invocant) || $invocant;
# Create a ref to an empty hash and bless it # Create a ref to an empty hash and bless it
my $self = {}; my $self = {};
...@@ -255,7 +255,7 @@ sub readData { ...@@ -255,7 +255,7 @@ sub readData {
my $sth = $dbh->prepare($query); my $sth = $dbh->prepare($query);
my $gt_index = $self->{'gt'} ? scalar(@{$self->{'lines'}}) : undef; my $gt_index = $self->{'gt'} ? scalar(@{$self->{'lines'}}) : undef;
my $line_index = 0; my $line_index = 0;
$maxvals[$gt_index] = 0 if $gt_index; $maxvals[$gt_index] = 0 if $gt_index;
......
...@@ -305,7 +305,7 @@ sub remove_tag { ...@@ -305,7 +305,7 @@ sub remove_tag {
my ($self, $tag) = @_; my ($self, $tag) = @_;
$tag = $self->_check_tag($tag); $tag = $self->_check_tag($tag);
my $tags = $self->tags; my $tags = $self->tags;
my $index = first { lc($tags->[$_]) eq lc($tag) } 0 .. scalar(@$tags) - 1; my $index = first { lc($tags->[$_]) eq lc($tag) } 0 .. scalar(@$tags) - 1;
return unless defined $index; return unless defined $index;
splice(@$tags, $index, 1); splice(@$tags, $index, 1);
......
...@@ -83,7 +83,7 @@ sub new { ...@@ -83,7 +83,7 @@ sub new {
} }
my $condition = 'product_id = ? AND name = ?'; my $condition = 'product_id = ? AND name = ?';
my @values = ($product->id, $name); my @values = ($product->id, $name);
$param = {condition => $condition, values => \@values}; $param = {condition => $condition, values => \@values};
} }
......
...@@ -104,7 +104,7 @@ sub check_sslbase { ...@@ -104,7 +104,7 @@ sub check_sslbase {
my $proto = getprotobyname('tcp'); my $proto = getprotobyname('tcp');
socket(SOCK, PF_INET, SOCK_STREAM, $proto); socket(SOCK, PF_INET, SOCK_STREAM, $proto);
my $iaddr = inet_aton($host) || return "The host $host cannot be resolved"; my $iaddr = inet_aton($host) || return "The host $host cannot be resolved";
my $sin = sockaddr_in($port, $iaddr); my $sin = sockaddr_in($port, $iaddr);
if (!connect(SOCK, $sin)) { if (!connect(SOCK, $sin)) {
return "Failed to connect to $host:$port ($!); unable to enable SSL"; return "Failed to connect to $host:$port ($!); unable to enable SSL";
} }
...@@ -115,7 +115,7 @@ sub check_sslbase { ...@@ -115,7 +115,7 @@ sub check_sslbase {
sub check_ip { sub check_ip {
my $inbound_proxies = shift; my $inbound_proxies = shift;
my @proxies = split(/[\s,]+/, $inbound_proxies); my @proxies = split(/[\s,]+/, $inbound_proxies);
foreach my $proxy (@proxies) { foreach my $proxy (@proxies) {
validate_ip($proxy) || return "$proxy is not a valid IPv4 or IPv6 address"; validate_ip($proxy) || return "$proxy is not a valid IPv4 or IPv6 address";
} }
...@@ -176,7 +176,7 @@ sub check_opsys { ...@@ -176,7 +176,7 @@ sub check_opsys {
} }
sub check_bug_status { sub check_bug_status {
my $bug_status = shift; my $bug_status = shift;
my @closed_bug_statuses = map { $_->name } closed_bug_statuses(); my @closed_bug_statuses = map { $_->name } closed_bug_statuses();
if (!grep($_ eq $bug_status, @closed_bug_statuses)) { if (!grep($_ eq $bug_status, @closed_bug_statuses)) {
return "Must be a valid closed status: one of " return "Must be a valid closed status: one of "
......
...@@ -202,7 +202,7 @@ sub bz_check_server_version { ...@@ -202,7 +202,7 @@ sub bz_check_server_version {
my $sql_vers = $self->bz_server_version; my $sql_vers = $self->bz_server_version;
$self->disconnect; $self->disconnect;
my $sql_want = $db->{db_version}; my $sql_want = $db->{db_version};
my $version_ok = vers_cmp($sql_vers, $sql_want) > -1 ? 1 : 0; my $version_ok = vers_cmp($sql_vers, $sql_want) > -1 ? 1 : 0;
my $sql_server = $db->{name}; my $sql_server = $db->{name};
...@@ -238,7 +238,7 @@ sub bz_create_database { ...@@ -238,7 +238,7 @@ sub bz_create_database {
# See if we can connect to the actual Bugzilla database. # See if we can connect to the actual Bugzilla database.
my $conn_success = eval { $dbh = connect_main() }; my $conn_success = eval { $dbh = connect_main() };
my $db_name = Bugzilla->localconfig->{db_name}; my $db_name = Bugzilla->localconfig->{db_name};
if (!$conn_success) { if (!$conn_success) {
$dbh = _get_no_db_connection(); $dbh = _get_no_db_connection();
...@@ -1136,7 +1136,7 @@ sub _bz_schema { ...@@ -1136,7 +1136,7 @@ sub _bz_schema {
my ($self) = @_; my ($self) = @_;
return $self->{private_bz_schema} if exists $self->{private_bz_schema}; return $self->{private_bz_schema} if exists $self->{private_bz_schema};
my @module_parts = split('::', ref $self); my @module_parts = split('::', ref $self);
my $module_name = pop @module_parts; my $module_name = pop @module_parts;
$self->{private_bz_schema} = Bugzilla::DB::Schema->new($module_name); $self->{private_bz_schema} = Bugzilla::DB::Schema->new($module_name);
return $self->{private_bz_schema}; return $self->{private_bz_schema};
} }
...@@ -1499,7 +1499,7 @@ sub _bz_populate_enum_table { ...@@ -1499,7 +1499,7 @@ sub _bz_populate_enum_table {
my $insert my $insert
= $self->prepare("INSERT INTO $sql_table (value,sortkey) VALUES (?,?)"); = $self->prepare("INSERT INTO $sql_table (value,sortkey) VALUES (?,?)");
my $sortorder = 0; my $sortorder = 0;
my $maxlen = max(map(length($_), @$valuelist)) + 2; my $maxlen = max(map(length($_), @$valuelist)) + 2;
foreach my $value (@$valuelist) { foreach my $value (@$valuelist) {
$sortorder += 100; $sortorder += 100;
$insert->execute($value, $sortorder); $insert->execute($value, $sortorder);
......
...@@ -283,7 +283,7 @@ sub bz_explain { ...@@ -283,7 +283,7 @@ sub bz_explain {
$i++; $i++;
} }
my $first_row = sprintf($format_string, @$columns); my $first_row = sprintf($format_string, @$columns);
my @explain_rows = ($first_row, '-' x length($first_row)); my @explain_rows = ($first_row, '-' x length($first_row));
while (my $row = $sth->fetchrow_arrayref) { while (my $row = $sth->fetchrow_arrayref) {
my @fixed = map { defined $_ ? $_ : 'NULL' } @$row; my @fixed = map { defined $_ ? $_ : 'NULL' } @$row;
...@@ -328,7 +328,7 @@ sub bz_setup_database { ...@@ -328,7 +328,7 @@ sub bz_setup_database {
# This parameter is not yet defined when the DB is being built for # This parameter is not yet defined when the DB is being built for
# the very first time. The code below still works properly, however, # the very first time. The code below still works properly, however,
# because the default maxattachmentsize is smaller than $min_max_allowed. # because the default maxattachmentsize is smaller than $min_max_allowed.
my $max_attachment = (Bugzilla->params->{'maxattachmentsize'} || 0) * 1024; my $max_attachment = (Bugzilla->params->{'maxattachmentsize'} || 0) * 1024;
my $needed_max_allowed = max($min_max_allowed, $max_attachment); my $needed_max_allowed = max($min_max_allowed, $max_attachment);
if ($current_max_allowed < $needed_max_allowed) { if ($current_max_allowed < $needed_max_allowed) {
warn install_string('max_allowed_packet', warn install_string('max_allowed_packet',
...@@ -737,7 +737,7 @@ sub bz_setup_database { ...@@ -737,7 +737,7 @@ sub bz_setup_database {
my ($binary, $utf8) = ($sql_def, $sql_def); my ($binary, $utf8) = ($sql_def, $sql_def);
my $type = $self->_bz_schema->convert_type($col_info->{TYPE}); my $type = $self->_bz_schema->convert_type($col_info->{TYPE});
$binary =~ s/(\Q$type\E)/$1 CHARACTER SET binary/; $binary =~ s/(\Q$type\E)/$1 CHARACTER SET binary/;
$utf8 =~ s/(\Q$type\E)/$1 CHARACTER SET utf8/; $utf8 =~ s/(\Q$type\E)/$1 CHARACTER SET utf8/;
push(@binary_sql, "MODIFY COLUMN $name $binary"); push(@binary_sql, "MODIFY COLUMN $name $binary");
push(@utf8_sql, "MODIFY COLUMN $name $utf8"); push(@utf8_sql, "MODIFY COLUMN $name $utf8");
} }
...@@ -809,13 +809,13 @@ sub bz_setup_database { ...@@ -809,13 +809,13 @@ sub bz_setup_database {
# looks like. So we remove defaults from columns that aren't supposed # looks like. So we remove defaults from columns that aren't supposed
# to have them # to have them
sub _fix_defaults { sub _fix_defaults {
my $self = shift; my $self = shift;
my $maj_version = substr($self->bz_server_version, 0, 1); my $maj_version = substr($self->bz_server_version, 0, 1);
return if $maj_version < 5; return if $maj_version < 5;
# The oldest column that could have this problem is bugs.assigned_to, # The oldest column that could have this problem is bugs.assigned_to,
# so if it doesn't have the problem, we just skip doing this entirely. # so if it doesn't have the problem, we just skip doing this entirely.
my $assi_def = $self->_bz_raw_column_info('bugs', 'assigned_to'); my $assi_def = $self->_bz_raw_column_info('bugs', 'assigned_to');
my $assi_default = $assi_def->{COLUMN_DEF}; my $assi_default = $assi_def->{COLUMN_DEF};
# This "ne ''" thing is necessary because _raw_column_info seems to # This "ne ''" thing is necessary because _raw_column_info seems to
...@@ -834,7 +834,7 @@ sub _fix_defaults { ...@@ -834,7 +834,7 @@ sub _fix_defaults {
# Get the exact default from the database without any # Get the exact default from the database without any
# "fixing" by bz_column_info_real. # "fixing" by bz_column_info_real.
my $raw_info = $self->_bz_raw_column_info($table, $column); my $raw_info = $self->_bz_raw_column_info($table, $column);
my $raw_default = $raw_info->{COLUMN_DEF}; my $raw_default = $raw_info->{COLUMN_DEF};
if (defined $raw_default) { if (defined $raw_default) {
if ($raw_default eq '') { if ($raw_default eq '') {
...@@ -856,7 +856,7 @@ sub _fix_defaults { ...@@ -856,7 +856,7 @@ sub _fix_defaults {
print "Fixing defaults...\n"; print "Fixing defaults...\n";
foreach my $table (reverse sort keys %fix_columns) { foreach my $table (reverse sort keys %fix_columns) {
my @alters = map("ALTER COLUMN $_ DROP DEFAULT", @{$fix_columns{$table}}); my @alters = map("ALTER COLUMN $_ DROP DEFAULT", @{$fix_columns{$table}});
my $sql = "ALTER TABLE $table " . join(',', @alters); my $sql = "ALTER TABLE $table " . join(',', @alters);
$self->do($sql); $self->do($sql);
} }
} }
......
...@@ -310,7 +310,7 @@ sub adjust_statement { ...@@ -310,7 +310,7 @@ sub adjust_statement {
# Oracle requires a FROM clause in all SELECT statements, so append # Oracle requires a FROM clause in all SELECT statements, so append
# "FROM dual" to queries without one (e.g., "SELECT NOW()") # "FROM dual" to queries without one (e.g., "SELECT NOW()")
my $is_select = ($part =~ m/^\s*SELECT\b/io); my $is_select = ($part =~ m/^\s*SELECT\b/io);
my $has_from = ($part =~ m/\bFROM\b/io) if $is_select; my $has_from = ($part =~ m/\bFROM\b/io) if $is_select;
# Oracle includes the time in CURRENT_DATE. # Oracle includes the time in CURRENT_DATE.
$part =~ s/\bCURRENT_DATE\b/TRUNC(CURRENT_DATE)/io; $part =~ s/\bCURRENT_DATE\b/TRUNC(CURRENT_DATE)/io;
...@@ -669,7 +669,7 @@ sub bz_setup_database { ...@@ -669,7 +669,7 @@ sub bz_setup_database {
# triggers ourselves. # triggers ourselves.
if ($def->{TYPE} =~ /SERIAL/i) { if ($def->{TYPE} =~ /SERIAL/i) {
my $sequence = "${table}_${column}_SEQ"; my $sequence = "${table}_${column}_SEQ";
my $exists = $self->selectrow_array($sth, undef, $sequence); my $exists = $self->selectrow_array($sth, undef, $sequence);
if (!$exists) { if (!$exists) {
my @sql = $self->_get_create_seq_ddl($table, $column); my @sql = $self->_get_create_seq_ddl($table, $column);
$self->do($_) foreach @sql; $self->do($_) foreach @sql;
...@@ -688,7 +688,7 @@ sub bz_setup_database { ...@@ -688,7 +688,7 @@ sub bz_setup_database {
$to_table = 'tag'; $to_table = 'tag';
} }
if ($update =~ /CASCADE/i) { if ($update =~ /CASCADE/i) {
my $trigger_name = uc($fk_name . "_UC"); my $trigger_name = uc($fk_name . "_UC");
my $exist_trigger = $self->selectcol_arrayref($sth, undef, $trigger_name); my $exist_trigger = $self->selectcol_arrayref($sth, undef, $trigger_name);
if (@$exist_trigger) { if (@$exist_trigger) {
$self->do("DROP TRIGGER $trigger_name"); $self->do("DROP TRIGGER $trigger_name");
...@@ -713,7 +713,7 @@ sub bz_setup_database { ...@@ -713,7 +713,7 @@ sub bz_setup_database {
} }
# Drop the trigger which causes bug 541553 # Drop the trigger which causes bug 541553
my $trigger_name = "PRODUCTS_MILESTONEURL"; my $trigger_name = "PRODUCTS_MILESTONEURL";
my $exist_trigger = $self->selectcol_arrayref($sth, undef, $trigger_name); my $exist_trigger = $self->selectcol_arrayref($sth, undef, $trigger_name);
if (@$exist_trigger) { if (@$exist_trigger) {
$self->do("DROP TRIGGER $trigger_name"); $self->do("DROP TRIGGER $trigger_name");
......
...@@ -2048,7 +2048,7 @@ sub _column_fks_to_ddl { ...@@ -2048,7 +2048,7 @@ sub _column_fks_to_ddl {
my ($self, $table, $column_fks) = @_; my ($self, $table, $column_fks) = @_;
my @ddl; my @ddl;
foreach my $column (keys %$column_fks) { foreach my $column (keys %$column_fks) {
my $def = $column_fks->{$column}; my $def = $column_fks->{$column};
my $fk_string = $self->get_fk_ddl($table, $column, $def); my $fk_string = $self->get_fk_ddl($table, $column, $def);
push(@ddl, $fk_string); push(@ddl, $fk_string);
} }
...@@ -2147,7 +2147,7 @@ sub get_table_columns { ...@@ -2147,7 +2147,7 @@ sub get_table_columns {
sub get_table_indexes_abstract { sub get_table_indexes_abstract {
my ($self, $table) = @_; my ($self, $table) = @_;
my $table_def = $self->get_table_abstract($table); my $table_def = $self->get_table_abstract($table);
my %indexes = @{$table_def->{INDEXES} || []}; my %indexes = @{$table_def->{INDEXES} || []};
return \%indexes; return \%indexes;
} }
...@@ -2217,7 +2217,7 @@ sub _get_create_table_ddl { ...@@ -2217,7 +2217,7 @@ sub _get_create_table_ddl {
my $finfo = shift(@fields); my $finfo = shift(@fields);
push(@col_lines, "\t$field\t" . $self->get_type_ddl($finfo)); push(@col_lines, "\t$field\t" . $self->get_type_ddl($finfo));
if ($self->FK_ON_CREATE and $finfo->{REFERENCES}) { if ($self->FK_ON_CREATE and $finfo->{REFERENCES}) {
my $fk = $finfo->{REFERENCES}; my $fk = $finfo->{REFERENCES};
my $fk_ddl = $self->get_fk_ddl($table, $field, $fk); my $fk_ddl = $self->get_fk_ddl($table, $field, $fk);
push(@fk_lines, $fk_ddl); push(@fk_lines, $fk_ddl);
} }
...@@ -2352,7 +2352,7 @@ sub get_alter_column_ddl { ...@@ -2352,7 +2352,7 @@ sub get_alter_column_ddl {
my ($table, $column, $new_def, $set_nulls_to) = @_; my ($table, $column, $new_def, $set_nulls_to) = @_;
my @statements; my @statements;
my $old_def = $self->get_column_abstract($table, $column); my $old_def = $self->get_column_abstract($table, $column);
my $specific = $self->{db_specific}; my $specific = $self->{db_specific};
# If the types have changed, we have to deal with that. # If the types have changed, we have to deal with that.
...@@ -2711,7 +2711,7 @@ sub delete_column { ...@@ -2711,7 +2711,7 @@ sub delete_column {
my ($self, $table, $column) = @_; my ($self, $table, $column) = @_;
my $abstract_fields = $self->{abstract_schema}{$table}{FIELDS}; my $abstract_fields = $self->{abstract_schema}{$table}{FIELDS};
my $name_position = firstidx { $_ eq $column } @$abstract_fields; my $name_position = firstidx { $_ eq $column } @$abstract_fields;
die "Attempted to delete nonexistent column ${table}.${column}" die "Attempted to delete nonexistent column ${table}.${column}"
if $name_position == -1; if $name_position == -1;
...@@ -2859,7 +2859,7 @@ sub _set_object { ...@@ -2859,7 +2859,7 @@ sub _set_object {
sub delete_index { sub delete_index {
my ($self, $table, $name) = @_; my ($self, $table, $name) = @_;
my $indexes = $self->{abstract_schema}{$table}{INDEXES}; my $indexes = $self->{abstract_schema}{$table}{INDEXES};
my $name_position = firstidx { $_ eq $name } @$indexes; my $name_position = firstidx { $_ eq $name } @$indexes;
die "Attempted to delete nonexistent index $name on the $table table" die "Attempted to delete nonexistent index $name on the $table table"
if $name_position == -1; if $name_position == -1;
......
...@@ -178,7 +178,7 @@ sub get_create_database_sql { ...@@ -178,7 +178,7 @@ sub get_create_database_sql {
# MySQL has a simpler ALTER TABLE syntax than ANSI. # MySQL has a simpler ALTER TABLE syntax than ANSI.
sub get_alter_column_ddl { sub get_alter_column_ddl {
my ($self, $table, $column, $new_def, $set_nulls_to) = @_; my ($self, $table, $column, $new_def, $set_nulls_to) = @_;
my $old_def = $self->get_column($table, $column); my $old_def = $self->get_column($table, $column);
my %new_def_copy = %$new_def; my %new_def_copy = %$new_def;
if ($old_def->{PRIMARYKEY} && $new_def->{PRIMARYKEY}) { if ($old_def->{PRIMARYKEY} && $new_def->{PRIMARYKEY}) {
......
...@@ -228,7 +228,7 @@ sub get_alter_column_ddl { ...@@ -228,7 +228,7 @@ sub get_alter_column_ddl {
my ($self, $table, $column, $new_def, $set_nulls_to) = @_; my ($self, $table, $column, $new_def, $set_nulls_to) = @_;
my @statements; my @statements;
my $old_def = $self->get_column_abstract($table, $column); my $old_def = $self->get_column_abstract($table, $column);
my $specific = $self->{db_specific}; my $specific = $self->{db_specific};
# If the types have changed, we have to deal with that. # If the types have changed, we have to deal with that.
......
...@@ -288,7 +288,7 @@ sub get_rename_column_ddl { ...@@ -288,7 +288,7 @@ sub get_rename_column_ddl {
sub get_add_fks_sql { sub get_add_fks_sql {
my ($self, $table, $column_fks) = @_; my ($self, $table, $column_fks) = @_;
my @clauses = $self->_sqlite_table_lines($table); my @clauses = $self->_sqlite_table_lines($table);
my @add = $self->_column_fks_to_ddl($table, $column_fks); my @add = $self->_column_fks_to_ddl($table, $column_fks);
push(@clauses, @add); push(@clauses, @add);
return $self->_sqlite_alter_schema($table, \@clauses); return $self->_sqlite_alter_schema($table, \@clauses);
} }
......
...@@ -250,7 +250,7 @@ sub bz_setup_database { ...@@ -250,7 +250,7 @@ sub bz_setup_database {
# If we created TheSchwartz tables with COLLATE bugzilla (during the # If we created TheSchwartz tables with COLLATE bugzilla (during the
# 4.1.x development series) re-create them without it. # 4.1.x development series) re-create them without it.
my @tables = $self->bz_table_list(); my @tables = $self->bz_table_list();
my @ts_tables = grep {/^ts_/} @tables; my @ts_tables = grep {/^ts_/} @tables;
my $drop_ok; my $drop_ok;
foreach my $table (@ts_tables) { foreach my $table (@ts_tables) {
......
...@@ -155,7 +155,7 @@ sub my_inc { ...@@ -155,7 +155,7 @@ sub my_inc {
# a "require" on Windows, for example.) # a "require" on Windows, for example.)
return if $file !~ /^Bugzilla/; return if $file !~ /^Bugzilla/;
my $lib_dir = __do_call($class, 'lib_dir'); my $lib_dir = __do_call($class, 'lib_dir');
my @class_parts = split('::', $class); my @class_parts = split('::', $class);
my ($vol, $dir, $file_name) = File::Spec->splitpath($file); my ($vol, $dir, $file_name) = File::Spec->splitpath($file);
my @dir_parts = File::Spec->splitdir($dir); my @dir_parts = File::Spec->splitdir($dir);
...@@ -190,7 +190,7 @@ sub my_inc { ...@@ -190,7 +190,7 @@ sub my_inc {
use constant enabled => 1; use constant enabled => 1;
sub lib_dir { sub lib_dir {
my $invocant = shift; my $invocant = shift;
my $package_dir = __do_call($invocant, 'package_dir'); my $package_dir = __do_call($invocant, 'package_dir');
# For extensions that are just files in the extensions/ directory, # For extensions that are just files in the extensions/ directory,
......
...@@ -153,7 +153,7 @@ use constant SQL_DEFINITIONS => { ...@@ -153,7 +153,7 @@ use constant SQL_DEFINITIONS => {
{TYPE => 'varchar(64)', NOTNULL => 1, DEFAULT => "'---'"}, FIELD_TYPE_TEXTAREA, {TYPE => 'varchar(64)', NOTNULL => 1, DEFAULT => "'---'"}, FIELD_TYPE_TEXTAREA,
{TYPE => 'MEDIUMTEXT', NOTNULL => 1, DEFAULT => "''"}, FIELD_TYPE_DATETIME, {TYPE => 'MEDIUMTEXT', NOTNULL => 1, DEFAULT => "''"}, FIELD_TYPE_DATETIME,
{TYPE => 'DATETIME'}, FIELD_TYPE_DATE, {TYPE => 'DATE'}, FIELD_TYPE_BUG_ID, {TYPE => 'DATETIME'}, FIELD_TYPE_DATE, {TYPE => 'DATE'}, FIELD_TYPE_BUG_ID,
{TYPE => 'INT3'}, FIELD_TYPE_INTEGER, {TYPE => 'INT3'}, FIELD_TYPE_INTEGER,
{TYPE => 'INT4', NOTNULL => 1, DEFAULT => 0}, {TYPE => 'INT4', NOTNULL => 1, DEFAULT => 0},
}; };
......
...@@ -77,7 +77,7 @@ use constant DEFAULT_MAP => { ...@@ -77,7 +77,7 @@ use constant DEFAULT_MAP => {
sub type { sub type {
my ($class, $field) = @_; my ($class, $field) = @_;
my $field_obj = blessed $field ? $field : Bugzilla::Field->check($field); my $field_obj = blessed $field ? $field : Bugzilla::Field->check($field);
my $field_name = $field_obj->name; my $field_name = $field_obj->name;
if (my $package = $class->CLASS_MAP->{$field_name}) { if (my $package = $class->CLASS_MAP->{$field_name}) {
......
...@@ -450,7 +450,7 @@ sub create { ...@@ -450,7 +450,7 @@ sub create {
my ($class, $flag, $timestamp) = @_; my ($class, $flag, $timestamp) = @_;
$timestamp ||= Bugzilla->dbh->selectrow_array('SELECT LOCALTIMESTAMP(0)'); $timestamp ||= Bugzilla->dbh->selectrow_array('SELECT LOCALTIMESTAMP(0)');
my $params = {}; my $params = {};
my @columns = grep { $_ ne 'id' } $class->_get_db_columns; my @columns = grep { $_ ne 'id' } $class->_get_db_columns;
# Some columns use date formatting so use alias instead # Some columns use date formatting so use alias instead
...@@ -513,7 +513,7 @@ sub update_flags { ...@@ -513,7 +513,7 @@ sub update_flags {
my ($class, $self, $old_self, $timestamp) = @_; my ($class, $self, $old_self, $timestamp) = @_;
my @old_summaries = $class->snapshot($old_self->flags); my @old_summaries = $class->snapshot($old_self->flags);
my %old_flags = map { $_->id => $_ } @{$old_self->flags}; my %old_flags = map { $_->id => $_ } @{$old_self->flags};
foreach my $new_flag (@{$self->flags}) { foreach my $new_flag (@{$self->flags}) {
if (!$new_flag->id) { if (!$new_flag->id) {
...@@ -549,7 +549,7 @@ sub update_flags { ...@@ -549,7 +549,7 @@ sub update_flags {
} }
my @new_summaries = $class->snapshot($self->flags); my @new_summaries = $class->snapshot($self->flags);
my @changes = $class->update_activity(\@old_summaries, \@new_summaries); my @changes = $class->update_activity(\@old_summaries, \@new_summaries);
Bugzilla::Hook::process( Bugzilla::Hook::process(
'flag_end_of_update', 'flag_end_of_update',
...@@ -628,7 +628,7 @@ sub force_retarget { ...@@ -628,7 +628,7 @@ sub force_retarget {
foreach my $flag (@$flags) { foreach my $flag (@$flags) {
# $bug is undefined when e.g. editing inclusion and exclusion lists. # $bug is undefined when e.g. editing inclusion and exclusion lists.
my $obj = $flag->attachment || $bug || $flag->bug; my $obj = $flag->attachment || $bug || $flag->bug;
my $is_retargetted = $flag->retarget($obj); my $is_retargetted = $flag->retarget($obj);
if ($is_retargetted) { if ($is_retargetted) {
$dbh->do('UPDATE flags SET type_id = ? WHERE id = ?', $dbh->do('UPDATE flags SET type_id = ? WHERE id = ?',
......
...@@ -615,7 +615,7 @@ sub match { ...@@ -615,7 +615,7 @@ sub match {
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
# Depending on the criteria, we may have to append additional tables. # Depending on the criteria, we may have to append additional tables.
my $tables = [DB_TABLE]; my $tables = [DB_TABLE];
my @criteria = sqlify_criteria($criteria, $tables); my @criteria = sqlify_criteria($criteria, $tables);
$tables = join(' ', @$tables); $tables = join(' ', @$tables);
$criteria = join(' AND ', @criteria); $criteria = join(' AND ', @criteria);
...@@ -643,7 +643,7 @@ sub count { ...@@ -643,7 +643,7 @@ sub count {
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
# Depending on the criteria, we may have to append additional tables. # Depending on the criteria, we may have to append additional tables.
my $tables = [DB_TABLE]; my $tables = [DB_TABLE];
my @criteria = sqlify_criteria($criteria, $tables); my @criteria = sqlify_criteria($criteria, $tables);
$tables = join(' ', @$tables); $tables = join(' ', @$tables);
$criteria = join(' AND ', @criteria); $criteria = join(' AND ', @criteria);
......
...@@ -180,7 +180,7 @@ sub check_members_are_visible { ...@@ -180,7 +180,7 @@ sub check_members_are_visible {
my $user = Bugzilla->user; my $user = Bugzilla->user;
return if !Bugzilla->params->{'usevisibilitygroups'}; return if !Bugzilla->params->{'usevisibilitygroups'};
my $group_id = $self->id; my $group_id = $self->id;
my $is_visible = grep { $_ == $group_id } @{$user->visible_groups_inherited}; my $is_visible = grep { $_ == $group_id } @{$user->visible_groups_inherited};
if (!$is_visible) { if (!$is_visible) {
ThrowUserError('group_not_visible', {group => $self}); ThrowUserError('group_not_visible', {group => $self});
......
...@@ -26,7 +26,7 @@ sub process { ...@@ -26,7 +26,7 @@ sub process {
} }
sub in { sub in {
my $hook_name = shift; my $hook_name = shift;
my $currently_in = Bugzilla->request_cache->{hook_stack}->[-1] || ''; my $currently_in = Bugzilla->request_cache->{hook_stack}->[-1] || '';
return $hook_name eq $currently_in ? 1 : 0; return $hook_name eq $currently_in ? 1 : 0;
} }
......
...@@ -1843,8 +1843,7 @@ sub _convert_groups_system_from_groupset { ...@@ -1843,8 +1843,7 @@ sub _convert_groups_system_from_groupset {
my ($admin_gid) my ($admin_gid)
= $dbh->selectrow_array("SELECT id FROM groups WHERE name = 'admin'"); = $dbh->selectrow_array("SELECT id FROM groups WHERE name = 'admin'");
if (!$admin_gid) { if (!$admin_gid) {
$dbh->do( $dbh->do(q{INSERT INTO groups (name, description)
q{INSERT INTO groups (name, description)
VALUES ('admin', 'Administrators')} VALUES ('admin', 'Administrators')}
); );
$admin_gid = $dbh->bz_last_key('groups', 'id'); $admin_gid = $dbh->bz_last_key('groups', 'id');
...@@ -2255,7 +2254,7 @@ sub _copy_old_charts_into_database { ...@@ -2255,7 +2254,7 @@ sub _copy_old_charts_into_database {
# We also add a new query for "Open", so that migrated products get # We also add a new query for "Open", so that migrated products get
# the same set as new products (see editproducts.cgi.) # the same set as new products (see editproducts.cgi.)
my @openedstatuses = ("UNCONFIRMED", "NEW", "ASSIGNED", "REOPENED"); my @openedstatuses = ("UNCONFIRMED", "NEW", "ASSIGNED", "REOPENED");
my $query = join("&", map {"bug_status=$_"} @openedstatuses); my $query = join("&", map {"bug_status=$_"} @openedstatuses);
my $series my $series
= new Bugzilla::Series(undef, $product, $all_name, $open_name, undef, 1, = new Bugzilla::Series(undef, $product, $all_name, $open_name, undef, 1,
$query_prod . $query, 1); $query_prod . $query, 1);
...@@ -3362,8 +3361,7 @@ sub _initialize_workflow_for_upgrade { ...@@ -3362,8 +3361,7 @@ sub _initialize_workflow_for_upgrade {
sub _make_lang_setting_dynamic { sub _make_lang_setting_dynamic {
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my $count = $dbh->selectrow_array( my $count = $dbh->selectrow_array(q{SELECT 1 FROM setting
q{SELECT 1 FROM setting
WHERE name = 'lang' WHERE name = 'lang'
AND subclass IS NULL} AND subclass IS NULL}
); );
...@@ -3654,7 +3652,7 @@ sub _set_attachment_comment_type { ...@@ -3654,7 +3652,7 @@ sub _set_attachment_comment_type {
my $text = $comments{$id}; my $text = $comments{$id};
next if $text !~ /^\Q$string\E(\d+)/; next if $text !~ /^\Q$string\E(\d+)/;
my $attachment_id = $1; my $attachment_id = $1;
my @lines = split("\n", $text); my @lines = split("\n", $text);
if ($type == CMT_ATTACHMENT_CREATED) { if ($type == CMT_ATTACHMENT_CREATED) {
# Now we have to remove the text up until we find a line that's # Now we have to remove the text up until we find a line that's
...@@ -3723,7 +3721,7 @@ sub _convert_flagtypes_fks_to_set_null { ...@@ -3723,7 +3721,7 @@ sub _convert_flagtypes_fks_to_set_null {
} }
sub _fix_decimal_types { sub _fix_decimal_types {
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my $type = {TYPE => 'decimal(7,2)', NOTNULL => 1, DEFAULT => '0'}; my $type = {TYPE => 'decimal(7,2)', NOTNULL => 1, DEFAULT => '0'};
$dbh->bz_alter_column('bugs', 'estimated_time', $type); $dbh->bz_alter_column('bugs', 'estimated_time', $type);
$dbh->bz_alter_column('bugs', 'remaining_time', $type); $dbh->bz_alter_column('bugs', 'remaining_time', $type);
...@@ -3732,7 +3730,7 @@ sub _fix_decimal_types { ...@@ -3732,7 +3730,7 @@ sub _fix_decimal_types {
sub _fix_series_creator_fk { sub _fix_series_creator_fk {
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my $fk = $dbh->bz_fk_info('series', 'creator'); my $fk = $dbh->bz_fk_info('series', 'creator');
if ($fk and $fk->{DELETE} eq 'SET NULL') { if ($fk and $fk->{DELETE} eq 'SET NULL') {
$fk->{DELETE} = 'CASCADE'; $fk->{DELETE} = 'CASCADE';
$dbh->bz_alter_fk('series', 'creator', $fk); $dbh->bz_alter_fk('series', 'creator', $fk);
...@@ -3889,7 +3887,7 @@ sub _migrate_user_tags { ...@@ -3889,7 +3887,7 @@ sub _migrate_user_tags {
indicate_progress({current => ++$current, total => $total, every => 25}); indicate_progress({current => ++$current, total => $total, every => 25});
my $uri = URI->new("buglist.cgi?$query", 'http'); my $uri = URI->new("buglist.cgi?$query", 'http');
my $bug_id_list = $uri->query_param_delete('bug_id'); my $bug_id_list = $uri->query_param_delete('bug_id');
if (!$bug_id_list) { if (!$bug_id_list) {
warn "No bug_id param for tag $name from user $user_id: $query"; warn "No bug_id param for tag $name from user $user_id: $query";
...@@ -3986,7 +3984,7 @@ sub _rename_tags_to_tag { ...@@ -3986,7 +3984,7 @@ sub _rename_tags_to_tag {
sub _on_delete_set_null_for_audit_log_userid { sub _on_delete_set_null_for_audit_log_userid {
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my $fk = $dbh->bz_fk_info('audit_log', 'user_id'); my $fk = $dbh->bz_fk_info('audit_log', 'user_id');
if ($fk and !defined $fk->{DELETE}) { if ($fk and !defined $fk->{DELETE}) {
$fk->{DELETE} = 'SET NULL'; $fk->{DELETE} = 'SET NULL';
$dbh->bz_alter_fk('audit_log', 'user_id', $fk); $dbh->bz_alter_fk('audit_log', 'user_id', $fk);
...@@ -4027,7 +4025,7 @@ sub _fix_longdescs_primary_key { ...@@ -4027,7 +4025,7 @@ sub _fix_longdescs_primary_key {
} }
sub _fix_longdescs_indexes { sub _fix_longdescs_indexes {
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my $bug_id_idx = $dbh->bz_index_info('longdescs', 'longdescs_bug_id_idx'); my $bug_id_idx = $dbh->bz_index_info('longdescs', 'longdescs_bug_id_idx');
if ($bug_id_idx && scalar @{$bug_id_idx->{'FIELDS'}} < 2) { if ($bug_id_idx && scalar @{$bug_id_idx->{'FIELDS'}} < 2) {
$dbh->bz_drop_index('longdescs', 'longdescs_bug_id_idx'); $dbh->bz_drop_index('longdescs', 'longdescs_bug_id_idx');
...@@ -4126,7 +4124,7 @@ sub _add_password_salt_separator { ...@@ -4126,7 +4124,7 @@ sub _add_password_salt_separator {
sub _fix_flagclusions_indexes { sub _fix_flagclusions_indexes {
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
foreach my $table ('flaginclusions', 'flagexclusions') { foreach my $table ('flaginclusions', 'flagexclusions') {
my $index = $table . '_type_id_idx'; my $index = $table . '_type_id_idx';
my $idx_info = $dbh->bz_index_info($table, $index); my $idx_info = $dbh->bz_index_info($table, $index);
if ($idx_info && $idx_info->{'TYPE'} ne 'UNIQUE') { if ($idx_info && $idx_info->{'TYPE'} ne 'UNIQUE') {
...@@ -4187,8 +4185,7 @@ sub _update_alias { ...@@ -4187,8 +4185,7 @@ sub _update_alias {
return unless $dbh->bz_column_info('bugs', 'alias'); return unless $dbh->bz_column_info('bugs', 'alias');
# We need to move the aliases from the bugs table to the bugs_aliases table # We need to move the aliases from the bugs table to the bugs_aliases table
$dbh->do( $dbh->do(q{
q{
INSERT INTO bugs_aliases (bug_id, alias) INSERT INTO bugs_aliases (bug_id, alias)
SELECT bug_id, alias FROM bugs WHERE alias IS NOT NULL SELECT bug_id, alias FROM bugs WHERE alias IS NOT NULL
} }
......
...@@ -459,7 +459,7 @@ EOT ...@@ -459,7 +459,7 @@ EOT
); );
my %all_files = (%create_files, %htaccess, %index_html, %files); my %all_files = (%create_files, %htaccess, %index_html, %files);
my %all_dirs = (%create_dirs, %non_recurse_dirs); my %all_dirs = (%create_dirs, %non_recurse_dirs);
return { return {
create_dirs => \%create_dirs, create_dirs => \%create_dirs,
...@@ -683,7 +683,7 @@ sub _create_files { ...@@ -683,7 +683,7 @@ sub _create_files {
unless (-e $file) { unless (-e $file) {
print "Creating $file...\n"; print "Creating $file...\n";
my $info = $files{$file}; my $info = $files{$file};
my $fh = new IO::File($file, O_WRONLY | O_CREAT, $info->{perms}) || die $!; my $fh = new IO::File($file, O_WRONLY | O_CREAT, $info->{perms}) || die $!;
print $fh $info->{contents} if $info->{contents}; print $fh $info->{contents} if $info->{contents};
$fh->close; $fh->close;
} }
......
...@@ -63,14 +63,12 @@ use constant APACHE => qw(apachectl httpd apache2 apache); ...@@ -63,14 +63,12 @@ use constant APACHE => qw(apachectl httpd apache2 apache);
# If we don't find any of the above binaries in the normal PATH, # If we don't find any of the above binaries in the normal PATH,
# these are extra places we look. # these are extra places we look.
use constant APACHE_PATH => [ use constant APACHE_PATH => [qw(
qw(
/usr/sbin /usr/sbin
/usr/local/sbin /usr/local/sbin
/usr/libexec /usr/libexec
/usr/local/libexec /usr/local/libexec
) )];
];
# The below two constants are subroutines so that they can implement # The below two constants are subroutines so that they can implement
# a hook. Other than that they are actually constants. # a hook. Other than that they are actually constants.
...@@ -475,7 +473,7 @@ sub check_requirements { ...@@ -475,7 +473,7 @@ sub check_requirements {
my ($output) = @_; my ($output) = @_;
print "\n", install_string('checking_modules'), "\n" if $output; print "\n", install_string('checking_modules'), "\n" if $output;
my $root = ROOT_USER; my $root = ROOT_USER;
my $missing = _check_missing(REQUIRED_MODULES, $output); my $missing = _check_missing(REQUIRED_MODULES, $output);
print "\n", install_string('checking_dbd'), "\n" if $output; print "\n", install_string('checking_dbd'), "\n" if $output;
...@@ -608,7 +606,7 @@ sub print_module_instructions { ...@@ -608,7 +606,7 @@ sub print_module_instructions {
if (my @missing = @{$check_results->{apache}}) { if (my @missing = @{$check_results->{apache}}) {
print install_string('modules_message_apache'); print install_string('modules_message_apache');
my $missing_string = join(', ', @missing); my $missing_string = join(', ', @missing);
my $size = TABLE_WIDTH - 7; my $size = TABLE_WIDTH - 7;
printf "* \%-${size}s *\n", $missing_string; printf "* \%-${size}s *\n", $missing_string;
my $spaces = TABLE_WIDTH - 2; my $spaces = TABLE_WIDTH - 2;
print "*", (' ' x $spaces), "*\n"; print "*", (' ' x $spaces), "*\n";
......
...@@ -620,7 +620,7 @@ sub set_output_encoding { ...@@ -620,7 +620,7 @@ sub set_output_encoding {
sub init_console { sub init_console {
eval { ON_WINDOWS && require Win32::Console::ANSI; }; eval { ON_WINDOWS && require Win32::Console::ANSI; };
$ENV{'ANSI_COLORS_DISABLED'} = 1 if ($@ || !-t *STDOUT); $ENV{'ANSI_COLORS_DISABLED'} = 1 if ($@ || !-t *STDOUT);
$SIG{__DIE__} = \&_console_die; $SIG{__DIE__} = \&_console_die;
prevent_windows_dialog_boxes(); prevent_windows_dialog_boxes();
set_output_encoding(); set_output_encoding();
} }
......
...@@ -34,7 +34,7 @@ sub retry_delay { ...@@ -34,7 +34,7 @@ sub retry_delay {
sub work { sub work {
my ($class, $job) = @_; my ($class, $job) = @_;
my $msg = $job->arg->{msg}; my $msg = $job->arg->{msg};
my $success = eval { MessageToMTA($msg, 1); 1; }; my $success = eval { MessageToMTA($msg, 1); 1; };
if (!$success) { if (!$success) {
$job->failed($@); $job->failed($@);
......
...@@ -146,7 +146,7 @@ END ...@@ -146,7 +146,7 @@ END
else { else {
print "Please edit $dest_file to configure the daemon.\n"; print "Please edit $dest_file to configure the daemon.\n";
} }
} }
} }
sub gd_can_uninstall { sub gd_can_uninstall {
...@@ -160,7 +160,7 @@ sub gd_can_uninstall { ...@@ -160,7 +160,7 @@ sub gd_can_uninstall {
} }
system($chkconfig, '--del', $initscript); system($chkconfig, '--del', $initscript);
print "$initscript disabled.", " To stop it, run: $initd/$initscript stop\n"; print "$initscript disabled.", " To stop it, run: $initd/$initscript stop\n";
} }
} }
return $self->SUPER::gd_can_install(@_); return $self->SUPER::gd_can_install(@_);
......
...@@ -690,7 +690,7 @@ sub insert_bugs { ...@@ -690,7 +690,7 @@ sub insert_bugs {
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
say get_text('migrate_creating_bugs'); say get_text('migrate_creating_bugs');
my $init_statuses = Bugzilla::Status->can_change_to(); my $init_statuses = Bugzilla::Status->can_change_to();
my %allowed_statuses = map { lc($_->name) => 1 } @$init_statuses; my %allowed_statuses = map { lc($_->name) => 1 } @$init_statuses;
# Bypass the question of whether or not we can file UNCONFIRMED # Bypass the question of whether or not we can file UNCONFIRMED
......
...@@ -280,7 +280,7 @@ sub _read_products { ...@@ -280,7 +280,7 @@ sub _read_products {
my %product = (name => $name, description => $description); my %product = (name => $name, description => $description);
my @initial_cc = split(',', $cc); my @initial_cc = split(',', $cc);
@initial_cc = @{$self->translate_value('user', \@initial_cc)}; @initial_cc = @{$self->translate_value('user', \@initial_cc)};
$assigned_to = $self->translate_value('user', $assigned_to); $assigned_to = $self->translate_value('user', $assigned_to);
my %component = ( my %component = (
name => $self->config('component_name'), name => $self->config('component_name'),
......
...@@ -73,7 +73,7 @@ sub new { ...@@ -73,7 +73,7 @@ sub new {
} }
my $condition = 'product_id = ? AND value = ?'; my $condition = 'product_id = ? AND value = ?';
my @values = ($product->id, $name); my @values = ($product->id, $name);
$param = {condition => $condition, values => \@values}; $param = {condition => $condition, values => \@values};
} }
......
...@@ -301,7 +301,7 @@ sub check { ...@@ -301,7 +301,7 @@ sub check {
sub match { sub match {
my ($invocant, $criteria) = @_; my ($invocant, $criteria) = @_;
my $class = ref($invocant) || $invocant; my $class = ref($invocant) || $invocant;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
return [$class->get_all] if !$criteria; return [$class->get_all] if !$criteria;
...@@ -547,7 +547,7 @@ sub update { ...@@ -547,7 +547,7 @@ sub update {
Bugzilla->memcached->clear({table => $table, id => $self->id}); Bugzilla->memcached->clear({table => $table, id => $self->id});
Bugzilla->memcached->clear_config() if $self->IS_CONFIG; Bugzilla->memcached->clear_config() if $self->IS_CONFIG;
} }
$self->_object_cache_remove({id => $self->id}); $self->_object_cache_remove({id => $self->id});
$self->_object_cache_remove({name => $self->name}) if $self->name; $self->_object_cache_remove({name => $self->name}) if $self->name;
if (wantarray) { if (wantarray) {
...@@ -572,7 +572,7 @@ sub remove_from_db { ...@@ -572,7 +572,7 @@ sub remove_from_db {
Bugzilla->memcached->clear({table => $table, id => $self->id}); Bugzilla->memcached->clear({table => $table, id => $self->id});
Bugzilla->memcached->clear_config() if $self->IS_CONFIG; Bugzilla->memcached->clear_config() if $self->IS_CONFIG;
} }
$self->_object_cache_remove({id => $self->id}); $self->_object_cache_remove({id => $self->id});
$self->_object_cache_remove({name => $self->name}) if $self->name; $self->_object_cache_remove({name => $self->name}) if $self->name;
undef $self; undef $self;
} }
...@@ -595,7 +595,7 @@ sub audit_log { ...@@ -595,7 +595,7 @@ sub audit_log {
# We put the object's name in the "added" or "removed" field. # We put the object's name in the "added" or "removed" field.
# We do this thing with NAME_FIELD because $self->name returns # We do this thing with NAME_FIELD because $self->name returns
# the wrong thing for Bugzilla::User. # the wrong thing for Bugzilla::User.
my $name = $self->{$self->NAME_FIELD}; my $name = $self->{$self->NAME_FIELD};
my @added_removed = $changes eq AUDIT_CREATE ? (undef, $name) : ($name, undef); my @added_removed = $changes eq AUDIT_CREATE ? (undef, $name) : ($name, undef);
$sth->execute($user_id, $class, $self->id, $changes, @added_removed); $sth->execute($user_id, $class, $self->id, $changes, @added_removed);
return; return;
......
...@@ -112,7 +112,7 @@ sub create { ...@@ -112,7 +112,7 @@ sub create {
# of products. # of products.
sub preload { sub preload {
my ($products, $preload_flagtypes) = @_; my ($products, $preload_flagtypes) = @_;
my %prods = map { $_->id => $_ } @$products; my %prods = map { $_->id => $_ } @$products;
my @prod_ids = keys %prods; my @prod_ids = keys %prods;
return unless @prod_ids; return unless @prod_ids;
...@@ -120,7 +120,7 @@ sub preload { ...@@ -120,7 +120,7 @@ sub preload {
require Bugzilla::Component; require Bugzilla::Component;
foreach my $field (qw(component version milestone)) { foreach my $field (qw(component version milestone)) {
my $classname = "Bugzilla::" . ucfirst($field); my $classname = "Bugzilla::" . ucfirst($field);
my $objects = $classname->match({product_id => \@prod_ids}); my $objects = $classname->match({product_id => \@prod_ids});
# Now populate the products with this set of objects. # Now populate the products with this set of objects.
foreach my $obj (@$objects) { foreach my $obj (@$objects) {
...@@ -843,7 +843,7 @@ sub flag_types { ...@@ -843,7 +843,7 @@ sub flag_types {
# We cache flag types to avoid useless calls to get_clusions(). # We cache flag types to avoid useless calls to get_clusions().
my $cache = Bugzilla->request_cache->{flag_types_per_product} ||= {}; my $cache = Bugzilla->request_cache->{flag_types_per_product} ||= {};
$self->{flag_types} = {}; $self->{flag_types} = {};
my $prod_id = $self->id; my $prod_id = $self->id;
my $flagtypes = Bugzilla::FlagType::match({product_id => $prod_id}); my $flagtypes = Bugzilla::FlagType::match({product_id => $prod_id});
foreach my $type ('bug', 'attachment') { foreach my $type ('bug', 'attachment') {
......
...@@ -412,7 +412,7 @@ use constant COLUMN_DEPENDS => { ...@@ -412,7 +412,7 @@ use constant COLUMN_DEPENDS => {
# fields it needs a little help. # fields it needs a little help.
sub COLUMN_JOINS { sub COLUMN_JOINS {
my $invocant = shift; my $invocant = shift;
my $user = blessed($invocant) ? $invocant->_user : Bugzilla->user; my $user = blessed($invocant) ? $invocant->_user : Bugzilla->user;
my $joins = { my $joins = {
actual_time => { actual_time => {
...@@ -614,7 +614,7 @@ sub COLUMNS { ...@@ -614,7 +614,7 @@ sub COLUMNS {
sub REPORT_COLUMNS { sub REPORT_COLUMNS {
my $invocant = shift; my $invocant = shift;
my $user = blessed($invocant) ? $invocant->_user : Bugzilla->user; my $user = blessed($invocant) ? $invocant->_user : Bugzilla->user;
my $columns = dclone(blessed($invocant) ? $invocant->COLUMNS : COLUMNS); my $columns = dclone(blessed($invocant) ? $invocant->COLUMNS : COLUMNS);
...@@ -658,7 +658,7 @@ use constant GROUP_BY_SKIP => qw( ...@@ -658,7 +658,7 @@ use constant GROUP_BY_SKIP => qw(
# Note that the params argument may be modified by Bugzilla::Search # Note that the params argument may be modified by Bugzilla::Search
sub new { sub new {
my $invocant = shift; my $invocant = shift;
my $class = ref($invocant) || $invocant; my $class = ref($invocant) || $invocant;
my $self = {@_}; my $self = {@_};
bless($self, $class); bless($self, $class);
...@@ -674,7 +674,7 @@ sub new { ...@@ -674,7 +674,7 @@ sub new {
# do it, because there's no way to know if we were passed a tied hash # do it, because there's no way to know if we were passed a tied hash
# or not. # or not.
my $params_in = $self->_params; my $params_in = $self->_params;
my %params = map { $_ => $params_in->{$_} } keys %$params_in; my %params = map { $_ => $params_in->{$_} } keys %$params_in;
$self->{params} = \%params; $self->{params} = \%params;
return $self; return $self;
...@@ -707,7 +707,7 @@ sub data { ...@@ -707,7 +707,7 @@ sub data {
my $sql = $self->_sql; my $sql = $self->_sql;
# Do we just want bug IDs to pass to the 2nd query or all the data immediately? # Do we just want bug IDs to pass to the 2nd query or all the data immediately?
my $func = $all_in_bugs_table ? 'selectall_arrayref' : 'selectcol_arrayref'; my $func = $all_in_bugs_table ? 'selectall_arrayref' : 'selectcol_arrayref';
my $bug_ids = $dbh->$func($sql); my $bug_ids = $dbh->$func($sql);
my @extra_data = ({sql => $sql, time => tv_interval($start_time)}); my @extra_data = ({sql => $sql, time => tv_interval($start_time)});
...@@ -806,13 +806,13 @@ sub search_description { ...@@ -806,13 +806,13 @@ sub search_description {
sub boolean_charts_to_custom_search { sub boolean_charts_to_custom_search {
my ($self, $cgi_buffer) = @_; my ($self, $cgi_buffer) = @_;
my $boolean_charts = $self->_boolean_charts; my $boolean_charts = $self->_boolean_charts;
my @as_params = $boolean_charts ? $boolean_charts->as_params : (); my @as_params = $boolean_charts ? $boolean_charts->as_params : ();
# We need to start our new ids after the last custom search "f" id. # We need to start our new ids after the last custom search "f" id.
# We can just pick the last id in the array because they are sorted # We can just pick the last id in the array because they are sorted
# numerically. # numerically.
my $last_id = ($self->_field_ids)[-1]; my $last_id = ($self->_field_ids)[-1];
my $count = defined($last_id) ? $last_id + 1 : 0; my $count = defined($last_id) ? $last_id + 1 : 0;
foreach my $param_set (@as_params) { foreach my $param_set (@as_params) {
foreach my $name (keys %$param_set) { foreach my $name (keys %$param_set) {
my $value = $param_set->{$name}; my $value = $param_set->{$name};
...@@ -1329,7 +1329,7 @@ sub _sql_where { ...@@ -1329,7 +1329,7 @@ sub _sql_where {
# The newline and this particular spacing makes the resulting # The newline and this particular spacing makes the resulting
# SQL a bit more readable for debugging. # SQL a bit more readable for debugging.
my $where = join("\n AND ", $self->_standard_where); my $where = join("\n AND ", $self->_standard_where);
my $clause_sql = $main_clause->as_string; my $clause_sql = $main_clause->as_string;
$where .= "\n AND " . $clause_sql if $clause_sql; $where .= "\n AND " . $clause_sql if $clause_sql;
return $where; return $where;
...@@ -1685,7 +1685,7 @@ sub _boolean_charts { ...@@ -1685,7 +1685,7 @@ sub _boolean_charts {
my @param_list = keys %$params; my @param_list = keys %$params;
my @all_field_params = grep {/^field-?\d+/} @param_list; my @all_field_params = grep {/^field-?\d+/} @param_list;
my @chart_ids = map { /^field(-?\d+)/; $1 } @all_field_params; my @chart_ids = map { /^field(-?\d+)/; $1 } @all_field_params;
@chart_ids = sort { $a <=> $b } uniq @chart_ids; @chart_ids = sort { $a <=> $b } uniq @chart_ids;
my $clause = new Bugzilla::Search::Clause(); my $clause = new Bugzilla::Search::Clause();
...@@ -1776,7 +1776,7 @@ sub _field_ids { ...@@ -1776,7 +1776,7 @@ sub _field_ids {
my @param_list = keys %$params; my @param_list = keys %$params;
my @field_params = grep {/^f\d+$/} @param_list; my @field_params = grep {/^f\d+$/} @param_list;
my @field_ids = map { /(\d+)/; $1 } @field_params; my @field_ids = map { /(\d+)/; $1 } @field_params;
@field_ids = sort { $a <=> $b } @field_ids; @field_ids = sort { $a <=> $b } @field_ids;
return @field_ids; return @field_ids;
} }
...@@ -2843,7 +2843,7 @@ sub _multiselect_negative { ...@@ -2843,7 +2843,7 @@ sub _multiselect_negative {
my ($field, $operator) = @$args{qw(field operator)}; my ($field, $operator) = @$args{qw(field operator)};
$args->{operator} = $self->_reverse_operator($operator); $args->{operator} = $self->_reverse_operator($operator);
$args->{term} = $self->_multiselect_term($args, 1); $args->{term} = $self->_multiselect_term($args, 1);
} }
sub _multiselect_multiple { sub _multiselect_multiple {
...@@ -2968,7 +2968,7 @@ sub _multiselect_table { ...@@ -2968,7 +2968,7 @@ sub _multiselect_table {
} }
elsif ($field eq 'longdesc') { elsif ($field eq 'longdesc') {
$args->{_extra_where} = " AND isprivate = 0" if !$self->_user->is_insider; $args->{_extra_where} = " AND isprivate = 0" if !$self->_user->is_insider;
$args->{full_field} = 'thetext'; $args->{full_field} = 'thetext';
return "longdescs"; return "longdescs";
} }
elsif ($field eq 'longdescs.isprivate') { elsif ($field eq 'longdescs.isprivate') {
...@@ -3284,7 +3284,7 @@ sub _changedbefore_changedafter { ...@@ -3284,7 +3284,7 @@ sub _changedbefore_changedafter {
} }
my $sql_operator = ($operator =~ /before/) ? '<=' : '>='; my $sql_operator = ($operator =~ /before/) ? '<=' : '>=';
my $field_id = $field_object->id; my $field_id = $field_object->id;
# Charts on changed* fields need to be field-specific. Otherwise, # Charts on changed* fields need to be field-specific. Otherwise,
# OR chart rows make no sense if they contain multiple fields. # OR chart rows make no sense if they contain multiple fields.
...@@ -3308,7 +3308,7 @@ sub _changedfrom_changedto { ...@@ -3308,7 +3308,7 @@ sub _changedfrom_changedto {
my ($chart_id, $joins, $field, $operator, $quoted) my ($chart_id, $joins, $field, $operator, $quoted)
= @$args{qw(chart_id joins field operator quoted)}; = @$args{qw(chart_id joins field operator quoted)};
my $column = ($operator =~ /from/) ? 'removed' : 'added'; my $column = ($operator =~ /from/) ? 'removed' : 'added';
my $field_object = $self->_chart_fields->{$field} my $field_object = $self->_chart_fields->{$field}
|| ThrowCodeError("invalid_field_name", {field => $field}); || ThrowCodeError("invalid_field_name", {field => $field});
my $field_id = $field_object->id; my $field_id = $field_object->id;
......
...@@ -85,12 +85,10 @@ sub FIELD_MAP { ...@@ -85,12 +85,10 @@ sub FIELD_MAP {
# Also, don't allow searching the _accessible stuff via quicksearch # Also, don't allow searching the _accessible stuff via quicksearch
# (both because it's unnecessary and because otherwise # (both because it's unnecessary and because otherwise
# "reporter_accessible" and "reporter" both match "rep". # "reporter_accessible" and "reporter" both match "rep".
delete @full_map{ delete @full_map{qw(rep_platform bug_status bug_file_loc bug_group
qw(rep_platform bug_status bug_file_loc bug_group
bug_severity bug_status bug_severity bug_status
status_whiteboard status_whiteboard
cclist_accessible reporter_accessible) cclist_accessible reporter_accessible)};
};
Bugzilla::Hook::process('quicksearch_map', {'map' => \%full_map}); Bugzilla::Hook::process('quicksearch_map', {'map' => \%full_map});
...@@ -256,7 +254,7 @@ sub quicksearch { ...@@ -256,7 +254,7 @@ sub quicksearch {
} }
# List of quicksearch-specific CGI parameters to get rid of. # List of quicksearch-specific CGI parameters to get rid of.
my @params_to_strip = ('quicksearch', 'load', 'run'); my @params_to_strip = ('quicksearch', 'load', 'run');
my $modified_query_string = $cgi->canonicalise_query(@params_to_strip); my $modified_query_string = $cgi->canonicalise_query(@params_to_strip);
if ($cgi->param('load')) { if ($cgi->param('load')) {
...@@ -379,7 +377,7 @@ sub _handle_special_first_chars { ...@@ -379,7 +377,7 @@ sub _handle_special_first_chars {
return 0 if !defined $qsword || length($qsword) <= 1; return 0 if !defined $qsword || length($qsword) <= 1;
my $firstChar = substr($qsword, 0, 1); my $firstChar = substr($qsword, 0, 1);
my $baseWord = substr($qsword, 1); my $baseWord = substr($qsword, 1);
my @subWords = split(/,/, $baseWord); my @subWords = split(/,/, $baseWord);
if ($firstChar eq '#') { if ($firstChar eq '#') {
...@@ -507,7 +505,7 @@ sub _translate_field_name { ...@@ -507,7 +505,7 @@ sub _translate_field_name {
# Check if we match, as a starting substring, exactly one field. # Check if we match, as a starting substring, exactly one field.
my @field_names = keys %$field_map; my @field_names = keys %$field_map;
my @matches = grep { $_ =~ /^\Q$field\E/ } @field_names; my @matches = grep { $_ =~ /^\Q$field\E/ } @field_names;
# Eliminate duplicates that are actually the same field # Eliminate duplicates that are actually the same field
# (otherwise "assi" matches both "assignee" and "assigned_to", and # (otherwise "assi" matches both "assignee" and "assigned_to", and
......
...@@ -66,7 +66,7 @@ sub new { ...@@ -66,7 +66,7 @@ sub new {
ThrowCodeError('bad_arg', {argument => 'name', function => "${class}::new"}); ThrowCodeError('bad_arg', {argument => 'name', function => "${class}::new"});
} }
my $condition = 'userid = ? AND name = ?'; my $condition = 'userid = ? AND name = ?';
my $user_id = blessed $user ? $user->id : $user; my $user_id = blessed $user ? $user->id : $user;
detaint_natural($user_id) detaint_natural($user_id)
|| ThrowCodeError('param_must_be_numeric', || ThrowCodeError('param_must_be_numeric',
{function => $class . '::_init', param => 'user'}); {function => $class . '::_init', param => 'user'});
...@@ -206,7 +206,7 @@ sub preload { ...@@ -206,7 +206,7 @@ sub preload {
return unless scalar @$searches; return unless scalar @$searches;
my @query_ids = map { $_->id } @$searches; my @query_ids = map { $_->id } @$searches;
my $queries_in_footer = $dbh->selectcol_arrayref( my $queries_in_footer = $dbh->selectcol_arrayref(
'SELECT namedquery_id 'SELECT namedquery_id
FROM namedqueries_link_in_footer FROM namedqueries_link_in_footer
...@@ -252,7 +252,7 @@ sub link_in_footer { ...@@ -252,7 +252,7 @@ sub link_in_footer {
# We only cache link_in_footer for the current Bugzilla->user. # We only cache link_in_footer for the current Bugzilla->user.
return $self->{link_in_footer} if exists $self->{link_in_footer} && !$user; return $self->{link_in_footer} if exists $self->{link_in_footer} && !$user;
my $user_id = $user ? $user->id : Bugzilla->user->id; my $user_id = $user ? $user->id : Bugzilla->user->id;
my $link_in_footer = Bugzilla->dbh->selectrow_array( my $link_in_footer = Bugzilla->dbh->selectrow_array(
'SELECT 1 FROM namedqueries_link_in_footer 'SELECT 1 FROM namedqueries_link_in_footer
WHERE namedquery_id = ? AND user_id = ?', undef, $self->id, $user_id WHERE namedquery_id = ? AND user_id = ?', undef, $self->id, $user_id
......
...@@ -28,7 +28,7 @@ use constant ID_FIELD => 'series_id'; ...@@ -28,7 +28,7 @@ use constant ID_FIELD => 'series_id';
sub new { sub new {
my $invocant = shift; my $invocant = shift;
my $class = ref($invocant) || $invocant; my $class = ref($invocant) || $invocant;
# Create a ref to an empty hash and bless it # Create a ref to an empty hash and bless it
my $self = {}; my $self = {};
......
...@@ -90,7 +90,7 @@ sub _load_constants { ...@@ -90,7 +90,7 @@ sub _load_constants {
# If no Accept-Language is present it uses the defined default # If no Accept-Language is present it uses the defined default
# Templates may also be found in the extensions/ tree # Templates may also be found in the extensions/ tree
sub _include_path { sub _include_path {
my $lang = shift || ''; my $lang = shift || '';
my $cache = Bugzilla->request_cache; my $cache = Bugzilla->request_cache;
$cache->{"template_include_path_$lang"} $cache->{"template_include_path_$lang"}
||= template_include_path({language => $lang}); ||= template_include_path({language => $lang});
...@@ -381,7 +381,7 @@ sub multiline_sprintf { ...@@ -381,7 +381,7 @@ sub multiline_sprintf {
my @parts; my @parts;
my @my_sizes = @$sizes; # Copy this so we don't modify the input array. my @my_sizes = @$sizes; # Copy this so we don't modify the input array.
foreach my $string (@$args) { foreach my $string (@$args) {
my $size = shift @my_sizes; my $size = shift @my_sizes;
my @pieces = split("\n", wrap_hard($string, $size)); my @pieces = split("\n", wrap_hard($string, $size));
push(@parts, \@pieces); push(@parts, \@pieces);
} }
...@@ -782,7 +782,7 @@ sub create { ...@@ -782,7 +782,7 @@ sub create {
my ($context, $isinactive) = @_; my ($context, $isinactive) = @_;
return sub { return sub {
return $isinactive ? '<span class="bz_inactive">' . $_[0] . '</span>' : $_[0]; return $isinactive ? '<span class="bz_inactive">' . $_[0] . '</span>' : $_[0];
} }
}, },
1 1
], ],
...@@ -792,7 +792,7 @@ sub create { ...@@ -792,7 +792,7 @@ sub create {
my ($context, $isclosed) = @_; my ($context, $isclosed) = @_;
return sub { return sub {
return $isclosed ? '<span class="bz_closed">' . $_[0] . '</span>' : $_[0]; return $isclosed ? '<span class="bz_closed">' . $_[0] . '</span>' : $_[0];
} }
}, },
1 1
], ],
...@@ -802,7 +802,7 @@ sub create { ...@@ -802,7 +802,7 @@ sub create {
my ($context, $isobsolete) = @_; my ($context, $isobsolete) = @_;
return sub { return sub {
return $isobsolete ? '<span class="bz_obsolete">' . $_[0] . '</span>' : $_[0]; return $isobsolete ? '<span class="bz_obsolete">' . $_[0] . '</span>' : $_[0];
} }
}, },
1 1
], ],
......
...@@ -153,16 +153,14 @@ sub _update_groups { ...@@ -153,16 +153,14 @@ sub _update_groups {
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
# Update group settings. # Update group settings.
my $sth_add_mapping = $dbh->prepare( my $sth_add_mapping = $dbh->prepare(qq{INSERT INTO user_group_map (
qq{INSERT INTO user_group_map (
user_id, group_id, isbless, grant_type user_id, group_id, isbless, grant_type
) VALUES ( ) VALUES (
?, ?, ?, ? ?, ?, ?, ?
) )
} }
); );
my $sth_remove_mapping = $dbh->prepare( my $sth_remove_mapping = $dbh->prepare(qq{DELETE FROM user_group_map
qq{DELETE FROM user_group_map
WHERE user_id = ? WHERE user_id = ?
AND group_id = ? AND group_id = ?
AND isbless = ? AND isbless = ?
...@@ -753,7 +751,7 @@ sub save_last_search { ...@@ -753,7 +751,7 @@ sub save_last_search {
# prevents people from writing over their whole # prevents people from writing over their whole
# recent-search list by just refreshing a saved search # recent-search list by just refreshing a saved search
# (which doesn't have list_id in the header) over and over. # (which doesn't have list_id in the header) over and over.
my $list_string = join(',', @$bug_ids); my $list_string = join(',', @$bug_ids);
my $existing_search = Bugzilla::Search::Recent->match( my $existing_search = Bugzilla::Search::Recent->match(
{user_id => $self->id, bug_list => $list_string}); {user_id => $self->id, bug_list => $list_string});
...@@ -920,7 +918,7 @@ sub groups { ...@@ -920,7 +918,7 @@ sub groups {
# Add all its members to the FIFO check list # Add all its members to the FIFO check list
# %group_membership contains arrays of group members # %group_membership contains arrays of group members
# for all groups. Accessible by group number. # for all groups. Accessible by group number.
my $members = $group_membership{$member_id}; my $members = $group_membership{$member_id};
my @new_to_check = grep(!$checked_groups{$_}, @$members); my @new_to_check = grep(!$checked_groups{$_}, @$members);
push(@$groups_to_check, @new_to_check); push(@$groups_to_check, @new_to_check);
...@@ -1099,7 +1097,7 @@ sub get_products_by_permission { ...@@ -1099,7 +1097,7 @@ sub get_products_by_permission {
# We will restrict the list to products the user can see. # We will restrict the list to products the user can see.
my $selectable_products = $self->get_selectable_products; my $selectable_products = $self->get_selectable_products;
my @products = grep { $product_map{$_->id} } @$selectable_products; my @products = grep { $product_map{$_->id} } @$selectable_products;
return \@products; return \@products;
} }
...@@ -1181,7 +1179,7 @@ sub visible_bugs { ...@@ -1181,7 +1179,7 @@ sub visible_bugs {
# Bugzilla::Bug->update automatically removes updated bugs # Bugzilla::Bug->update automatically removes updated bugs
# from the cache to force them to be checked again. # from the cache to force them to be checked again.
my $visible_cache = $self->{_visible_bugs_cache} ||= {}; my $visible_cache = $self->{_visible_bugs_cache} ||= {};
my @check_ids = grep(!exists $visible_cache->{$_}, @bug_ids); my @check_ids = grep(!exists $visible_cache->{$_}, @bug_ids);
if (@check_ids) { if (@check_ids) {
foreach my $id (@check_ids) { foreach my $id (@check_ids) {
...@@ -1361,7 +1359,7 @@ sub get_selectable_classifications { ...@@ -1361,7 +1359,7 @@ sub get_selectable_classifications {
my ($self) = @_; my ($self) = @_;
if (!defined $self->{selectable_classifications}) { if (!defined $self->{selectable_classifications}) {
my $products = $self->get_selectable_products; my $products = $self->get_selectable_products;
my %class_ids = map { $_->classification_id => 1 } @$products; my %class_ids = map { $_->classification_id => 1 } @$products;
$self->{selectable_classifications} $self->{selectable_classifications}
...@@ -1540,7 +1538,7 @@ sub check_can_admin_product { ...@@ -1540,7 +1538,7 @@ sub check_can_admin_product {
sub check_can_admin_flagtype { sub check_can_admin_flagtype {
my ($self, $flagtype_id) = @_; my ($self, $flagtype_id) = @_;
my $flagtype = Bugzilla::FlagType->check({id => $flagtype_id}); my $flagtype = Bugzilla::FlagType->check({id => $flagtype_id});
my $can_fully_edit = 1; my $can_fully_edit = 1;
if (!$self->in_group('editcomponents')) { if (!$self->in_group('editcomponents')) {
...@@ -1704,13 +1702,11 @@ sub derive_regexp_groups { ...@@ -1704,13 +1702,11 @@ sub derive_regexp_groups {
); );
$sth->execute($id, GRANT_REGEXP); $sth->execute($id, GRANT_REGEXP);
my $group_insert = $dbh->prepare( my $group_insert = $dbh->prepare(q{INSERT INTO user_group_map
q{INSERT INTO user_group_map
(user_id, group_id, isbless, grant_type) (user_id, group_id, isbless, grant_type)
VALUES (?, ?, 0, ?)} VALUES (?, ?, 0, ?)}
); );
my $group_delete = $dbh->prepare( my $group_delete = $dbh->prepare(q{DELETE FROM user_group_map
q{DELETE FROM user_group_map
WHERE user_id = ? WHERE user_id = ?
AND group_id = ? AND group_id = ?
AND isbless = 0 AND isbless = 0
...@@ -1756,7 +1752,7 @@ sub product_responsibilities { ...@@ -1756,7 +1752,7 @@ sub product_responsibilities {
# We cannot |use| it, because Component.pm already |use|s User.pm. # We cannot |use| it, because Component.pm already |use|s User.pm.
require Bugzilla::Component; require Bugzilla::Component;
my @comp_ids = map { $_->{'id'} } @$list; my @comp_ids = map { $_->{'id'} } @$list;
my $components = Bugzilla::Component->new_from_list(\@comp_ids); my $components = Bugzilla::Component->new_from_list(\@comp_ids);
my @prod_list; my @prod_list;
...@@ -1888,8 +1884,8 @@ sub match { ...@@ -1888,8 +1884,8 @@ sub match {
} }
sub match_field { sub match_field {
my $fields = shift; # arguments as a hash my $fields = shift; # arguments as a hash
my $data = shift || Bugzilla->input_params; # hash to look up fields in my $data = shift || Bugzilla->input_params; # hash to look up fields in
my $behavior = shift || 0; # A constant that tells us how to act my $behavior = shift || 0; # A constant that tells us how to act
my $matches = {}; # the values sent to the template my $matches = {}; # the values sent to the template
my $matchsuccess = 1; # did the match fail? my $matchsuccess = 1; # did the match fail?
...@@ -2383,7 +2379,7 @@ sub create { ...@@ -2383,7 +2379,7 @@ sub create {
# Add the creation date to the profiles_activity table. # Add the creation date to the profiles_activity table.
# $who is the user who created the new user account, i.e. either an # $who is the user who created the new user account, i.e. either an
# admin or the new user himself. # admin or the new user himself.
my $who = Bugzilla->user->id || $user->id; my $who = Bugzilla->user->id || $user->id;
my $creation_date_fieldid = get_field_id('creation_ts'); my $creation_date_fieldid = get_field_id('creation_ts');
$dbh->do( $dbh->do(
...@@ -2536,7 +2532,7 @@ sub check_and_send_account_creation_confirmation { ...@@ -2536,7 +2532,7 @@ sub check_and_send_account_creation_confirmation {
# do check() and pull all the user data from the database. # do check() and pull all the user data from the database.
sub login_to_id { sub login_to_id {
my ($login, $throw_error) = @_; my ($login, $throw_error) = @_;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my $cache = Bugzilla->request_cache->{user_login_to_id} ||= {}; my $cache = Bugzilla->request_cache->{user_login_to_id} ||= {};
# We cache lookups because this function showed up as taking up a # We cache lookups because this function showed up as taking up a
......
...@@ -35,7 +35,7 @@ sub new { ...@@ -35,7 +35,7 @@ sub new {
my $setting_name = shift; my $setting_name = shift;
my $user_id = shift; my $user_id = shift;
my $class = ref($invocant) || $invocant; my $class = ref($invocant) || $invocant;
my $subclass = ''; my $subclass = '';
# Create a ref to an empty hash and bless it # Create a ref to an empty hash and bless it
...@@ -149,8 +149,7 @@ sub add_setting { ...@@ -149,8 +149,7 @@ sub add_setting {
VALUES (?, ?, 1, ?)}, undef, ($name, $default_value, $subclass) VALUES (?, ?, 1, ?)}, undef, ($name, $default_value, $subclass)
); );
my $sth = $dbh->prepare( my $sth = $dbh->prepare(q{INSERT INTO setting_value (name, value, sortindex)
q{INSERT INTO setting_value (name, value, sortindex)
VALUES (?, ?, ?)} VALUES (?, ?, ?)}
); );
...@@ -167,7 +166,7 @@ sub get_all_settings { ...@@ -167,7 +166,7 @@ sub get_all_settings {
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my $cache_key = "user_settings.$user_id"; my $cache_key = "user_settings.$user_id";
my $rows = Bugzilla->memcached->get_config({key => $cache_key}); my $rows = Bugzilla->memcached->get_config({key => $cache_key});
if (!$rows) { if (!$rows) {
$rows = $dbh->selectall_arrayref( $rows = $dbh->selectall_arrayref(
q{SELECT name, default_value, is_enabled, setting_value, subclass q{SELECT name, default_value, is_enabled, setting_value, subclass
...@@ -232,8 +231,7 @@ sub set_default { ...@@ -232,8 +231,7 @@ sub set_default {
my ($setting_name, $default_value, $is_enabled) = @_; my ($setting_name, $default_value, $is_enabled) = @_;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my $sth = $dbh->prepare( my $sth = $dbh->prepare(q{UPDATE setting
q{UPDATE setting
SET default_value = ?, is_enabled = ? SET default_value = ?, is_enabled = ?
WHERE name = ?} WHERE name = ?}
); );
......
...@@ -147,7 +147,7 @@ sub html_light_quote { ...@@ -147,7 +147,7 @@ sub html_light_quote {
if (!Bugzilla->feature('html_desc')) { if (!Bugzilla->feature('html_desc')) {
my $safe = join('|', @allow); my $safe = join('|', @allow);
my $chr = chr(1); my $chr = chr(1);
# First, escape safe elements. # First, escape safe elements.
$text =~ s#<($safe)>#$chr$1$chr#go; $text =~ s#<($safe)>#$chr$1$chr#go;
...@@ -168,7 +168,7 @@ sub html_light_quote { ...@@ -168,7 +168,7 @@ sub html_light_quote {
push(@allow, qw(a blockquote q span)); push(@allow, qw(a blockquote q span));
# Allowed protocols. # Allowed protocols.
my $safe_protocols = join('|', SAFE_PROTOCOLS); my $safe_protocols = join('|', SAFE_PROTOCOLS);
my $protocol_regexp = qr{(^(?:$safe_protocols):|^[^:]+$)}i; my $protocol_regexp = qr{(^(?:$safe_protocols):|^[^:]+$)}i;
# Deny all elements and attributes unless explicitly authorized. # Deny all elements and attributes unless explicitly authorized.
...@@ -225,7 +225,7 @@ sub email_filter { ...@@ -225,7 +225,7 @@ sub email_filter {
if (!Bugzilla->user->id) { if (!Bugzilla->user->id) {
my @emails = Email::Address->parse($toencode); my @emails = Email::Address->parse($toencode);
if (scalar @emails) { if (scalar @emails) {
my @hosts = map { quotemeta($_->host) } @emails; my @hosts = map { quotemeta($_->host) } @emails;
my $hosts_re = join('|', @hosts); my $hosts_re = join('|', @hosts);
$toencode =~ s/\@(?:$hosts_re)//g; $toencode =~ s/\@(?:$hosts_re)//g;
return $toencode; return $toencode;
...@@ -320,7 +320,7 @@ sub correct_urlbase { ...@@ -320,7 +320,7 @@ sub correct_urlbase {
} }
sub remote_ip { sub remote_ip {
my $ip = $ENV{'REMOTE_ADDR'} || '127.0.0.1'; my $ip = $ENV{'REMOTE_ADDR'} || '127.0.0.1';
my @proxies = split(/[\s,]+/, Bugzilla->params->{'inbound_proxies'}); my @proxies = split(/[\s,]+/, Bugzilla->params->{'inbound_proxies'});
# If the IP address is one of our trusted proxies, then we look at # If the IP address is one of our trusted proxies, then we look at
...@@ -778,7 +778,7 @@ sub validate_date { ...@@ -778,7 +778,7 @@ sub validate_date {
if ($ts) { if ($ts) {
$date2 = time2str("%Y-%m-%d", $ts); $date2 = time2str("%Y-%m-%d", $ts);
$date =~ s/(\d+)-0*(\d+?)-0*(\d+?)/$1-$2-$3/; $date =~ s/(\d+)-0*(\d+?)-0*(\d+?)/$1-$2-$3/;
$date2 =~ s/(\d+)-0*(\d+?)-0*(\d+?)/$1-$2-$3/; $date2 =~ s/(\d+)-0*(\d+?)-0*(\d+?)/$1-$2-$3/;
} }
my $ret = ($ts && $date eq $date2); my $ret = ($ts && $date eq $date2);
......
...@@ -76,7 +76,7 @@ sub new { ...@@ -76,7 +76,7 @@ sub new {
} }
my $condition = 'product_id = ? AND value = ?'; my $condition = 'product_id = ? AND value = ?';
my @values = ($product->id, $name); my @values = ($product->id, $name);
$param = {condition => $condition, values => \@values}; $param = {condition => $condition, values => \@values};
} }
......
...@@ -133,7 +133,7 @@ sub fields { ...@@ -133,7 +133,7 @@ sub fields {
foreach my $field (@fields) { foreach my $field (@fields) {
my $visibility_field my $visibility_field
= $field->visibility_field ? $field->visibility_field->name : undef; = $field->visibility_field ? $field->visibility_field->name : undef;
my $vis_values = $field->visibility_values; my $vis_values = $field->visibility_values;
my $value_field = $field->value_field ? $field->value_field->name : undef; my $value_field = $field->value_field ? $field->value_field->name : undef;
my (@values, $has_values); my (@values, $has_values);
...@@ -142,7 +142,7 @@ sub fields { ...@@ -142,7 +142,7 @@ sub fields {
or $field->name eq 'keywords') or $field->name eq 'keywords')
{ {
$has_values = 1; $has_values = 1;
@values = @{$self->_legal_field_values({field => $field})}; @values = @{$self->_legal_field_values({field => $field})};
} }
if (grep($_ eq $field->name, PRODUCT_SPECIFIC_FIELDS)) { if (grep($_ eq $field->name, PRODUCT_SPECIFIC_FIELDS)) {
...@@ -162,7 +162,7 @@ sub fields { ...@@ -162,7 +162,7 @@ sub fields {
); );
if ($has_values) { if ($has_values) {
$field_data{value_field} = $self->type('string', $value_field); $field_data{value_field} = $self->type('string', $value_field);
$field_data{values} = \@values; $field_data{values} = \@values;
} }
push(@fields_out, filter $params, \%field_data); push(@fields_out, filter $params, \%field_data);
} }
...@@ -317,7 +317,7 @@ sub comments { ...@@ -317,7 +317,7 @@ sub comments {
my %comments; my %comments;
if (scalar @$comment_ids) { if (scalar @$comment_ids) {
my @ids = map { trim($_) } @$comment_ids; my @ids = map { trim($_) } @$comment_ids;
my $comment_data = Bugzilla::Comment->new_from_list(\@ids); my $comment_data = Bugzilla::Comment->new_from_list(\@ids);
# See if we were passed any invalid comment ids. # See if we were passed any invalid comment ids.
...@@ -707,7 +707,7 @@ sub update { ...@@ -707,7 +707,7 @@ sub update {
my %changes = %{$all_changes{$bug->id}}; my %changes = %{$all_changes{$bug->id}};
foreach my $field (keys %changes) { foreach my $field (keys %changes) {
my $change = $changes{$field}; my $change = $changes{$field};
my $api_field = $api_name{$field} || $field; my $api_field = $api_name{$field} || $field;
# We normalize undef to an empty string, so that the API # We normalize undef to an empty string, so that the API
......
...@@ -92,7 +92,7 @@ sub extensions { ...@@ -92,7 +92,7 @@ sub extensions {
my %retval; my %retval;
foreach my $extension (@{Bugzilla->extensions}) { foreach my $extension (@{Bugzilla->extensions}) {
my $version = $extension->VERSION || 0; my $version = $extension->VERSION || 0;
my $name = $extension->NAME; my $name = $extension->NAME;
$retval{$name}->{version} = $self->type('string', $version); $retval{$name}->{version} = $self->type('string', $version);
} }
return {extensions => \%retval}; return {extensions => \%retval};
......
...@@ -364,7 +364,7 @@ sub _argument_type_check { ...@@ -364,7 +364,7 @@ sub _argument_type_check {
# Now, convert dateTime fields on input. # Now, convert dateTime fields on input.
$self->_bz_method_name =~ /^(\S+)\.(\S+)$/; $self->_bz_method_name =~ /^(\S+)\.(\S+)$/;
my ($class, $method) = ($1, $2); my ($class, $method) = ($1, $2);
my $pkg = $self->{dispatch_path}->{$class}; my $pkg = $self->{dispatch_path}->{$class};
my @date_fields = @{$pkg->DATE_FIELDS->{$method} || []}; my @date_fields = @{$pkg->DATE_FIELDS->{$method} || []};
foreach my $field (@date_fields) { foreach my $field (@date_fields) {
if (defined $params->{$field}) { if (defined $params->{$field}) {
......
...@@ -53,7 +53,7 @@ sub handle { ...@@ -53,7 +53,7 @@ sub handle {
# unless we were looking for OPTIONS # unless we were looking for OPTIONS
if (!$self->_find_resource($self->cgi->path_info)) { if (!$self->_find_resource($self->cgi->path_info)) {
if ($self->request->method eq 'OPTIONS' && $self->bz_rest_options) { if ($self->request->method eq 'OPTIONS' && $self->bz_rest_options) {
my $response = $self->response_header(STATUS_OK, ""); my $response = $self->response_header(STATUS_OK, "");
my $options_string = join(', ', @{$self->bz_rest_options}); my $options_string = join(', ', @{$self->bz_rest_options});
$response->header( $response->header(
'Allow' => $options_string, 'Allow' => $options_string,
...@@ -121,7 +121,7 @@ sub response { ...@@ -121,7 +121,7 @@ sub response {
my $result = {}; my $result = {};
if (exists $json_data->{error}) { if (exists $json_data->{error}) {
$result = $json_data->{error}; $result = $json_data->{error};
$result->{error} = $self->type('boolean', 1); $result->{error} = $self->type('boolean', 1);
$result->{documentation} = REST_DOC; $result->{documentation} = REST_DOC;
delete $result->{'name'}; # Remove JSONRPCError delete $result->{'name'}; # Remove JSONRPCError
} }
...@@ -510,7 +510,7 @@ sub _get_content_prefs { ...@@ -510,7 +510,7 @@ sub _get_content_prefs {
# Parse the Accept header, and save type name, score, and position. # Parse the Accept header, and save type name, score, and position.
my @accept_types = split /,/, $self->cgi->http('accept') || ''; my @accept_types = split /,/, $self->cgi->http('accept') || '';
my $order = 0; my $order = 0;
for my $accept_type (@accept_types) { for my $accept_type (@accept_types) {
my ($weight) = ($accept_type =~ /q=(\d\.\d+|\d+)/); my ($weight) = ($accept_type =~ /q=(\d\.\d+|\d+)/);
my ($name) = ($accept_type =~ m#(\S+/[^;]+)#); my ($name) = ($accept_type =~ m#(\S+/[^;]+)#);
......
...@@ -379,7 +379,7 @@ sub BEGIN { ...@@ -379,7 +379,7 @@ sub BEGIN {
my $super_method = "SUPER::$method"; my $super_method = "SUPER::$method";
return $self->$super_method($value); return $self->$super_method($value);
} }
} }
} }
} }
......
...@@ -205,7 +205,7 @@ sub get_attachment { ...@@ -205,7 +205,7 @@ sub get_attachment {
} }
$attachments{$field_name} = $attachment; $attachments{$field_name} = $attachment;
} }
my @args = map { $_ . '=' . $attachments{$_}->id } @field_names; my @args = map { $_ . '=' . $attachments{$_}->id } @field_names;
my $cgi_params = $cgi->canonicalise_query(@field_names, 't', 'Bugzilla_login', my $cgi_params = $cgi->canonicalise_query(@field_names, 't', 'Bugzilla_login',
'Bugzilla_password'); 'Bugzilla_password');
push(@args, $cgi_params) if $cgi_params; push(@args, $cgi_params) if $cgi_params;
...@@ -810,7 +810,7 @@ sub delete_attachment { ...@@ -810,7 +810,7 @@ sub delete_attachment {
# The token is valid. Delete the content of the attachment. # The token is valid. Delete the content of the attachment.
my $msg; my $msg;
$vars->{'attachment'} = $attachment; $vars->{'attachment'} = $attachment;
$vars->{'reason'} = clean_text($cgi->param('reason') || ''); $vars->{'reason'} = clean_text($cgi->param('reason') || '');
$template->process("attachment/delete_reason.txt.tmpl", $vars, \$msg) $template->process("attachment/delete_reason.txt.tmpl", $vars, \$msg)
|| ThrowTemplateError($template->error()); || ThrowTemplateError($template->error());
......
...@@ -370,7 +370,7 @@ if ($cmdtype eq "dorem") { ...@@ -370,7 +370,7 @@ if ($cmdtype eq "dorem") {
$vars->{'search_id'} = $query_id; $vars->{'search_id'} = $query_id;
} }
$params = new Bugzilla::CGI($buffer); $params = new Bugzilla::CGI($buffer);
$order = $params->param('order') || $order; $order = $params->param('order') || $order;
} }
elsif ($remaction eq "runseries") { elsif ($remaction eq "runseries") {
...@@ -912,7 +912,7 @@ $vars->{'buglist'} = \@bugidlist; ...@@ -912,7 +912,7 @@ $vars->{'buglist'} = \@bugidlist;
$vars->{'columns'} = $columns; $vars->{'columns'} = $columns;
$vars->{'displaycolumns'} = \@displaycolumns; $vars->{'displaycolumns'} = \@displaycolumns;
$vars->{'openstates'} = [BUG_STATE_OPEN]; $vars->{'openstates'} = [BUG_STATE_OPEN];
$vars->{'closedstates'} = [map { $_->name } closed_bug_statuses()]; $vars->{'closedstates'} = [map { $_->name } closed_bug_statuses()];
# The iCal file needs priorities ordered from 1 to 9 (highest to lowest) # The iCal file needs priorities ordered from 1 to 9 (highest to lowest)
...@@ -1018,7 +1018,7 @@ if ($dotweak && scalar @bugs) { ...@@ -1018,7 +1018,7 @@ if ($dotweak && scalar @bugs) {
= _get_common_flag_types([keys %$bugcomponentids]); = _get_common_flag_types([keys %$bugcomponentids]);
# Convert bug statuses to their ID. # Convert bug statuses to their ID.
my @bug_statuses = map { $dbh->quote($_) } keys %$bugstatuses; my @bug_statuses = map { $dbh->quote($_) } keys %$bugstatuses;
my $bug_status_ids = $dbh->selectcol_arrayref( my $bug_status_ids = $dbh->selectcol_arrayref(
'SELECT id FROM bug_status 'SELECT id FROM bug_status
WHERE ' . $dbh->sql_in('value', \@bug_statuses) WHERE ' . $dbh->sql_in('value', \@bug_statuses)
...@@ -1122,7 +1122,7 @@ my $disposition = "inline"; ...@@ -1122,7 +1122,7 @@ my $disposition = "inline";
if ($format->{'extension'} eq "html") { if ($format->{'extension'} eq "html") {
my $list_id = $cgi->param('list_id') || $cgi->param('regetlastlist'); my $list_id = $cgi->param('list_id') || $cgi->param('regetlastlist');
my $search = $user->save_last_search( my $search = $user->save_last_search(
{bugs => \@bugidlist, order => $order, vars => $vars, list_id => $list_id}); {bugs => \@bugidlist, order => $order, vars => $vars, list_id => $list_id});
$cgi->param('list_id', $search->id) if $search; $cgi->param('list_id', $search->id) if $search;
$contenttype = "text/html"; $contenttype = "text/html";
......
...@@ -76,7 +76,7 @@ $vars->{'doc_section'} = 'using/reports-and-charts.html#charts'; ...@@ -76,7 +76,7 @@ $vars->{'doc_section'} = 'using/reports-and-charts.html#charts';
# series_id they apply to (e.g. subscribe, unsubscribe). # series_id they apply to (e.g. subscribe, unsubscribe).
my @actions = grep(/^action-/, $cgi->param()); my @actions = grep(/^action-/, $cgi->param());
if ($actions[0] && $actions[0] =~ /^action-([^\d]+)(\d*)$/) { if ($actions[0] && $actions[0] =~ /^action-([^\d]+)(\d*)$/) {
$action = $1; $action = $1;
$series_id = $2 if $2; $series_id = $2 if $2;
} }
......
...@@ -50,7 +50,7 @@ pod2usage({-verbose => 1, -exitval => 1}) if $switch{'help'}; ...@@ -50,7 +50,7 @@ pod2usage({-verbose => 1, -exitval => 1}) if $switch{'help'};
# Read in the "answers" file if it exists, for running in # Read in the "answers" file if it exists, for running in
# non-interactive mode. # non-interactive mode.
my $answers_file = $ARGV[0]; my $answers_file = $ARGV[0];
my $silent = $answers_file && !$switch{'verbose'}; my $silent = $answers_file && !$switch{'verbose'};
print(install_string('header', get_version_and_os()) . "\n") unless $silent; print(install_string('header', get_version_and_os()) . "\n") unless $silent;
exit 0 if $switch{'version'}; exit 0 if $switch{'version'};
......
...@@ -174,7 +174,7 @@ else { ...@@ -174,7 +174,7 @@ else {
@collist = DEFAULT_COLUMN_LIST; @collist = DEFAULT_COLUMN_LIST;
} }
$vars->{'collist'} = \@collist; $vars->{'collist'} = \@collist;
$vars->{'splitheader'} = $cgi->cookie('SPLITHEADER') ? 1 : 0; $vars->{'splitheader'} = $cgi->cookie('SPLITHEADER') ? 1 : 0;
$vars->{'buffer'} = $cgi->query_string(); $vars->{'buffer'} = $cgi->query_string();
......
...@@ -165,7 +165,7 @@ sub collect_stats { ...@@ -165,7 +165,7 @@ sub collect_stats {
my $when = localtime(time); my $when = localtime(time);
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my $file = join '/', $dir, $product->id; my $file = join '/', $dir, $product->id;
my $exists = -f $file; my $exists = -f $file;
# if the file exists, get the old status and resolution list for that product. # if the file exists, get the old status and resolution list for that product.
...@@ -214,7 +214,7 @@ sub collect_stats { ...@@ -214,7 +214,7 @@ sub collect_stats {
} }
if (!$exists || scalar(@data)) { if (!$exists || scalar(@data)) {
my $fields = join('|', ('DATE', @statuses, @resolutions)); my $fields = join('|', ('DATE', @statuses, @resolutions));
my $product_name = $product->name; my $product_name = $product->name;
print DATA <<FIN; print DATA <<FIN;
# Bugzilla Daily Bug Stats # Bugzilla Daily Bug Stats
...@@ -325,7 +325,7 @@ sub regenerate_stats { ...@@ -325,7 +325,7 @@ sub regenerate_stats {
} }
if (open DATA, ">", $file) { if (open DATA, ">", $file) {
my $fields = join('|', ('DATE', @statuses, @resolutions)); my $fields = join('|', ('DATE', @statuses, @resolutions));
my $product_name = $product->name; my $product_name = $product->name;
print DATA <<FIN; print DATA <<FIN;
# Bugzilla Daily Bug Stats # Bugzilla Daily Bug Stats
...@@ -456,7 +456,7 @@ sub CollectSeriesData { ...@@ -456,7 +456,7 @@ sub CollectSeriesData {
# (days_since_epoch + series_id) % frequency = 0. So they'll run every # (days_since_epoch + series_id) % frequency = 0. So they'll run every
# <frequency> days, but the start date depends on the series_id. # <frequency> days, but the start date depends on the series_id.
my $days_since_epoch = int(time() / (60 * 60 * 24)); my $days_since_epoch = int(time() / (60 * 60 * 24));
my $today = today_dash(); my $today = today_dash();
# We save a copy of the main $dbh and then switch to the shadow and get # We save a copy of the main $dbh and then switch to the shadow and get
# that one too. Remember, these may be the same. # that one too. Remember, these may be the same.
......
...@@ -101,7 +101,7 @@ foreach my $table (@table_list) { ...@@ -101,7 +101,7 @@ foreach my $table (@table_list) {
my ($total) = $source_db->selectrow_array("SELECT COUNT(*) FROM $table"); my ($total) = $source_db->selectrow_array("SELECT COUNT(*) FROM $table");
my $select_query = "SELECT " . join(',', @table_columns) . " FROM $table"; my $select_query = "SELECT " . join(',', @table_columns) . " FROM $table";
my $select_sth = $source_db->prepare($select_query); my $select_sth = $source_db->prepare($select_query);
$select_sth->execute(); $select_sth->execute();
my $insert_query my $insert_query
......
...@@ -27,7 +27,7 @@ $Data::Dumper::Maxdepth = 1; ...@@ -27,7 +27,7 @@ $Data::Dumper::Maxdepth = 1;
$Data::Dumper::Deparse = 0; $Data::Dumper::Deparse = 0;
my $sysname = get_text('term', {term => 'Bugzilla'}); my $sysname = get_text('term', {term => 'Bugzilla'});
my $term = new Term::ReadLine "$sysname Console"; my $term = new Term::ReadLine "$sysname Console";
read_history($term); read_history($term);
END { write_history($term) } END { write_history($term) }
......
...@@ -225,7 +225,7 @@ sub code_files_to_subroutines { ...@@ -225,7 +225,7 @@ sub code_files_to_subroutines {
next if $file =~ /install-requirements/; next if $file =~ /install-requirements/;
print "Moving $file code into Extension.pm...\n"; print "Moving $file code into Extension.pm...\n";
my ($modules, $code) = process_code_file($file); my ($modules, $code) = process_code_file($file);
my @code_lines = map {" $_"} @$code; my @code_lines = map {" $_"} @$code;
my $code_string = join('', @code_lines); my $code_string = join('', @code_lines);
$code_string =~ s/Bugzilla->hook_args/\$args/g; $code_string =~ s/Bugzilla->hook_args/\$args/g;
$code_string =~ s/my\s+\$args\s+=\s+\$args;//gs; $code_string =~ s/my\s+\$args\s+=\s+\$args;//gs;
...@@ -244,7 +244,7 @@ END ...@@ -244,7 +244,7 @@ END
push(@subroutines, $subroutine); push(@subroutines, $subroutine);
} }
my %seen_modules = map { trim($_) => 1 } @all_modules; my %seen_modules = map { trim($_) => 1 } @all_modules;
my $module_string = join("\n", sort keys %seen_modules); my $module_string = join("\n", sort keys %seen_modules);
my $subroutine_string = join("\n", @subroutines); my $subroutine_string = join("\n", @subroutines);
return ($module_string, $subroutine_string); return ($module_string, $subroutine_string);
......
...@@ -44,7 +44,7 @@ use Pod::Usage; ...@@ -44,7 +44,7 @@ use Pod::Usage;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
# Display the help if called with --help or -?. # Display the help if called with --help or -?.
my $help = 0; my $help = 0;
my $result = GetOptions("help|?" => \$help); my $result = GetOptions("help|?" => \$help);
pod2usage(0) if $help; pod2usage(0) if $help;
...@@ -179,7 +179,7 @@ foreach my $table (keys %changes) { ...@@ -179,7 +179,7 @@ foreach my $table (keys %changes) {
# Get all columns to consider. There is always at least # Get all columns to consider. There is always at least
# one column given: the one to update. # one column given: the one to update.
my @columns = split(/[\s]+/, $column_list); my @columns = split(/[\s]+/, $column_list);
my $cols_to_check = join(' AND ', map {"$_ = ?"} @columns); my $cols_to_check = join(' AND ', map {"$_ = ?"} @columns);
# The first column of the list is the one to update. # The first column of the list is the one to update.
......
...@@ -186,8 +186,8 @@ foreach my $table ($dbh->bz_table_list_real) { ...@@ -186,8 +186,8 @@ foreach my $table ($dbh->bz_table_list_real) {
AND $column != ''" AND $column != ''"
); );
my @pk_array = map {"$_ = ?"} split(',', $pk); my @pk_array = map {"$_ = ?"} split(',', $pk);
my $pk_where = join(' AND ', @pk_array); my $pk_where = join(' AND ', @pk_array);
my $update_sth = $dbh->prepare("UPDATE $table SET $column = ? WHERE $pk_where"); my $update_sth = $dbh->prepare("UPDATE $table SET $column = ? WHERE $pk_where");
$sth->execute(); $sth->execute();
...@@ -197,7 +197,7 @@ foreach my $table ($dbh->bz_table_list_real) { ...@@ -197,7 +197,7 @@ foreach my $table ($dbh->bz_table_list_real) {
# Wide characters cause md5_base64() to die. # Wide characters cause md5_base64() to die.
my $digest_data = utf8::is_utf8($data) ? Encode::encode_utf8($data) : $data; my $digest_data = utf8::is_utf8($data) ? Encode::encode_utf8($data) : $data;
my $digest = md5_base64($digest_data); my $digest = md5_base64($digest_data);
my @primary_keys = reverse split(',', $pk); my @primary_keys = reverse split(',', $pk);
......
...@@ -61,7 +61,7 @@ sub _write_contents_middle { ...@@ -61,7 +61,7 @@ sub _write_contents_middle {
foreach my $e (@downlines) { foreach my $e (@downlines) {
$row_count++; $row_count++;
my $even_or_odd = $row_count % 2 ? 'even' : 'odd'; my $even_or_odd = $row_count % 2 ? 'even' : 'odd';
my $name = esc($e->[0]); my $name = esc($e->[0]);
my $path = join("/", '.', esc(@{$e->[3]})) . $Pod::Simple::HTML::HTML_EXTENSION; my $path = join("/", '.', esc(@{$e->[3]})) . $Pod::Simple::HTML::HTML_EXTENSION;
my $description = $self->{bugzilla_desc}->{$name} || ''; my $description = $self->{bugzilla_desc}->{$name} || '';
$description = esc($description); $description = esc($description);
......
...@@ -30,7 +30,7 @@ $user->in_group('admin') ...@@ -30,7 +30,7 @@ $user->in_group('admin')
{group => 'admin', action => 'edit', object => 'custom_fields'}); {group => 'admin', action => 'edit', object => 'custom_fields'});
my $action = trim($cgi->param('action') || ''); my $action = trim($cgi->param('action') || '');
my $token = $cgi->param('token'); my $token = $cgi->param('token');
print $cgi->header(); print $cgi->header();
......
...@@ -36,7 +36,7 @@ $user->in_group('creategroups') ...@@ -36,7 +36,7 @@ $user->in_group('creategroups')
{group => "creategroups", action => "edit", object => "groups"}); {group => "creategroups", action => "edit", object => "groups"});
my $action = trim($cgi->param('action') || ''); my $action = trim($cgi->param('action') || '');
my $token = $cgi->param('token'); my $token = $cgi->param('token');
# CheckGroupID checks that a positive integer is given and is # CheckGroupID checks that a positive integer is given and is
# actually a valid group ID. If all tests are successful, the # actually a valid group ID. If all tests are successful, the
......
...@@ -195,7 +195,7 @@ if ($action eq 'edit') { ...@@ -195,7 +195,7 @@ if ($action eq 'edit') {
if ($action eq 'update') { if ($action eq 'update') {
check_token_data($token, 'edit_milestone'); check_token_data($token, 'edit_milestone');
my $milestone_old_name = trim($cgi->param('milestoneold') || ''); my $milestone_old_name = trim($cgi->param('milestoneold') || '');
my $milestone = Bugzilla::Milestone->check( my $milestone = Bugzilla::Milestone->check(
{product => $product, name => $milestone_old_name}); {product => $product, name => $milestone_old_name});
$milestone->set_name($milestone_name); $milestone->set_name($milestone_name);
......
...@@ -69,7 +69,7 @@ if ( Bugzilla->params->{'useclassification'} ...@@ -69,7 +69,7 @@ if ( Bugzilla->params->{'useclassification'}
else { else {
# Only keep classifications containing at least one product # Only keep classifications containing at least one product
# which you can administer. # which you can administer.
my $products = $user->get_products_by_permission('editcomponents'); my $products = $user->get_products_by_permission('editcomponents');
my %class_ids = map { $_->classification_id => 1 } @$products; my %class_ids = map { $_->classification_id => 1 } @$products;
$class = Bugzilla::Classification->new_from_list([keys %class_ids]); $class = Bugzilla::Classification->new_from_list([keys %class_ids]);
} }
...@@ -107,7 +107,7 @@ if (!$action && !$product_name) { ...@@ -107,7 +107,7 @@ if (!$action && !$product_name) {
@$products = grep { $_->classification_id == $classification->id } @$products; @$products = grep { $_->classification_id == $classification->id } @$products;
} }
} }
$vars->{'products'} = $products; $vars->{'products'} = $products;
$vars->{'showbugcounts'} = $cgi->param('showbugcounts') ? 1 : 0; $vars->{'showbugcounts'} = $cgi->param('showbugcounts') ? 1 : 0;
$template->process("admin/products/list.html.tmpl", $vars) $template->process("admin/products/list.html.tmpl", $vars)
...@@ -298,7 +298,7 @@ if ($action eq 'edit' || (!$action && $product_name)) { ...@@ -298,7 +298,7 @@ if ($action eq 'edit' || (!$action && $product_name)) {
if ($action eq 'update') { if ($action eq 'update') {
check_token_data($token, 'edit_product'); check_token_data($token, 'edit_product');
my $product_old_name = trim($cgi->param('product_old_name') || ''); my $product_old_name = trim($cgi->param('product_old_name') || '');
my $product = $user->check_can_admin_product($product_old_name); my $product = $user->check_can_admin_product($product_old_name);
$product->set_all({ $product->set_all({
name => $product_name, name => $product_name,
......
...@@ -31,7 +31,7 @@ $user->in_group('tweakparams') ...@@ -31,7 +31,7 @@ $user->in_group('tweakparams')
{group => "tweakparams", action => "modify", object => "settings"}); {group => "tweakparams", action => "modify", object => "settings"});
my $action = trim($cgi->param('action') || ''); my $action = trim($cgi->param('action') || '');
my $token = $cgi->param('token'); my $token = $cgi->param('token');
if ($action eq 'update') { if ($action eq 'update') {
check_token_data($token, 'edit_settings'); check_token_data($token, 'edit_settings');
......
...@@ -59,7 +59,7 @@ $user->in_group('admin') ...@@ -59,7 +59,7 @@ $user->in_group('admin')
# often-used variables # often-used variables
# #
my $action = trim($cgi->param('action') || ''); my $action = trim($cgi->param('action') || '');
my $token = $cgi->param('token'); my $token = $cgi->param('token');
# #
# field = '' -> Show nice list of fields # field = '' -> Show nice list of fields
......
...@@ -168,7 +168,7 @@ if ($cgi->param('update')) { ...@@ -168,7 +168,7 @@ if ($cgi->param('update')) {
# to be altered or deleted # to be altered or deleted
# Check schedules for changes # Check schedules for changes
my $schedules = Bugzilla::Whine::Schedule->match({eventid => $eventid}); my $schedules = Bugzilla::Whine::Schedule->match({eventid => $eventid});
my @scheduleids = (); my @scheduleids = ();
foreach my $schedule (@$schedules) { foreach my $schedule (@$schedules) {
push @scheduleids, $schedule->id; push @scheduleids, $schedule->id;
...@@ -347,7 +347,7 @@ for my $event_id (keys %{$events}) { ...@@ -347,7 +347,7 @@ for my $event_id (keys %{$events}) {
my $schedules = Bugzilla::Whine::Schedule->match({eventid => $event_id}); my $schedules = Bugzilla::Whine::Schedule->match({eventid => $event_id});
foreach my $schedule (@$schedules) { foreach my $schedule (@$schedules) {
my $mailto_type = $schedule->mailto_is_group ? MAILTO_GROUP : MAILTO_USER; my $mailto_type = $schedule->mailto_is_group ? MAILTO_GROUP : MAILTO_USER;
my $mailto = ''; my $mailto = '';
if ($mailto_type == MAILTO_USER) { if ($mailto_type == MAILTO_USER) {
$mailto = $schedule->mailto->login; $mailto = $schedule->mailto->login;
} }
......
...@@ -29,7 +29,7 @@ $user->in_group('admin') ...@@ -29,7 +29,7 @@ $user->in_group('admin')
{group => 'admin', action => 'modify', object => 'workflow'}); {group => 'admin', action => 'modify', object => 'workflow'});
my $action = $cgi->param('action') || 'edit'; my $action = $cgi->param('action') || 'edit';
my $token = $cgi->param('token'); my $token = $cgi->param('token');
sub get_workflow { sub get_workflow {
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
......
...@@ -250,7 +250,7 @@ sub process_bug { ...@@ -250,7 +250,7 @@ sub process_bug {
# Make it possible to remove CCs. # Make it possible to remove CCs.
if ($fields{'removecc'}) { if ($fields{'removecc'}) {
$fields{'cc'} = [split(',', $fields{'removecc'})]; $fields{'cc'} = [split(',', $fields{'removecc'})];
$fields{'removecc'} = 1; $fields{'removecc'} = 1;
} }
...@@ -374,7 +374,7 @@ sub get_text_alternative { ...@@ -374,7 +374,7 @@ sub get_text_alternative {
my @parts = $email->parts; my @parts = $email->parts;
my $body; my $body;
foreach my $part (@parts) { foreach my $part (@parts) {
my $ct = $part->content_type || 'text/plain'; my $ct = $part->content_type || 'text/plain';
my $charset = 'iso-8859-1'; my $charset = 'iso-8859-1';
# The charset may be quoted. # The charset may be quoted.
......
...@@ -246,7 +246,7 @@ if ($cloned_bug_id) { ...@@ -246,7 +246,7 @@ if ($cloned_bug_id) {
# We need to ensure that we respect the 'insider' status of # We need to ensure that we respect the 'insider' status of
# the first comment, if it has one. Either way, make a note # the first comment, if it has one. Either way, make a note
# that this bug was cloned from another bug. # that this bug was cloned from another bug.
my $bug_desc = $cloned_bug->comments({order => 'oldest_to_newest'})->[0]; my $bug_desc = $cloned_bug->comments({order => 'oldest_to_newest'})->[0];
my $isprivate = $bug_desc->is_private; my $isprivate = $bug_desc->is_private;
$vars->{'comment'} = ""; $vars->{'comment'} = "";
......
...@@ -22,7 +22,7 @@ sub attachment_process_data { ...@@ -22,7 +22,7 @@ sub attachment_process_data {
return unless $args->{attributes}->{mimetype} eq 'image/bmp'; return unless $args->{attributes}->{mimetype} eq 'image/bmp';
my $data = ${$args->{data}}; my $data = ${$args->{data}};
my $img = Image::Magick->new(magick => 'bmp'); my $img = Image::Magick->new(magick => 'bmp');
# $data is a filehandle. # $data is a filehandle.
if (ref $data) { if (ref $data) {
......
...@@ -481,7 +481,7 @@ sub error_catch { ...@@ -481,7 +481,7 @@ sub error_catch {
return unless $args->{error} eq 'bad_page_cgi_id'; return unless $args->{error} eq 'bad_page_cgi_id';
my $page_id = $args->{vars}->{page_id}; my $page_id = $args->{vars}->{page_id};
my $login = Bugzilla->user->identity || "Someone"; my $login = Bugzilla->user->identity || "Someone";
warn "$login attempted to access page.cgi with id = $page_id"; warn "$login attempted to access page.cgi with id = $page_id";
my $page = $args->{message}; my $page = $args->{message};
......
...@@ -29,8 +29,7 @@ use constant MORE_SUB_CLASSES => qw( ...@@ -29,8 +29,7 @@ use constant MORE_SUB_CLASSES => qw(
sub install_update_db { sub install_update_db {
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my $should_rename = $dbh->selectrow_array( my $should_rename = $dbh->selectrow_array(q{SELECT 1 FROM bug_see_also
q{SELECT 1 FROM bug_see_also
WHERE class IN ('Bugzilla::BugUrl::Rietveld', WHERE class IN ('Bugzilla::BugUrl::Rietveld',
'Bugzilla::BugUrl::ReviewBoard')} 'Bugzilla::BugUrl::ReviewBoard')}
); );
......
...@@ -29,7 +29,7 @@ use constant VERSION => BUGZILLA_VERSION; ...@@ -29,7 +29,7 @@ use constant VERSION => BUGZILLA_VERSION;
use constant CMT_MOVED_TO => 4; use constant CMT_MOVED_TO => 4;
sub install_update_db { sub install_update_db {
my $reso_type = Bugzilla::Field::Choice->type('resolution'); my $reso_type = Bugzilla::Field::Choice->type('resolution');
my $moved_reso = $reso_type->new({name => 'MOVED'}); my $moved_reso = $reso_type->new({name => 'MOVED'});
# We make the MOVED resolution inactive, so that it doesn't show up # We make the MOVED resolution inactive, so that it doesn't show up
......
...@@ -276,7 +276,7 @@ sub sanitycheck_check { ...@@ -276,7 +276,7 @@ sub sanitycheck_check {
my $needs_rebuild; my $needs_rebuild;
foreach my $id (keys %cached_counts) { foreach my $id (keys %cached_counts) {
my $cached_count = $cached_counts{$id}; my $cached_count = $cached_counts{$id};
my $real_count = $real_counts{$id} || 0; my $real_count = $real_counts{$id} || 0;
if ($cached_count < 0) { if ($cached_count < 0) {
$status->('voting_count_alert', {id => $id}, 'alert'); $status->('voting_count_alert', {id => $id}, 'alert');
} }
...@@ -447,7 +447,7 @@ sub _page_user { ...@@ -447,7 +447,7 @@ sub _page_user {
($who->id, $product->id) ($who->id, $product->id)
); );
my %votes = map { $_->[0] => $_->[1] } @$vote_list; my %votes = map { $_->[0] => $_->[1] } @$vote_list;
my @bug_ids = sort keys %votes; my @bug_ids = sort keys %votes;
# Exclude bugs that the user can no longer see. # Exclude bugs that the user can no longer see.
...@@ -878,7 +878,7 @@ sub _remove_votes { ...@@ -878,7 +878,7 @@ sub _remove_votes {
# If a user votes for a bug, or the number of votes required to # If a user votes for a bug, or the number of votes required to
# confirm a bug has been reduced, check if the bug is now confirmed. # confirm a bug has been reduced, check if the bug is now confirmed.
sub _confirm_if_vote_confirmed { sub _confirm_if_vote_confirmed {
my $id = shift; my $id = shift;
my $bug = ref $id ? $id : new Bugzilla::Bug({id => $id, cache => 1}); my $bug = ref $id ? $id : new Bugzilla::Bug({id => $id, cache => 1});
my $ret = 0; my $ret = 0;
......
...@@ -623,7 +623,7 @@ sub process_bug { ...@@ -623,7 +623,7 @@ sub process_bug {
$err .= " Using default product and component set "; $err .= " Using default product and component set ";
$err .= "at the command line.\n"; $err .= "at the command line.\n";
$product = new Bugzilla::Product({name => $default_product_name}); $product = new Bugzilla::Product({name => $default_product_name});
$component = new Bugzilla::Component( $component = new Bugzilla::Component(
{name => $default_component_name, product => $product}); {name => $default_component_name, product => $product});
if (!$component) { if (!$component) {
...@@ -1084,7 +1084,7 @@ sub process_bug { ...@@ -1084,7 +1084,7 @@ sub process_bug {
$query .= ")"; $query .= ")";
$dbh->do($query, undef, @values); $dbh->do($query, undef, @values);
my $id = $dbh->bz_last_key('bugs', 'bug_id'); my $id = $dbh->bz_last_key('bugs', 'bug_id');
my $bug_obj = Bugzilla::Bug->new($id); my $bug_obj = Bugzilla::Bug->new($id);
# We are almost certain to get some uninitialized warnings # We are almost certain to get some uninitialized warnings
......
...@@ -216,7 +216,7 @@ $vars->{'bug'} = $bug; ...@@ -216,7 +216,7 @@ $vars->{'bug'} = $bug;
Bugzilla::Hook::process('post_bug_after_creation', {vars => $vars}); Bugzilla::Hook::process('post_bug_after_creation', {vars => $vars});
my $recipients = {changer => $user}; my $recipients = {changer => $user};
my $bug_sent = Bugzilla::BugMail::Send($id, $recipients); my $bug_sent = Bugzilla::BugMail::Send($id, $recipients);
$bug_sent->{type} = 'created'; $bug_sent->{type} = 'created';
$bug_sent->{id} = $id; $bug_sent->{id} = $id;
my @all_mail_results = ($bug_sent); my @all_mail_results = ($bug_sent);
......
...@@ -27,7 +27,7 @@ my $template = Bugzilla->template; ...@@ -27,7 +27,7 @@ my $template = Bugzilla->template;
my $vars = {}; my $vars = {};
my $action = $cgi->param('action') || ""; my $action = $cgi->param('action') || "";
my $token = $cgi->param('token'); my $token = $cgi->param('token');
if ($action eq "show") { if ($action eq "show") {
......
...@@ -100,7 +100,7 @@ elsif ($action eq 'begin-sudo') { ...@@ -100,7 +100,7 @@ elsif ($action eq 'begin-sudo') {
my $user = Bugzilla->login(LOGIN_REQUIRED); my $user = Bugzilla->login(LOGIN_REQUIRED);
my $target_login = $cgi->param('target_login'); my $target_login = $cgi->param('target_login');
my $reason = $cgi->param('reason') || ''; my $reason = $cgi->param('reason') || '';
# At this point, the user is logged in. However, if they used a method # At this point, the user is logged in. However, if they used a method
# where they could have provided a username/password (i.e. CGI), but they # where they could have provided a username/password (i.e. CGI), but they
......
...@@ -41,7 +41,7 @@ if (grep(/^cmd-/, $cgi->param())) { ...@@ -41,7 +41,7 @@ if (grep(/^cmd-/, $cgi->param())) {
Bugzilla->login(); Bugzilla->login();
my $action = $cgi->param('action') || 'menu'; my $action = $cgi->param('action') || 'menu';
my $token = $cgi->param('token'); my $token = $cgi->param('token');
if ($action eq "menu") { if ($action eq "menu") {
......
...@@ -57,7 +57,7 @@ if (!defined($product_id)) { ...@@ -57,7 +57,7 @@ if (!defined($product_id)) {
foreach my $dataset (@data) { foreach my $dataset (@data) {
my $datasets = {}; my $datasets = {};
$datasets->{'value'} = $dataset; $datasets->{'value'} = $dataset;
$datasets->{'selected'} = $default_sel{$dataset} ? 1 : 0; $datasets->{'selected'} = $default_sel{$dataset} ? 1 : 0;
push(@datasets, $datasets); push(@datasets, $datasets);
} }
...@@ -94,9 +94,9 @@ else { ...@@ -94,9 +94,9 @@ else {
# Filenames must not be guessable as they can point to products # Filenames must not be guessable as they can point to products
# you are not allowed to see. Also, different projects can have # you are not allowed to see. Also, different projects can have
# the same product IDs. # the same product IDs.
my $project = bz_locations()->{'project'} || ''; my $project = bz_locations()->{'project'} || '';
my $image_file = join(':', ($project, $product->id, @datasets)); my $image_file = join(':', ($project, $product->id, @datasets));
my $key = Bugzilla->localconfig->{'site_wide_secret'}; my $key = Bugzilla->localconfig->{'site_wide_secret'};
$image_file = hmac_sha256_base64($image_file, $key) . '.png'; $image_file = hmac_sha256_base64($image_file, $key) . '.png';
$image_file =~ s/\+/-/g; $image_file =~ s/\+/-/g;
$image_file =~ s/\//_/g; $image_file =~ s/\//_/g;
...@@ -146,7 +146,7 @@ sub generate_chart { ...@@ -146,7 +146,7 @@ sub generate_chart {
my $product_in_title = $product->id ? $product->name : 'All Products'; my $product_in_title = $product->id ? $product->name : 'All Products';
my @fields; my @fields;
my @labels = qw(DATE); my @labels = qw(DATE);
my %datasets = map { $_ => 1 } @$datasets; my %datasets = map { $_ => 1 } @$datasets;
my %data = (); my %data = ();
...@@ -198,7 +198,7 @@ sub generate_chart { ...@@ -198,7 +198,7 @@ sub generate_chart {
} }
my $img = Chart::Lines->new(800, 600); my $img = Chart::Lines->new(800, 600);
my $i = 0; my $i = 0;
my $MAXTICKS = 20; # Try not to show any more x ticks than this. my $MAXTICKS = 20; # Try not to show any more x ticks than this.
my $skip = 1; my $skip = 1;
......
...@@ -54,7 +54,7 @@ if ($action eq 'queue') { ...@@ -54,7 +54,7 @@ if ($action eq 'queue') {
} }
else { else {
my $flagtypes = get_flag_types(); my $flagtypes = get_flag_types();
my @types = ('all', @$flagtypes); my @types = ('all', @$flagtypes);
my $vars = {}; my $vars = {};
$vars->{'types'} = \@types; $vars->{'types'} = \@types;
......
...@@ -104,14 +104,12 @@ if ($cgi->param('createmissinggroupcontrolmapentries')) { ...@@ -104,14 +104,12 @@ if ($cgi->param('createmissinggroupcontrolmapentries')) {
my $na = CONTROLMAPNA; my $na = CONTROLMAPNA;
my $shown = CONTROLMAPSHOWN; my $shown = CONTROLMAPSHOWN;
my $insertsth = $dbh->prepare( my $insertsth = $dbh->prepare(qq{INSERT INTO group_control_map
qq{INSERT INTO group_control_map
(group_id, product_id, membercontrol, othercontrol) (group_id, product_id, membercontrol, othercontrol)
VALUES (?, ?, $shown, $na)} VALUES (?, ?, $shown, $na)}
); );
my $updatesth = $dbh->prepare( my $updatesth = $dbh->prepare(qq{UPDATE group_control_map
qq{UPDATE group_control_map
SET membercontrol = $shown SET membercontrol = $shown
WHERE group_id = ? WHERE group_id = ?
AND product_id = ?} AND product_id = ?}
...@@ -251,8 +249,7 @@ if ($cgi->param('rescanallBugMail')) { ...@@ -251,8 +249,7 @@ if ($cgi->param('rescanallBugMail')) {
Status('send_bugmail_start'); Status('send_bugmail_start');
my $time = $dbh->sql_date_math('NOW()', '-', 30, 'MINUTE'); my $time = $dbh->sql_date_math('NOW()', '-', 30, 'MINUTE');
my $list = $dbh->selectcol_arrayref( my $list = $dbh->selectcol_arrayref(qq{
qq{
SELECT bug_id SELECT bug_id
FROM bugs FROM bugs
WHERE (lastdiffed IS NULL WHERE (lastdiffed IS NULL
...@@ -742,8 +739,7 @@ sub check_keywords { ...@@ -742,8 +739,7 @@ sub check_keywords {
Status('keyword_check_start'); Status('keyword_check_start');
my %keywordids; my %keywordids;
my $keywords = $dbh->selectall_arrayref( my $keywords = $dbh->selectall_arrayref(q{SELECT id, name
q{SELECT id, name
FROM keyworddefs} FROM keyworddefs}
); );
...@@ -758,8 +754,7 @@ sub check_keywords { ...@@ -758,8 +754,7 @@ sub check_keywords {
} }
} }
my $sth = $dbh->prepare( my $sth = $dbh->prepare(q{SELECT bug_id, keywordid
q{SELECT bug_id, keywordid
FROM keywords FROM keywords
ORDER BY bug_id, keywordid} ORDER BY bug_id, keywordid}
); );
...@@ -860,8 +855,7 @@ sub BugCheck { ...@@ -860,8 +855,7 @@ sub BugCheck {
my ($middlesql, $errortext, $repairparam, $repairtext) = @_; my ($middlesql, $errortext, $repairparam, $repairtext) = @_;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my $badbugs = $dbh->selectcol_arrayref( my $badbugs = $dbh->selectcol_arrayref(qq{SELECT DISTINCT bugs.bug_id
qq{SELECT DISTINCT bugs.bug_id
FROM $middlesql FROM $middlesql
ORDER BY bugs.bug_id} ORDER BY bugs.bug_id}
); );
...@@ -995,9 +989,8 @@ BugCheck( ...@@ -995,9 +989,8 @@ BugCheck(
Status('unsent_bugmail_check'); Status('unsent_bugmail_check');
my $time = $dbh->sql_date_math('NOW()', '-', 30, 'MINUTE'); my $time = $dbh->sql_date_math('NOW()', '-', 30, 'MINUTE');
my $badbugs = $dbh->selectcol_arrayref( my $badbugs = $dbh->selectcol_arrayref(qq{
qq{
SELECT bug_id SELECT bug_id
FROM bugs FROM bugs
WHERE (lastdiffed IS NULL OR lastdiffed < delta_ts) WHERE (lastdiffed IS NULL OR lastdiffed < delta_ts)
......
...@@ -99,7 +99,7 @@ else { ...@@ -99,7 +99,7 @@ else {
Bugzilla::Bug->preload(\@bugs); Bugzilla::Bug->preload(\@bugs);
$vars->{'bugs'} = [@bugs, @illegal_bugs]; $vars->{'bugs'} = [@bugs, @illegal_bugs];
$vars->{'marks'} = \%marks; $vars->{'marks'} = \%marks;
my @bugids = map { $_->bug_id } grep { !$_->error } @bugs; my @bugids = map { $_->bug_id } grep { !$_->error } @bugs;
......
...@@ -108,7 +108,7 @@ if (!grep { $_ eq $rankdir } @valid_rankdirs) { ...@@ -108,7 +108,7 @@ if (!grep { $_ eq $rankdir } @valid_rankdirs) {
$rankdir = 'TB'; $rankdir = 'TB';
} }
my $display = $cgi->param('display') || 'tree'; my $display = $cgi->param('display') || 'tree';
my $webdotdir = bz_locations()->{'webdotdir'}; my $webdotdir = bz_locations()->{'webdotdir'};
my ($fh, $filename) = File::Temp::tempfile( my ($fh, $filename) = File::Temp::tempfile(
...@@ -139,8 +139,7 @@ foreach my $i (split('[\s,]+', $cgi->param('id'))) { ...@@ -139,8 +139,7 @@ foreach my $i (split('[\s,]+', $cgi->param('id'))) {
my @stack = keys(%baselist); my @stack = keys(%baselist);
if ($display eq 'web') { if ($display eq 'web') {
my $sth = $dbh->prepare( my $sth = $dbh->prepare(q{SELECT blocked, dependson
q{SELECT blocked, dependson
FROM dependencies FROM dependencies
WHERE blocked = ? OR dependson = ?} WHERE blocked = ? OR dependson = ?}
); );
...@@ -184,8 +183,7 @@ foreach my $k (keys(%baselist)) { ...@@ -184,8 +183,7 @@ foreach my $k (keys(%baselist)) {
$seen{$k} = 1; $seen{$k} = 1;
} }
my $sth = $dbh->prepare( my $sth = $dbh->prepare(q{SELECT bug_status, resolution, short_desc
q{SELECT bug_status, resolution, short_desc
FROM bugs FROM bugs
WHERE bugs.bug_id = ?} WHERE bugs.bug_id = ?}
); );
......
...@@ -53,7 +53,7 @@ local our $realdepth = 0; ...@@ -53,7 +53,7 @@ local our $realdepth = 0;
# Generate the tree of bugs that this bug depends on and a list of IDs # Generate the tree of bugs that this bug depends on and a list of IDs
# appearing in the tree. # appearing in the tree.
my $dependson_tree = {$id => $bug}; my $dependson_tree = {$id => $bug};
my $dependson_ids = {}; my $dependson_ids = {};
GenerateTree($id, "dependson", 1, $dependson_tree, $dependson_ids); GenerateTree($id, "dependson", 1, $dependson_tree, $dependson_ids);
$vars->{'dependson_tree'} = $dependson_tree; $vars->{'dependson_tree'} = $dependson_tree;
$vars->{'dependson_ids'} = [keys(%$dependson_ids)]; $vars->{'dependson_ids'} = [keys(%$dependson_ids)];
...@@ -61,7 +61,7 @@ $vars->{'dependson_ids'} = [keys(%$dependson_ids)]; ...@@ -61,7 +61,7 @@ $vars->{'dependson_ids'} = [keys(%$dependson_ids)];
# Generate the tree of bugs that this bug blocks and a list of IDs # Generate the tree of bugs that this bug blocks and a list of IDs
# appearing in the tree. # appearing in the tree.
my $blocked_tree = {$id => $bug}; my $blocked_tree = {$id => $bug};
my $blocked_ids = {}; my $blocked_ids = {};
GenerateTree($id, "blocked", 1, $blocked_tree, $blocked_ids); GenerateTree($id, "blocked", 1, $blocked_tree, $blocked_ids);
$vars->{'blocked_tree'} = $blocked_tree; $vars->{'blocked_tree'} = $blocked_tree;
$vars->{'blocked_ids'} = [keys(%$blocked_ids)]; $vars->{'blocked_ids'} = [keys(%$blocked_ids)];
......
...@@ -172,7 +172,7 @@ sub sqlize_dates { ...@@ -172,7 +172,7 @@ sub sqlize_dates {
sub get_blocker_ids { sub get_blocker_ids {
my ($bug_id, $unique) = @_; my ($bug_id, $unique) = @_;
$unique ||= {$bug_id => 1}; $unique ||= {$bug_id => 1};
my $deps = Bugzilla::Bug::EmitDependList("blocked", "dependson", $bug_id); my $deps = Bugzilla::Bug::EmitDependList("blocked", "dependson", $bug_id);
my @unseen = grep { !$unique->{$_}++ } @$deps; my @unseen = grep { !$unique->{$_}++ } @$deps;
foreach $bug_id (@unseen) { foreach $bug_id (@unseen) {
get_blocker_ids($bug_id, $unique); get_blocker_ids($bug_id, $unique);
......
...@@ -62,7 +62,7 @@ sub compile_file { ...@@ -62,7 +62,7 @@ sub compile_file {
ok(!$return_val, $file) or diag('--ERROR'); ok(!$return_val, $file) or diag('--ERROR');
} }
my @testitems = (@Support::Files::testitems, @Support::Files::test_files); my @testitems = (@Support::Files::testitems, @Support::Files::test_files);
my $file_features = map_files_to_features(); my $file_features = map_files_to_features();
# Test the scripts by compiling them # Test the scripts by compiling them
......
...@@ -22,7 +22,7 @@ use Test::More tests => ...@@ -22,7 +22,7 @@ use Test::More tests =>
(scalar(@Support::Files::testitems) + scalar(@Support::Files::test_files)) (scalar(@Support::Files::testitems) + scalar(@Support::Files::test_files))
* 6; * 6;
my @testitems = (@Support::Files::test_files, @Support::Files::testitems); my @testitems = (@Support::Files::test_files, @Support::Files::testitems);
my @require_taint = qw(email_in.pl importxml.pl mod_perl.pl whine.pl); my @require_taint = qw(email_in.pl importxml.pl mod_perl.pl whine.pl);
foreach my $file (@testitems) { foreach my $file (@testitems) {
......
...@@ -45,7 +45,7 @@ foreach my $module (@Support::Files::testitems) { ...@@ -45,7 +45,7 @@ foreach my $module (@Support::Files::testitems) {
foreach my $include_path (@include_paths) { foreach my $include_path (@include_paths) {
foreach my $path (@{$actual_files{$include_path}}) { foreach my $path (@{$actual_files{$include_path}}) {
my $file = File::Spec->catfile($include_path, $path); my $file = File::Spec->catfile($include_path, $path);
$file =~ s/\s.*$//; # nuke everything after the first space $file =~ s/\s.*$//; # nuke everything after the first space
$file =~ s|\\|/|g if ON_WINDOWS; # convert \ to / in path if on windows $file =~ s|\\|/|g if ON_WINDOWS; # convert \ to / in path if on windows
$test_templates{$file} = () if $file =~ m#global/(code|user)-error\.html\.tmpl#; $test_templates{$file} = () if $file =~ m#global/(code|user)-error\.html\.tmpl#;
......
...@@ -145,7 +145,7 @@ if ($@ eq '') { ...@@ -145,7 +145,7 @@ if ($@ eq '') {
my $verstring = "GD version $gd, libgd version $gdlib"; my $verstring = "GD version $gd, libgd version $gdlib";
$gdlib =~ s/^([^\.]+)\..*/$1/; $gdlib =~ s/^([^\.]+)\..*/$1/;
$gd =~ s/^([^\.]+)\..*/$1/; $gd =~ s/^([^\.]+)\..*/$1/;
if ($gdlib == $gd) { if ($gdlib == $gd) {
say "TEST-OK $verstring; Major versions match."; say "TEST-OK $verstring; Major versions match.";
...@@ -159,10 +159,10 @@ if ($@ eq '') { ...@@ -159,10 +159,10 @@ if ($@ eq '') {
# Test GD # Test GD
eval { eval {
my $image = new GD::Image(100, 100); my $image = new GD::Image(100, 100);
my $black = $image->colorAllocate(0, 0, 0); my $black = $image->colorAllocate(0, 0, 0);
my $white = $image->colorAllocate(255, 255, 255); my $white = $image->colorAllocate(255, 255, 255);
my $red = $image->colorAllocate(255, 0, 0); my $red = $image->colorAllocate(255, 0, 0);
my $blue = $image->colorAllocate(0, 0, 255); my $blue = $image->colorAllocate(0, 0, 255);
$image->transparent($white); $image->transparent($white);
$image->rectangle(0, 0, 99, 99, $black); $image->rectangle(0, 0, 99, 99, $black);
$image->arc(50, 50, 95, 75, 0, 360, $blue); $image->arc(50, 50, 95, 75, 0, 360, $blue);
......
...@@ -300,7 +300,7 @@ sub SaveEmail { ...@@ -300,7 +300,7 @@ sub SaveEmail {
# The new information given to us by the user. # The new information given to us by the user.
my $new_watched_users = join(',', $cgi->param('new_watchedusers')) || ''; my $new_watched_users = join(',', $cgi->param('new_watchedusers')) || '';
my @new_watch_names = split(/[,\s]+/, $new_watched_users); my @new_watch_names = split(/[,\s]+/, $new_watched_users);
my %new_watch_ids; my %new_watch_ids;
foreach my $username (@new_watch_names) { foreach my $username (@new_watch_names) {
...@@ -541,7 +541,7 @@ sub DoApiKey { ...@@ -541,7 +541,7 @@ sub DoApiKey {
my $user = Bugzilla->user; my $user = Bugzilla->user;
my $api_keys = Bugzilla::User::APIKey->match({user_id => $user->id}); my $api_keys = Bugzilla::User::APIKey->match({user_id => $user->id});
$vars->{api_keys} = $api_keys; $vars->{api_keys} = $api_keys;
$vars->{any_revoked} = grep { $_->revoked } @$api_keys; $vars->{any_revoked} = grep { $_->revoked } @$api_keys;
} }
......
...@@ -21,7 +21,7 @@ use Bugzilla::Error; ...@@ -21,7 +21,7 @@ use Bugzilla::Error;
my $is_enabled = grep { $_->NAME eq 'Voting' } @{Bugzilla->extensions}; my $is_enabled = grep { $_->NAME eq 'Voting' } @{Bugzilla->extensions};
$is_enabled || ThrowUserError('extension_disabled', {name => 'Voting'}); $is_enabled || ThrowUserError('extension_disabled', {name => 'Voting'});
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $action = $cgi->param('action') || 'show_user'; my $action = $cgi->param('action') || 'show_user';
if ($action eq "show_bug") { if ($action eq "show_bug") {
......
...@@ -253,7 +253,7 @@ sub get_next_event { ...@@ -253,7 +253,7 @@ sub get_next_event {
my $sth = $dbh->prepare("SELECT name FROM groups " . "WHERE id=?"); my $sth = $dbh->prepare("SELECT name FROM groups " . "WHERE id=?");
$sth->execute($mailto); $sth->execute($mailto);
my $groupname = $sth->fetch->[0]; my $groupname = $sth->fetch->[0];
my $group_id = Bugzilla::Group::ValidateGroupName($groupname, $owner); my $group_id = Bugzilla::Group::ValidateGroupName($groupname, $owner);
if ($group_id) { if ($group_id) {
my $glist = join(',', @{Bugzilla::Group->flatten_group_membership($group_id)}); my $glist = join(',', @{Bugzilla::Group->flatten_group_membership($group_id)});
$sth = $dbh->prepare( $sth = $dbh->prepare(
...@@ -417,7 +417,7 @@ sub run_queries { ...@@ -417,7 +417,7 @@ sub run_queries {
push @{$thisquery->{'columnlist'}}, @searchfields; push @{$thisquery->{'columnlist'}}, @searchfields;
my @orderstrings = split(/,\s*/, $searchparams->param('order') || ''); my @orderstrings = split(/,\s*/, $searchparams->param('order') || '');
my $search = new Bugzilla::Search( my $search = new Bugzilla::Search(
'fields' => \@searchfields, 'fields' => \@searchfields,
'params' => scalar $searchparams->Vars, 'params' => scalar $searchparams->Vars,
'user' => $args->{'recipient'}, # the search runs as the recipient 'user' => $args->{'recipient'}, # the search runs as the recipient
...@@ -628,7 +628,7 @@ sub get_next_date { ...@@ -628,7 +628,7 @@ sub get_next_date {
# if it's today # if it's today
if ($daysinmonth[$now_month] == $now_day) { if ($daysinmonth[$now_month] == $now_day) {
my $month = $now_month + 1; my $month = $now_month + 1;
$month = 1 if $month > 12; $month = 1 if $month > 12;
$add_days = $daysinmonth[$month] + 1; $add_days = $daysinmonth[$month] + 1;
} }
else { else {
......
...@@ -486,7 +486,7 @@ sub _create_field_values { ...@@ -486,7 +486,7 @@ sub _create_field_values {
foreach my $field (@multi_selects) { foreach my $field (@multi_selects) {
my $new_value = create_legal_value($field, 6); my $new_value = create_legal_value($field, 6);
my $name = $field->name; my $name = $field->name;
$values{$name} = [$values{$name}, $new_value->name]; $values{$name} = [$values{$name}, $new_value->name];
} }
push(@{$values{'tag'}}, "6-tag-" . random()); push(@{$values{'tag'}}, "6-tag-" . random());
...@@ -607,7 +607,7 @@ sub _create_one_bug { ...@@ -607,7 +607,7 @@ sub _create_one_bug {
# We need bug 6 to have a unique alias that is not a clone of bug 1's, # We need bug 6 to have a unique alias that is not a clone of bug 1's,
# so we get the alias separately from the other parameters. # so we get the alias separately from the other parameters.
my $alias = $self->bug_create_value($number, 'alias'); my $alias = $self->bug_create_value($number, 'alias');
my $update_alias = $self->bug_update_value($number, 'alias'); my $update_alias = $self->bug_update_value($number, 'alias');
# Otherwise, make bug 6 a clone of bug 1. # Otherwise, make bug 6 a clone of bug 1.
...@@ -635,11 +635,9 @@ sub _create_one_bug { ...@@ -635,11 +635,9 @@ sub _create_one_bug {
# These are necessary for the changedfrom tests. # These are necessary for the changedfrom tests.
my $extra_values = $self->_extra_bug_create_values->{$number}; my $extra_values = $self->_extra_bug_create_values->{$number};
foreach my $field ( foreach my $field (qw(comments remaining_time percentage_complete
qw(comments remaining_time percentage_complete
keyword_objects everconfirmed dependson blocked keyword_objects everconfirmed dependson blocked
groups_in classification actual_time) groups_in classification actual_time))
)
{ {
$extra_values->{$field} = $bug->$field; $extra_values->{$field} = $bug->$field;
} }
...@@ -675,7 +673,7 @@ sub _create_one_bug { ...@@ -675,7 +673,7 @@ sub _create_one_bug {
# writing this test, Bug->create doesn't support setting resolution). # writing this test, Bug->create doesn't support setting resolution).
# #
# Same for see_also. # Same for see_also.
my $timestamp = timestamp($number, $number - 1); my $timestamp = timestamp($number, $number - 1);
my $creation_ts = $timestamp->ymd . ' ' . $timestamp->hms; my $creation_ts = $timestamp->ymd . ' ' . $timestamp->hms;
$bug->{creation_ts} = $creation_ts; $bug->{creation_ts} = $creation_ts;
$dbh->do('UPDATE longdescs SET bug_when = ? WHERE bug_id = ?', $dbh->do('UPDATE longdescs SET bug_when = ? WHERE bug_id = ?',
...@@ -748,8 +746,8 @@ sub _create_one_bug { ...@@ -748,8 +746,8 @@ sub _create_one_bug {
$update_params{cc} = {add => \@cc_add, remove => \@cc_remove}; $update_params{cc} = {add => \@cc_add, remove => \@cc_remove};
my $see_also_remove = $bug->see_also; my $see_also_remove = $bug->see_also;
my $see_also_add = [$update_params{see_also}]; my $see_also_add = [$update_params{see_also}];
$update_params{see_also} = {add => $see_also_add, remove => $see_also_remove}; $update_params{see_also} = {add => $see_also_add, remove => $see_also_remove};
$update_params{comment} = {body => $update_params{comment}}; $update_params{comment} = {body => $update_params{comment}};
$update_params{work_time} = $number; $update_params{work_time} = $number;
# Setting work_time kills the remaining_time, so we need to # Setting work_time kills the remaining_time, so we need to
...@@ -944,7 +942,7 @@ sub run { ...@@ -944,7 +942,7 @@ sub run {
} }
# Rollbacks won't get rid of bugs_fulltext entries, so we do that ourselves. # Rollbacks won't get rid of bugs_fulltext entries, so we do that ourselves.
my @bug_ids = map { $_->id } $self->bugs; my @bug_ids = map { $_->id } $self->bugs;
my $bug_id_string = join(',', @bug_ids); my $bug_id_string = join(',', @bug_ids);
$dbh->do("DELETE FROM bugs_fulltext WHERE bug_id IN ($bug_id_string)"); $dbh->do("DELETE FROM bugs_fulltext WHERE bug_id IN ($bug_id_string)");
$dbh->bz_rollback_transaction(); $dbh->bz_rollback_transaction();
...@@ -969,7 +967,7 @@ sub _setup_dependencies { ...@@ -969,7 +967,7 @@ sub _setup_dependencies {
my $bug2 = $self->bug(2); my $bug2 = $self->bug(2);
my $bug3 = $self->bug(3); my $bug3 = $self->bug(3);
foreach my $number (1, 6) { foreach my $number (1, 6) {
my $bug = $self->bug($number); my $bug = $self->bug($number);
my @original_delta = ($bug2->delta_ts, $bug3->delta_ts); my @original_delta = ($bug2->delta_ts, $bug3->delta_ts);
Bugzilla->set_user($bug->reporter); Bugzilla->set_user($bug->reporter);
$bug->set_dependencies([$bug2->id], [$bug3->id]); $bug->set_dependencies([$bug2->id], [$bug3->id]);
......
...@@ -957,13 +957,11 @@ use constant INJECTION_BROKEN_FIELD => { ...@@ -957,13 +957,11 @@ use constant INJECTION_BROKEN_FIELD => {
'longdescs.count' => { 'longdescs.count' => {
search => 1, search => 1,
db_skip => ['Pg'], db_skip => ['Pg'],
operator_ok => [ operator_ok => [qw(allwords allwordssubstr anywordssubstr casesubstring
qw(allwords allwordssubstr anywordssubstr casesubstring
changedbefore changedafter greaterthan greaterthaneq changedbefore changedafter greaterthan greaterthaneq
lessthan lessthaneq notregexp notsubstring lessthan lessthaneq notregexp notsubstring
nowordssubstr regexp substring anywords nowordssubstr regexp substring anywords
notequals nowords equals anyexact) notequals nowords equals anyexact)],
],
}, },
}; };
......
...@@ -70,7 +70,7 @@ sub invalid_field_operator_combination { return undef } ...@@ -70,7 +70,7 @@ sub invalid_field_operator_combination { return undef }
sub search_params { sub search_params {
my ($self) = @_; my ($self) = @_;
my %params = %{$self->test->{top_params} || {}}; my %params = %{$self->test->{top_params} || {}};
my $counter = 0; my $counter = 0;
foreach my $row (@{$self->test->{params}}) { foreach my $row (@{$self->test->{params}}) {
$row->{v} = $self->translate_value($row) if exists $row->{v}; $row->{v} = $self->translate_value($row) if exists $row->{v};
......
...@@ -158,7 +158,7 @@ sub translated_value { ...@@ -158,7 +158,7 @@ sub translated_value {
sub debug_fail { sub debug_fail {
my ($self, $number, $results, $sql) = @_; my ($self, $number, $results, $sql) = @_;
my @expected = @{$self->test->{contains}}; my @expected = @{$self->test->{contains}};
my @results = sort map { $self->number($_) } map { $_->[0] } @$results; my @results = sort map { $self->number($_) } map { $_->[0] } @$results;
return return
" Value: '" " Value: '"
. $self->translated_value . "'\n" . $self->translated_value . "'\n"
...@@ -354,7 +354,7 @@ sub _field_values_for_bug { ...@@ -354,7 +354,7 @@ sub _field_values_for_bug {
if ($field =~ /^attach.+\.(.+)$/) { if ($field =~ /^attach.+\.(.+)$/) {
my $attach_field = $1; my $attach_field = $1;
$attach_field = ATTACHMENT_FIELDS->{$attach_field} || $attach_field; $attach_field = ATTACHMENT_FIELDS->{$attach_field} || $attach_field;
@values = $self->_values_for($number, 'attachments', $attach_field); @values = $self->_values_for($number, 'attachments', $attach_field);
} }
elsif (my $flag_field = FLAG_FIELDS->{$field}) { elsif (my $flag_field = FLAG_FIELDS->{$field}) {
@values = $self->_values_for($number, 'flags', $flag_field); @values = $self->_values_for($number, 'flags', $flag_field);
...@@ -410,7 +410,7 @@ sub _field_values_for_bug { ...@@ -410,7 +410,7 @@ sub _field_values_for_bug {
# requestees.login_name is empty for most bugs (but checking # requestees.login_name is empty for most bugs (but checking
# blessed(undef) handles that. # blessed(undef) handles that.
# Values that come from %original_values aren't User objects. # Values that come from %original_values aren't User objects.
@values = map { blessed($_) ? $_->login : $_ } @values; @values = map { blessed($_) ? $_->login : $_ } @values;
@values = grep { defined $_ } @values; @values = grep { defined $_ } @values;
} }
...@@ -503,7 +503,7 @@ sub _translate_value_for_bug { ...@@ -503,7 +503,7 @@ sub _translate_value_for_bug {
} }
if (my $func = $self->test->{transform}) { if (my $func = $self->test->{transform}) {
my $transformed = $func->(@bug_values); my $transformed = $func->(@bug_values);
my $is_equal = $transformed eq $bug_values[0] ? 1 : 0; my $is_equal = $transformed eq $bug_values[0] ? 1 : 0;
$self->transformed_value_was_equal($number, $is_equal); $self->transformed_value_was_equal($number, $is_equal);
$string_value = $transformed; $string_value = $transformed;
} }
...@@ -619,7 +619,7 @@ sub _test_content_for_bug { ...@@ -619,7 +619,7 @@ sub _test_content_for_bug {
my $contains_known_broken = $self->contains_known_broken($number); my $contains_known_broken = $self->contains_known_broken($number);
my %result_ids = map { $_->[0] => 1 } @$results; my %result_ids = map { $_->[0] => 1 } @$results;
my $bug_id = $self->bug($number)->id; my $bug_id = $self->bug($number)->id;
TODO: { TODO: {
local $TODO = $contains_known_broken if $contains_known_broken; local $TODO = $contains_known_broken if $contains_known_broken;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment