Skip to content

Commit 1ace3b6

Browse files
committed
Fix dockerfile and revert any divergent changes from bmo
1 parent bee5ad2 commit 1ace3b6

File tree

294 files changed

+7310
-6007
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

294 files changed

+7310
-6007
lines changed

Bugzilla.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use warnings;
1313

1414
use Bugzilla::Logging;
1515

16-
our $VERSION = '6.0';
16+
our $VERSION = '20190418.1';
1717

1818
use Bugzilla::Auth;
1919
use Bugzilla::Auth::Persist::Cookie;

Bugzilla/App/Command/report_ping.pm

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ sub run {
7979
'Testing',
8080
sub {
8181
foreach my $result (@_) {
82-
my @error = $report->test_row($result);
82+
my @error = $report->test($result);
8383
if (@error) {
84-
my $doc = $report->extract_content($result);
84+
my (undef, $doc) = $report->prepare($result);
8585
die $json->encode({errors => \@error, result => $doc});
8686
}
8787
}
@@ -94,8 +94,7 @@ sub run {
9494
'Dumping',
9595
sub {
9696
foreach my $result (@_) {
97-
my $doc = $report->extract_content($result);
98-
my $id = $result->id;
97+
my ($id, $doc) = $report->prepare($result);
9998
path($working_dir, "$id.json")->spurt($json->encode($doc));
10099
}
101100
}
@@ -106,7 +105,7 @@ sub run {
106105
$report,
107106
'Sending',
108107
sub {
109-
Mojo::Promise->all(map { $report->send_row($_) } @_)->wait;
108+
Mojo::Promise->all(map { $report->send($_) } @_)->wait;
110109
}
111110
);
112111
}

Bugzilla/Bug.pm

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ use base qw(Bugzilla::Object Exporter);
4343
@Bugzilla::Bug::EXPORT = qw(
4444
bug_alias_to_id
4545
LogActivityEntry
46+
editable_bug_fields
4647
);
4748

4849
my %CLEANUP;
@@ -4445,6 +4446,36 @@ sub bug_alias_to_id {
44454446
# Subroutines
44464447
#####################################################################
44474448

4449+
# Returns a list of currently active and editable bug fields,
4450+
# including multi-select fields.
4451+
sub editable_bug_fields {
4452+
my @fields = Bugzilla->dbh->bz_table_columns('bugs');
4453+
4454+
# Add multi-select fields
4455+
push(@fields,
4456+
map { $_->name }
4457+
@{Bugzilla->fields({obsolete => 0, type => FIELD_TYPE_MULTI_SELECT})});
4458+
4459+
# Obsolete custom fields are not editable.
4460+
my @obsolete_fields = @{Bugzilla->fields({obsolete => 1, custom => 1})};
4461+
@obsolete_fields = map { $_->name } @obsolete_fields;
4462+
foreach
4463+
my $remove ("bug_id", "reporter", "creation_ts", "delta_ts", "lastdiffed",
4464+
@obsolete_fields)
4465+
{
4466+
my $location = firstidx { $_ eq $remove } @fields;
4467+
4468+
# Ensure field exists before attempting to remove it.
4469+
splice(@fields, $location, 1) if ($location > -1);
4470+
}
4471+
4472+
Bugzilla::Hook::process('bug_editable_bug_fields', {fields => \@fields});
4473+
4474+
# Sorted because the old @::log_columns variable, which this replaces,
4475+
# was sorted.
4476+
return sort(@fields);
4477+
}
4478+
44484479
# Emit a list of dependencies or regressions. Join with bug_status and bugs
44494480
# tables to show bugs with open statuses first, and then the others
44504481
sub list_relationship {
@@ -4523,10 +4554,8 @@ sub GetBugActivity {
45234554
$suppwhere = "AND COALESCE(attachments.isprivate, 0) = 0";
45244555
}
45254556

4526-
# Use DISTINCT and value comparison to suppress duplicated changes weirdly
4527-
# made at the same time by the same user
45284557
my $query
4529-
= "SELECT DISTINCT fielddefs.name, bugs_activity.attach_id, "
4558+
= "SELECT fielddefs.name, bugs_activity.attach_id, "
45304559
. $dbh->sql_date_format('bugs_activity.bug_when', '%Y.%m.%d %H:%i:%s')
45314560
. " AS bug_when, bugs_activity.removed, bugs_activity.added, profiles.login_name,
45324561
bugs_activity.comment_id
@@ -4537,7 +4566,6 @@ sub GetBugActivity {
45374566
INNER JOIN profiles
45384567
ON profiles.userid = bugs_activity.who
45394568
WHERE bugs_activity.bug_id = ?
4540-
AND bugs_activity.removed != bugs_activity.added
45414569
$datepart
45424570
$attachpart
45434571
$suppwhere ";
@@ -4591,17 +4619,6 @@ sub GetBugActivity {
45914619
= @$entry;
45924620
my %change;
45934621
my $activity_visible = 1;
4594-
my $last_change = @$changes[-1] || {};
4595-
4596-
# Suppress any mid-air collision
4597-
if ( $when eq $operation->{'when'}
4598-
&& $fieldname eq $last_change->{'fieldname'}
4599-
&& $removed eq $last_change->{'removed'}
4600-
&& $added eq $last_change->{'added'}
4601-
&& $attachid eq $last_change->{'attachid'})
4602-
{
4603-
next;
4604-
}
46054622

46064623
# check if the user should see this field's activity
46074624
if ( $fieldname eq 'remaining_time'

Bugzilla/Constants.pm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ sub DEFAULT_CSP {
740740
'https://crash-stop-addon.herokuapp.com',
741741
],
742742
worker_src => ['none',],
743-
img_src => ['self', 'data:', 'blob:', 'https://secure.gravatar.com'],
743+
img_src => ['self', 'blob:', 'https://secure.gravatar.com'],
744744
style_src => ['self', 'unsafe-inline'],
745745
object_src => ['none'],
746746
connect_src => [
@@ -756,7 +756,7 @@ sub DEFAULT_CSP {
756756
'https://treeherder.mozilla.org/api/failurecount/',
757757

758758
# socorro lens
759-
'https://crash-stats.mozilla.org/api/SuperSearch/',
759+
'https://crash-stats.mozilla.com/api/SuperSearch/',
760760
],
761761
font_src => [ 'self', 'https://fonts.gstatic.com' ],
762762
form_action => [
@@ -788,7 +788,7 @@ sub SHOW_BUG_MODAL_CSP {
788788
'unsafe-inline', 'unsafe-eval',
789789
'https://www.google-analytics.com'
790790
],
791-
img_src => ['self', 'data:', 'https://secure.gravatar.com'],
791+
img_src => ['self', 'https://secure.gravatar.com'],
792792
media_src => ['self'],
793793
connect_src => [
794794
'self',

Bugzilla/DB/Schema.pm

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,6 @@ use constant ABSTRACT_SCHEMA => {
946946
password_change_reason => {TYPE => 'varchar(64)'},
947947
mfa => {TYPE => 'varchar(8)', DEFAULT => "''"},
948948
mfa_required_date => {TYPE => 'DATETIME'},
949-
forget_after_date => {TYPE => 'DATETIME'},
950949
],
951950
INDEXES => [
952951
profiles_login_name_idx => {FIELDS => ['login_name'], TYPE => 'UNIQUE'},

Bugzilla/Hook.pm

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -542,21 +542,6 @@ table should be joined with the C<bugs> table. If omitted, LEFT is used.
542542
543543
=back
544544
545-
=head2 search_params_to_data_structure
546-
547-
This happens in L<Bugzilla::Search/_params_to_data_structure> and allows you to
548-
modify the search params in any way, before the all the params are processed as
549-
a data structure. It's useful especially when you want to accept synonyms for
550-
param names and/or values.
551-
552-
Params:
553-
554-
=over
555-
556-
=item C<search> - The L<Bugzilla::Search> object.
557-
558-
=back
559-
560545
=head2 search_operator_field_override
561546
562547
This allows you to modify L<Bugzilla::Search/OPERATOR_FIELD_OVERRIDE>,

Bugzilla/Install/DB.pm

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -758,10 +758,6 @@ sub update_table_definitions {
758758
{TYPE => 'varchar(8)',, DEFAULT => "''"});
759759

760760
$dbh->bz_add_column('profiles', 'mfa_required_date', {TYPE => 'DATETIME'});
761-
762-
# 2019-05-08 [email protected] - Bug 1550145
763-
$dbh->bz_add_column('profiles', 'forget_after_date', {TYPE => 'DATETIME'});
764-
765761
_migrate_group_owners();
766762

767763
$dbh->bz_add_column('groups', 'idle_member_removal',

Bugzilla/Install/Filesystem.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use warnings;
2121

2222
use Bugzilla::Constants;
2323
use Bugzilla::Error;
24-
use Bugzilla::Install::Localconfig;
24+
use Bugzilla::Install::Localconfig qw(ENV_KEYS);
2525

2626
use Bugzilla::Install::Util qw(install_string);
2727
use Bugzilla::Util;

Bugzilla/Install/Localconfig.pm

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ use English qw($EGID);
3030
use List::Util qw(first);
3131
use Tie::Hash::NamedCapture;
3232
use Safe;
33-
use Package::Stash;
3433
use Term::ANSIColor;
3534
use Sys::Hostname qw(hostname);
3635

@@ -39,6 +38,7 @@ use parent qw(Exporter);
3938
our @EXPORT_OK = qw(
4039
read_localconfig
4140
update_localconfig
41+
ENV_KEYS
4242
);
4343

4444
# might want to change this for upstream
@@ -107,6 +107,12 @@ use constant LOCALCONFIG_VARS => (
107107
{name => 'datadog_port', default => 8125,},
108108
);
109109

110+
111+
use constant ENV_KEYS => (
112+
(map { ENV_PREFIX . $_->{name} } LOCALCONFIG_VARS),
113+
(map { ENV_PREFIX . $_ } PARAM_OVERRIDE),
114+
);
115+
110116
sub _read_localconfig_from_env {
111117
my %localconfig;
112118

@@ -137,8 +143,7 @@ sub _read_localconfig_from_file {
137143

138144
my %localconfig;
139145
if (-e $filename) {
140-
my $s = Safe->new;
141-
my $stash = Package::Stash->new($s->root);
146+
my $s = new Safe;
142147

143148
# Some people like to store their database password in another file.
144149
$s->permit('dofile');
@@ -154,30 +159,45 @@ sub _read_localconfig_from_file {
154159

155160
my @read_symbols;
156161
if ($include_deprecated) {
162+
163+
# First we have to get the whole symbol table
164+
my $safe_root = $s->root;
165+
my %safe_package;
166+
{ no strict 'refs'; %safe_package = %{$safe_root . "::"}; }
167+
157168
# And now we read the contents of every var in the symbol table.
158169
# However:
159170
# * We only include symbols that start with an alphanumeric
160171
# character. This excludes symbols like "_<./localconfig"
161172
# that show up in some perls.
162173
# * We ignore the INC symbol, which exists in every package.
163-
# * Perl 5.10 includes default symbol tables which
174+
# * Perl 5.10 imports a lot of random symbols that all
164175
# contain "::", and we want to ignore those.
165176
@read_symbols
166-
= grep { /^[A-Za-z0-1]/ and !/^INC$/ and !/::/ } $stash->list_all_symbols();
177+
= grep { /^[A-Za-z0-1]/ and !/^INC$/ and !/::/ } (keys %safe_package);
167178
}
168179
else {
169180
@read_symbols = map($_->{name}, LOCALCONFIG_VARS);
170181
}
171182
foreach my $var (@read_symbols) {
172-
# We don't know the type of any setting.
173-
# So we figure out its type by trying first a scalar, then an array, then a hash.
174-
175-
foreach my $sigil (qw( $ @ % )) {
176-
my $symbol = $sigil . $var;
177-
if ($stash->has_symbol($symbol)) {
178-
my $val = $stash->get_symbol($symbol);
179-
$localconfig{$var} = ref($val) eq 'SCALAR' ? $$val : $val;
180-
}
183+
my $glob = $s->varglob($var);
184+
185+
# We can't get the type of a variable out of a Safe automatically.
186+
# We can only get the glob itself. So we figure out its type this
187+
# way, by trying first a scalar, then an array, then a hash.
188+
#
189+
# The interesting thing is that this converts all deprecated
190+
# array or hash vars into hashrefs or arrayrefs, but that's
191+
# fine since as I write this all modern localconfig vars are
192+
# actually scalars.
193+
if (defined $$glob) {
194+
$localconfig{$var} = $$glob;
195+
}
196+
elsif (@$glob) {
197+
$localconfig{$var} = \@$glob;
198+
}
199+
elsif (%$glob) {
200+
$localconfig{$var} = \%$glob;
181201
}
182202
}
183203
}

Bugzilla/Markdown.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ sub render_html {
5050
local $Bugzilla::Template::COLOR_QUOTES = 0;
5151

5252
if ($markdown =~ /^\s*$MARKDOWN_OFF\n/s) {
53-
my $text = $self->bugzilla_shorthand->(trim($markdown), $bug);
53+
my $text = $self->bugzilla_shorthand->( trim($markdown) );
5454
my $dom = Mojo::DOM->new($text);
5555
$dom->find('*')->each(sub {
5656
my ($e) = @_;
@@ -88,7 +88,7 @@ sub render_html {
8888
&& any { $child->parent->tag eq $_ } @valid_text_parent_tags)
8989
{
9090
my $text = $child->content;
91-
$child->replace(Mojo::DOM->new($bugzilla_shorthand->($text, $bug)));
91+
$child->replace(Mojo::DOM->new($bugzilla_shorthand->($text)));
9292
}
9393
return $child;
9494
});

0 commit comments

Comments
 (0)