must go first:
- $text =~ s{ ( (?<=\W) __ (?=\S) (.+?[*_]*) (?<=\S) __ (?!\S) ) }
- {
- my $result = _has_multiple_underscores($2) ? $1 : "$2";
- $result;
- }gsxe;
-
-
- $text =~ s{ (?<=\W) \*\* (?=\S) (.+?[*_]*) (?<=\S) \*\* }{$1}gsx;
-
- $text =~ s{ ( (?<=\W) _ (?=\S) (.+?) (?<=\S) _ (?!\S) ) }
- {
- my $result = _has_multiple_underscores($2) ? $1 : "$2";
- $result;
- }gsxe;
-
- $text =~ s{ (?<=\W) \* (?=\S) (.+?) (?<=\S) \* }{$1}gsx;
-
- # And now, a second pass to catch nested strong and emphasis special cases
- $text =~ s{ ( (?<=\W) __ (?=\S) (.+?[*_]*) (?<=\S) __ (\S*) ) }
- {
- my $result = _has_multiple_underscores($3) ? $1 : "$2$3";
- $result;
- }gsxe;
-
- $text =~ s{ (?<=\W) \*\* (?=\S) (.+?[*_]*) (?<=\S) \*\* }{$1}gsx;
- $text =~ s{ ( (?<=\W) _ (?=\S) (.+?) (?<=\S) _ (\S*) ) }
- {
- my $result = _has_multiple_underscores($3) ? $1 : "$2$3";
- $result;
- }gsxe;
-
- $text =~ s{ (?<=\W) \* (?=\S) (.+?) (?<=\S) \* }{$1}gsx;
-
- return $text;
-}
-
-sub _DoStrikethroughs {
- my ($self, $text) = @_;
-
- $text =~ s{ ^ ~~ (?=\S) ([^~]+?) (?<=\S) ~~ (?!~) }{$1}gsx;
- $text =~ s{ (?<=_|[^~\w]) ~~ (?=\S) ([^~]+?) (?<=\S) ~~ (?!~) }{$1}gsx;
-
- return $text;
-}
-
-# The original _DoCodeSpans() uses the 's' modifier in its regex
-# which prevents _DoCodeBlocks() to match GFM fenced code blocks.
-# We copy the code from the original implementation and remove the
-# 's' modifier from it.
-sub _DoCodeSpans {
- my ($self, $text) = @_;
-
- $text =~ s@
- (?_EncodeCode($c);
- "$c";
- @egx;
-
- return $text;
-}
-
-# Override to add GFM Fenced Code Blocks
-sub _DoCodeBlocks {
- my ($self, $text) = @_;
-
- $text =~ s{
- ^ `{3,} [\s\t]* \n
- ( # $1 = the entire code block
- (?: .* \n+)+?
- )
- `{3,} [\s\t]* $
- }{
- my $codeblock = $1;
- my $result;
-
- $codeblock = $self->_EncodeCode($codeblock);
- $codeblock = $self->_Detab($codeblock);
- $codeblock =~ s/\n\z//; # remove the trailing newline
-
- $result = "\n\n" . $codeblock . "
\n\n";
- $result;
- }egmx;
-
- # And now do the standard code blocks
- $text = $self->SUPER::_DoCodeBlocks($text);
-
- return $text;
-}
-
-sub _DoBlockQuotes {
- my ($self, $text) = @_;
-
- $text =~ s{
- ( # Wrap whole match in $1
- (?:
- ^[ \t]*>[ \t]? # '>' at the start of a line
- .+\n # rest of the first line
- (?:.+\n)* # subsequent consecutive lines
- \n* # blanks
- )+
- )
- }{
- my $bq = $1;
- $bq =~ s/^[ \t]*>[ \t]?//gm; # trim one level of quoting
- $bq =~ s/^[ \t]+$//mg; # trim whitespace-only lines
- $bq = $self->_RunBlockGamut($bq, {wrap_in_p_tags => 1}); # recurse
- $bq =~ s/^/ /mg;
- # These leading spaces screw with content, so we need to fix that:
- $bq =~ s{(\s*.+?
)}{
- my $pre = $1;
- $pre =~ s/^ //mg;
- $pre;
- }egs;
- "\n$bq\n
\n\n";
- }egmx;
-
- return $text;
-}
-
-sub _EncodeCode {
- my ($self, $text) = @_;
-
- # We need to unescape the escaped HTML characters in code blocks.
- # These are the reverse of the escapings done in Bugzilla::Util::html_quote()
- $text =~ s/<//g;
- $text =~ s/"/"/g;
- $text =~ s/@/@/g;
- # '&' substitution must be the last one, otherwise a literal like '>'
- # will turn to '>' because '&' is already changed to '&' in Bugzilla::Util::html_quote().
- # In other words, html_quote() will change '>' to '>' and then we will
- # change '>' -> '>' -> '>' if we write this substitution as the first one.
- $text =~ s/&/&/g;
- $text =~ s{ \1 }{$1}xmgi;
- $text = $self->SUPER::_EncodeCode($text);
- $text =~ s/~/$g_escape_table{'~'}/go;
- # Encode '<' to prevent URLs from getting linkified in code spans
- $text =~ s/</$g_escape_table{'<'}/go;
-
- return $text;
-}
-
-sub _EncodeBackslashEscapes {
- my ($self, $text) = @_;
-
- $text = $self->SUPER::_EncodeBackslashEscapes($text);
- $text =~ s/\\~/$g_escape_table{'~'}/go;
-
- return $text;
-}
-
-sub _UnescapeSpecialChars {
- my ($self, $text) = @_;
-
- $text = $self->SUPER::_UnescapeSpecialChars($text);
- $text =~ s/$g_escape_table{'~'}/~/go;
- $text =~ s/$g_escape_table{'<'}/</go;
-
- return $text;
-}
-
-# Check if the passed string is of the form multiple_underscores_in_a_word.
-# To check that, we first need to make sure that the string does not contain
-# any white-space. Then, if the string is composed of non-space chunks which
-# are bound together with underscores, the string has the desired form.
-sub _has_multiple_underscores {
- my $string = shift;
- return 0 unless defined($string) && length($string);
- return 0 if $string =~ /[\t\s]+/;
- return 1 if scalar (split /_/, $string) > 1;
- return 0;
-}
-
-1;
-
-__END__
-
-=head1 NAME
-
-Bugzilla::Markdown - Generates HTML output from structured plain-text input.
-
-=head1 SYNOPSIS
-
- use Bugzilla::Markdown;
-
- my $markdown = Bugzilla::Markdown->new();
- print $markdown->markdown($text);
-
-=head1 DESCRIPTION
-
-Bugzilla::Markdown implements a Markdown engine that produces
-an HTML-based output from a given plain-text input.
-
-The majority of the implementation is done by C
-CPAN module. It also applies the linkifications done in L
-to the input resulting in an output which is a combination of both Markdown
-structures and those defined by Bugzilla itself.
-
-=head2 Accessors
-
-=over
-
-=item C
-
-C Produces an HTML-based output string based on the structures
-and format defined in the given plain-text input.
-
-=over
-
-=item B
-
-=over
-
-=item C
-
-C A plain-text string which includes Markdown structures.
-
-=back
-
-=back
-
-=back
diff --git a/mozilla/webtools/bugzilla/Bugzilla/Memcached.pm b/mozilla/webtools/bugzilla/Bugzilla/Memcached.pm
index df90fef9342..1464b6c003e 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/Memcached.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/Memcached.pm
@@ -254,13 +254,10 @@ sub _get {
elsif (ref($value) eq 'ARRAY') {
foreach my $value (@$value) {
next unless defined $value;
- # arrays of hashes and arrays are common
+ # arrays of hashes are common
if (ref($value) eq 'HASH') {
_detaint_hashref($value);
}
- elsif (ref($value) eq 'ARRAY') {
- _detaint_arrayref($value);
- }
elsif (!ref($value)) {
trick_taint($value);
}
@@ -281,15 +278,6 @@ sub _detaint_hashref {
}
}
-sub _detaint_arrayref {
- my ($arrayref) = @_;
- foreach my $value (@$arrayref) {
- if (defined($value) && !ref($value)) {
- trick_taint($value);
- }
- }
-}
-
sub _delete {
my ($self, $key) = @_;
$key = $self->_encode_key($key)
diff --git a/mozilla/webtools/bugzilla/Bugzilla/Migrate.pm b/mozilla/webtools/bugzilla/Bugzilla/Migrate.pm
index 0731d4fedf9..2763ecb2bd4 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/Migrate.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/Migrate.pm
@@ -9,7 +9,6 @@ package Bugzilla::Migrate;
use 5.10.1;
use strict;
-use warnings;
use Bugzilla::Attachment;
use Bugzilla::Bug qw(LogActivityEntry);
diff --git a/mozilla/webtools/bugzilla/Bugzilla/Migrate/Gnats.pm b/mozilla/webtools/bugzilla/Bugzilla/Migrate/Gnats.pm
index 5feda4b8db3..2778d28cc8a 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/Migrate/Gnats.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/Migrate/Gnats.pm
@@ -9,7 +9,6 @@ package Bugzilla::Migrate::Gnats;
use 5.10.1;
use strict;
-use warnings;
use parent qw(Bugzilla::Migrate);
diff --git a/mozilla/webtools/bugzilla/Bugzilla/Milestone.pm b/mozilla/webtools/bugzilla/Bugzilla/Milestone.pm
index cf7e3e35f18..83438e7c683 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/Milestone.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/Milestone.pm
@@ -9,7 +9,6 @@ package Bugzilla::Milestone;
use 5.10.1;
use strict;
-use warnings;
use parent qw(Bugzilla::Object);
diff --git a/mozilla/webtools/bugzilla/Bugzilla/Object.pm b/mozilla/webtools/bugzilla/Bugzilla/Object.pm
index 8f25e2b20c2..f2080363299 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/Object.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/Object.pm
@@ -9,7 +9,6 @@ package Bugzilla::Object;
use 5.10.1;
use strict;
-use warnings;
use Bugzilla::Constants;
use Bugzilla::Hook;
diff --git a/mozilla/webtools/bugzilla/Bugzilla/Product.pm b/mozilla/webtools/bugzilla/Bugzilla/Product.pm
index 30ebc7c6cd5..3d4de7430aa 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/Product.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/Product.pm
@@ -9,7 +9,6 @@ package Bugzilla::Product;
use 5.10.1;
use strict;
-use warnings;
use parent qw(Bugzilla::Field::ChoiceInterface Bugzilla::Object);
diff --git a/mozilla/webtools/bugzilla/Bugzilla/RNG.pm b/mozilla/webtools/bugzilla/Bugzilla/RNG.pm
index 96e442fa032..14b83167222 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/RNG.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/RNG.pm
@@ -9,7 +9,6 @@ package Bugzilla::RNG;
use 5.10.1;
use strict;
-use warnings;
use parent qw(Exporter);
use Bugzilla::Constants qw(ON_WINDOWS);
diff --git a/mozilla/webtools/bugzilla/Bugzilla/Report.pm b/mozilla/webtools/bugzilla/Bugzilla/Report.pm
index 10af2ea9efc..fe2b826614f 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/Report.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/Report.pm
@@ -9,7 +9,6 @@ package Bugzilla::Report;
use 5.10.1;
use strict;
-use warnings;
use parent qw(Bugzilla::Object);
diff --git a/mozilla/webtools/bugzilla/Bugzilla/Search.pm b/mozilla/webtools/bugzilla/Bugzilla/Search.pm
index 0395d08eefb..036e0a60581 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/Search.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/Search.pm
@@ -9,7 +9,6 @@ package Bugzilla::Search;
use 5.10.1;
use strict;
-use warnings;
use parent qw(Exporter);
@Bugzilla::Search::EXPORT = qw(
@@ -265,7 +264,7 @@ use constant OPERATOR_FIELD_OVERRIDE => {
},
# General Bug Fields
- alias => { _non_changed => \&_alias_nonchanged },
+ alias => { _non_changed => \&_nullable },
'attach_data.thedata' => MULTI_SELECT_OVERRIDE,
# We check all attachment fields against this.
attachments => MULTI_SELECT_OVERRIDE,
@@ -456,10 +455,6 @@ sub COLUMN_JOINS {
. ' FROM longdescs GROUP BY bug_id)',
join => 'INNER',
},
- alias => {
- table => 'bugs_aliases',
- as => 'map_alias',
- },
assigned_to => {
from => 'assigned_to',
to => 'userid',
@@ -590,7 +585,6 @@ sub COLUMNS {
# like "bugs.bug_id".
my $total_time = "(map_actual_time.total + bugs.remaining_time)";
my %special_sql = (
- alias => $dbh->sql_group_concat('DISTINCT map_alias.alias'),
deadline => $dbh->sql_date_format('bugs.deadline', '%Y-%m-%d'),
actual_time => 'map_actual_time.total',
@@ -761,7 +755,7 @@ sub data {
my @orig_fields = $self->_input_columns;
my $all_in_bugs_table = 1;
foreach my $field (@orig_fields) {
- next if ($self->COLUMNS->{$field}->{name} // $field) =~ /^bugs\.\w+$/;
+ next if $self->COLUMNS->{$field}->{name} =~ /^bugs\.\w+$/;
$self->{fields} = ['bug_id'];
$all_in_bugs_table = 0;
last;
@@ -1013,16 +1007,10 @@ sub _sql_select {
my ($self) = @_;
my @sql_fields;
foreach my $column ($self->_display_columns) {
- my $sql = $self->COLUMNS->{$column}->{name} // '';
- if ($sql) {
- my $alias = $column;
- # Aliases cannot contain dots in them. We convert them to underscores.
- $alias =~ tr/./_/;
- $sql .= " AS $alias";
- }
- else {
- $sql = $column;
- }
+ my $alias = $column;
+ # Aliases cannot contain dots in them. We convert them to underscores.
+ $alias =~ s/\./_/g;
+ my $sql = $self->COLUMNS->{$column}->{name} . " AS $alias";
push(@sql_fields, $sql);
}
return @sql_fields;
@@ -1399,7 +1387,7 @@ sub _sql_group_by {
my @extra_group_by;
foreach my $column ($self->_select_columns) {
next if $self->_skip_group_by->{$column};
- my $sql = $self->COLUMNS->{$column}->{name} // $column;
+ my $sql = $self->COLUMNS->{$column}->{name};
push(@extra_group_by, $sql);
}
@@ -2738,15 +2726,6 @@ sub _product_nonchanged {
"products.id", "products", $term);
}
-sub _alias_nonchanged {
- my ($self, $args) = @_;
-
- $args->{full_field} = "bugs_aliases.alias";
- $self->_do_operator_function($args);
- $args->{term} = build_subselect("bugs.bug_id",
- "bugs_aliases.bug_id", "bugs_aliases", $args->{term});
-}
-
sub _classification_nonchanged {
my ($self, $args) = @_;
my $joins = $args->{joins};
diff --git a/mozilla/webtools/bugzilla/Bugzilla/Search/Clause.pm b/mozilla/webtools/bugzilla/Bugzilla/Search/Clause.pm
index 1d7872c7857..9d3d690a393 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/Search/Clause.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/Search/Clause.pm
@@ -9,7 +9,6 @@ package Bugzilla::Search::Clause;
use 5.10.1;
use strict;
-use warnings;
use Bugzilla::Error;
use Bugzilla::Search::Condition qw(condition);
diff --git a/mozilla/webtools/bugzilla/Bugzilla/Search/ClauseGroup.pm b/mozilla/webtools/bugzilla/Bugzilla/Search/ClauseGroup.pm
index 590c737fad0..eb306525c2b 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/Search/ClauseGroup.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/Search/ClauseGroup.pm
@@ -9,7 +9,6 @@ package Bugzilla::Search::ClauseGroup;
use 5.10.1;
use strict;
-use warnings;
use parent qw(Bugzilla::Search::Clause);
diff --git a/mozilla/webtools/bugzilla/Bugzilla/Search/Condition.pm b/mozilla/webtools/bugzilla/Bugzilla/Search/Condition.pm
index 306a63eed3c..eab4ab79d24 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/Search/Condition.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/Search/Condition.pm
@@ -9,7 +9,6 @@ package Bugzilla::Search::Condition;
use 5.10.1;
use strict;
-use warnings;
use parent qw(Exporter);
our @EXPORT_OK = qw(condition);
diff --git a/mozilla/webtools/bugzilla/Bugzilla/Search/Quicksearch.pm b/mozilla/webtools/bugzilla/Bugzilla/Search/Quicksearch.pm
index 830177f8b51..98e8a648274 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/Search/Quicksearch.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/Search/Quicksearch.pm
@@ -9,7 +9,6 @@ package Bugzilla::Search::Quicksearch;
use 5.10.1;
use strict;
-use warnings;
use Bugzilla::Error;
use Bugzilla::Constants;
@@ -322,7 +321,7 @@ sub _handle_alias {
my $alias = $1;
# We use this direct SQL because we want quicksearch to be VERY fast.
my $bug_id = Bugzilla->dbh->selectrow_array(
- q{SELECT bug_id FROM bugs_aliases WHERE alias = ?}, undef, $alias);
+ q{SELECT bug_id FROM bugs WHERE alias = ?}, undef, $alias);
# If the user cannot see the bug or if we are using a webservice,
# do not resolve its alias.
if ($bug_id && Bugzilla->user->can_see_bug($bug_id) && !i_am_webservice()) {
diff --git a/mozilla/webtools/bugzilla/Bugzilla/Search/Recent.pm b/mozilla/webtools/bugzilla/Bugzilla/Search/Recent.pm
index e774c7fe059..cc1c3c582e8 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/Search/Recent.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/Search/Recent.pm
@@ -9,7 +9,6 @@ package Bugzilla::Search::Recent;
use 5.10.1;
use strict;
-use warnings;
use parent qw(Bugzilla::Object);
diff --git a/mozilla/webtools/bugzilla/Bugzilla/Search/Saved.pm b/mozilla/webtools/bugzilla/Bugzilla/Search/Saved.pm
index 50a9cdd6721..2e4c4a33617 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/Search/Saved.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/Search/Saved.pm
@@ -9,7 +9,6 @@ package Bugzilla::Search::Saved;
use 5.10.1;
use strict;
-use warnings;
use parent qw(Bugzilla::Object);
diff --git a/mozilla/webtools/bugzilla/Bugzilla/Sender/Transport/Sendmail.pm b/mozilla/webtools/bugzilla/Bugzilla/Send/Sendmail.pm
similarity index 64%
rename from mozilla/webtools/bugzilla/Bugzilla/Sender/Transport/Sendmail.pm
rename to mozilla/webtools/bugzilla/Bugzilla/Send/Sendmail.pm
index 49f00777fc1..9496ff97cf9 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/Sender/Transport/Sendmail.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/Send/Sendmail.pm
@@ -5,49 +5,57 @@
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.
-package Bugzilla::Sender::Transport::Sendmail;
+package Bugzilla::Send::Sendmail;
use 5.10.1;
use strict;
-use warnings;
-use parent qw(Email::Sender::Transport::Sendmail);
+use parent qw(Email::Send::Sendmail);
-use Email::Sender::Failure;
+use Return::Value;
+use Symbol qw(gensym);
-sub send_email {
- my ($self, $email, $envelope) = @_;
+sub send {
+ my ($class, $message, @args) = @_;
+ my $mailer = $class->_find_sendmail;
- my $pipe = $self->_sendmail_pipe($envelope);
+ return failure "Couldn't find 'sendmail' executable in your PATH"
+ ." and Email::Send::Sendmail::SENDMAIL is not set"
+ unless $mailer;
- my $string = $email->as_string;
- $string =~ s/\x0D\x0A/\x0A/g unless $^O eq 'MSWin32';
+ return failure "Found $mailer but cannot execute it"
+ unless -x $mailer;
+
+ local $SIG{'CHLD'} = 'DEFAULT';
- print $pipe $string
- or Email::Sender::Failure->throw("couldn't send message to sendmail: $!");
+ my $pipe = gensym;
+ open($pipe, "| $mailer -t -oi @args")
+ || return failure "Error executing $mailer: $!";
+ print($pipe $message->as_string)
+ || return failure "Error printing via pipe to $mailer: $!";
unless (close $pipe) {
- Email::Sender::Failure->throw("error when closing pipe to sendmail: $!") if $!;
+ return failure "error when closing pipe to $mailer: $!" if $!;
my ($error_message, $is_transient) = _map_exitcode($? >> 8);
if (Bugzilla->params->{'use_mailer_queue'}) {
# Return success for errors which are fatal so Bugzilla knows to
- # remove them from the queue.
+ # remove them from the queue
if ($is_transient) {
- Email::Sender::Failure->throw("error when closing pipe to sendmail: $error_message");
+ return failure "error when closing pipe to $mailer: $error_message";
} else {
- warn "error when closing pipe to sendmail: $error_message\n";
- return $self->success;
+ warn "error when closing pipe to $mailer: $error_message\n";
+ return success;
}
} else {
- Email::Sender::Failure->throw("error when closing pipe to sendmail: $error_message");
+ return failure "error when closing pipe to $mailer: $error_message";
}
}
- return $self->success;
+ return success;
}
sub _map_exitcode {
# Returns (error message, is_transient)
- # from the sendmail source (sendmail/sysexits.h)
+ # from the sendmail source (sendmail/sysexit.h)
my $code = shift;
if ($code == 64) {
return ("Command line usage error (EX_USAGE)", 1);
@@ -90,6 +98,6 @@ sub _map_exitcode {
=over
-=item send_email
+=item send
=back
diff --git a/mozilla/webtools/bugzilla/Bugzilla/Series.pm b/mozilla/webtools/bugzilla/Bugzilla/Series.pm
index 22202c6f18d..6c11f5dbcfd 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/Series.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/Series.pm
@@ -16,7 +16,6 @@ package Bugzilla::Series;
use 5.10.1;
use strict;
-use warnings;
use Bugzilla::Error;
use Bugzilla::Util;
diff --git a/mozilla/webtools/bugzilla/Bugzilla/Status.pm b/mozilla/webtools/bugzilla/Bugzilla/Status.pm
index 27551021604..1f8862a36a0 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/Status.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/Status.pm
@@ -9,7 +9,6 @@ package Bugzilla::Status;
use 5.10.1;
use strict;
-use warnings;
# This subclasses Bugzilla::Field::Choice instead of implementing
# ChoiceInterface, because a bug status literally is a special type
diff --git a/mozilla/webtools/bugzilla/Bugzilla/Template.pm b/mozilla/webtools/bugzilla/Bugzilla/Template.pm
index 26ef3758596..8fe50fa4f8b 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/Template.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/Template.pm
@@ -10,7 +10,6 @@ package Bugzilla::Template;
use 5.10.1;
use strict;
-use warnings;
use Bugzilla::Constants;
use Bugzilla::WebService::Constants;
@@ -148,11 +147,10 @@ sub get_format {
# If you want to modify this routine, read the comments carefully
sub quoteUrls {
- my ($text, $bug, $comment, $user, $bug_link_func, $for_markdown) = @_;
+ my ($text, $bug, $comment, $user, $bug_link_func) = @_;
return $text unless $text;
$user ||= Bugzilla->user;
$bug_link_func ||= \&get_bug_link;
- $for_markdown ||= 0;
# We use /g for speed, but uris can have other things inside them
# (http://foo/bug#3 for example). Filtering that out filters valid
@@ -223,11 +221,10 @@ sub quoteUrls {
$text = html_quote($text);
- unless ($for_markdown) {
- # Color quoted text
- $text =~ s~^(>.+)$~$1~mg;
- $text =~ s~\n~\n~g;
- }
+ # Color quoted text
+ $text =~ s~^(>.+)$~$1~mg;
+ $text =~ s~\n~\n~g;
+
# mailto:
# Use | so that $1 is defined regardless
# @ is the encoded '@' character.
@@ -265,23 +262,28 @@ sub quoteUrls {
my $bugs_re = qr/\Q$bugs_word\E$s*\#?$s*
\d+(?:$s*,$s*\#?$s*\d+)+/ix;
+ while ($text =~ m/($bugs_re)/g) {
+ my $offset = $-[0];
+ my $length = $+[0] - $-[0];
+ my $match = $1;
- $text =~ s{($bugs_re)}{
- my $match = $1;
$match =~ s/((?:#$s*)?(\d+))/$bug_link_func->($2, $1);/eg;
- $match;
- }eg;
+ # Replace the old string with the linkified one.
+ substr($text, $offset, $length) = $match;
+ }
my $comments_word = template_var('terms')->{comments};
my $comments_re = qr/(?:comments|\Q$comments_word\E)$s*\#?$s*
\d+(?:$s*,$s*\#?$s*\d+)+/ix;
+ while ($text =~ m/($comments_re)/g) {
+ my $offset = $-[0];
+ my $length = $+[0] - $-[0];
+ my $match = $1;
- $text =~ s{($comments_re)}{
- my $match = $1;
$match =~ s|((?:#$s*)?(\d+))|$1|g;
- $match;
- }eg;
+ substr($text, $offset, $length) = $match;
+ }
# Old duplicate markers. These don't use $bug_word because they are old
# and were never customizable.
@@ -532,7 +534,7 @@ sub _concatenate_css {
write_file($file, $content);
}
- $file =~ s/^\Q$cgi_path\E\///o;
+ $file =~ s/^\Q$cgi_path\E\///;
return mtime_filter($file);
}
@@ -541,61 +543,10 @@ sub _css_url_rewrite {
# rewrite relative urls as the unified stylesheet lives in a different
# directory from the source
$url =~ s/(^['"]|['"]$)//g;
- if (substr($url, 0, 1) eq '/' || substr($url, 0, 5) eq 'data:') {
- return 'url(' . $url . ')';
- }
+ return $url if substr($url, 0, 1) eq '/';
return 'url(../../' . dirname($source) . '/' . $url . ')';
}
-sub _concatenate_js {
- return @_ unless CONCATENATE_ASSETS;
- my ($sources) = @_;
- return [] unless $sources;
- $sources = ref($sources) ? $sources : [ $sources ];
-
- my %files =
- map {
- (my $file = $_) =~ s/(^[^\?]+)\?.+/$1/;
- $_ => $file;
- } @$sources;
-
- my $cgi_path = bz_locations()->{cgi_path};
- my $skins_path = bz_locations()->{assetsdir};
-
- # build minified files
- my @minified;
- foreach my $source (@$sources) {
- next unless -e "$cgi_path/$files{$source}";
- my $file = $skins_path . '/' . md5_hex($source) . '.js';
- if (!-e $file) {
- my $content = read_file("$cgi_path/$files{$source}");
-
- # minimal minification
- $content =~ s#/\*.*?\*/##sg; # block comments
- $content =~ s#(^ +| +$)##gm; # leading/trailing spaces
- $content =~ s#^//.+$##gm; # single line comments
- $content =~ s#\n{2,}#\n#g; # blank lines
- $content =~ s#(^\s+|\s+$)##g; # whitespace at the start/end of file
-
- write_file($file, ";/* $files{$source} */\n" . $content . "\n");
- }
- push @minified, $file;
- }
-
- # concat files
- my $file = $skins_path . '/' . md5_hex(join(' ', @$sources)) . '.js';
- if (!-e $file) {
- my $content = '';
- foreach my $source (@minified) {
- $content .= read_file($source);
- }
- write_file($file, $content);
- }
-
- $file =~ s/^\Q$cgi_path\E\///o;
- return [ $file ];
-}
-
# YUI dependency resolution
sub yui_resolve_deps {
my ($yui, $yui_deps) = @_;
@@ -660,21 +611,6 @@ $Template::Stash::LIST_OPS->{ clone } =
return [@$list];
};
-# Allow us to sort the list of fields correctly
-$Template::Stash::LIST_OPS->{ sort_by_field_name } =
- sub {
- sub field_name {
- if ($_[0] eq 'noop') {
- # Sort --- first
- return '';
- }
- # Otherwise sort by field_desc or description
- return $_[1]{$_[0]} || $_[0];
- }
- my ($list, $field_desc) = @_;
- return [ sort { lc field_name($a, $field_desc) cmp lc field_name($b, $field_desc) } @$list ];
- };
-
# Allow us to still get the scalar if we use the list operation ".0" on it,
# as we often do for defaults in query.cgi and other places.
$Template::Stash::SCALAR_OPS->{ 0 } =
@@ -860,24 +796,6 @@ sub create {
1
],
- markdown => [ sub {
- my ($context, $bug, $comment, $user) = @_;
- return sub {
- my $text = shift;
- return unless $text;
-
- if (Bugzilla->feature('markdown')
- && ((ref($comment) eq 'HASH' && $comment->{is_markdown})
- || (ref($comment) eq 'Bugzilla::Comment' && $comment->is_markdown)))
- {
- return Bugzilla->markdown->markdown($text);
- }
- return quoteUrls($text, $bug, $comment, $user);
- };
- },
- 1
- ],
-
bug_link => [ sub {
my ($context, $bug, $options) = @_;
return sub {
@@ -894,12 +812,10 @@ sub create {
},
# In CSV, quotes are doubled, and any value containing a quote or a
- # comma is enclosed in quotes. If a field starts with an equals
- # sign, it is proceed by a space.
+ # comma is enclosed in quotes.
csv => sub
{
my ($var) = @_;
- $var = ' ' . $var if substr($var, 0, 1) eq '=';
$var =~ s/\"/\"\"/g;
if ($var !~ /^-?(\d+\.)?\d*$/) {
$var = "\"$var\"";
@@ -1085,12 +1001,6 @@ sub create {
return $cookie ? issue_hash_token(['login_request', $cookie]) : '';
},
- 'get_api_token' => sub {
- return '' unless Bugzilla->user->id;
- my $cache = Bugzilla->request_cache;
- return $cache->{api_token} //= issue_api_token();
- },
-
# A way for all templates to get at Field data, cached.
'bug_fields' => sub {
my $cache = Bugzilla->request_cache;
@@ -1109,7 +1019,6 @@ sub create {
'css_files' => \&css_files,
yui_resolve_deps => \&yui_resolve_deps,
- concatenate_js => \&_concatenate_js,
# All classifications (sorted by sortkey, name)
'all_classifications' => sub {
diff --git a/mozilla/webtools/bugzilla/Bugzilla/Template/Context.pm b/mozilla/webtools/bugzilla/Bugzilla/Template/Context.pm
index 470e6a9ee1f..1e75d1d6f1a 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/Template/Context.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/Template/Context.pm
@@ -10,7 +10,6 @@ package Bugzilla::Template::Context;
use 5.10.1;
use strict;
-use warnings;
use parent qw(Template::Context);
diff --git a/mozilla/webtools/bugzilla/Bugzilla/Template/Plugin/Bugzilla.pm b/mozilla/webtools/bugzilla/Bugzilla/Template/Plugin/Bugzilla.pm
index 806dd903b68..f0de2ed4d18 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/Template/Plugin/Bugzilla.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/Template/Plugin/Bugzilla.pm
@@ -9,7 +9,6 @@ package Bugzilla::Template::Plugin::Bugzilla;
use 5.10.1;
use strict;
-use warnings;
use parent qw(Template::Plugin);
diff --git a/mozilla/webtools/bugzilla/Bugzilla/Template/Plugin/Hook.pm b/mozilla/webtools/bugzilla/Bugzilla/Template/Plugin/Hook.pm
index 669c77614ce..19260f0057f 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/Template/Plugin/Hook.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/Template/Plugin/Hook.pm
@@ -9,7 +9,6 @@ package Bugzilla::Template::Plugin::Hook;
use 5.10.1;
use strict;
-use warnings;
use parent qw(Template::Plugin);
diff --git a/mozilla/webtools/bugzilla/Bugzilla/Token.pm b/mozilla/webtools/bugzilla/Bugzilla/Token.pm
index 24ffad3c34a..5352638682b 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/Token.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/Token.pm
@@ -9,7 +9,6 @@ package Bugzilla::Token;
use 5.10.1;
use strict;
-use warnings;
use Bugzilla::Constants;
use Bugzilla::Error;
@@ -24,28 +23,13 @@ use Digest::SHA qw(hmac_sha256_base64);
use parent qw(Exporter);
-@Bugzilla::Token::EXPORT = qw(issue_api_token issue_session_token
- check_token_data delete_token
+@Bugzilla::Token::EXPORT = qw(issue_session_token check_token_data delete_token
issue_hash_token check_hash_token);
################################################################################
# Public Functions
################################################################################
-# Create a token used for internal API authentication
-sub issue_api_token {
- # Generates a random token, adds it to the tokens table if one does not
- # already exist, and returns the token to the caller.
- my $dbh = Bugzilla->dbh;
- my $user = Bugzilla->user;
- my ($token) = $dbh->selectrow_array("
- SELECT token FROM tokens
- WHERE userid = ? AND tokentype = 'api_token'
- AND (" . $dbh->sql_date_math('issuedate', '+', (MAX_TOKEN_AGE * 24 - 12), 'HOUR') . ") > NOW()",
- undef, $user->id);
- return $token // _create_token($user->id, 'api_token', '');
-}
-
# Creates and sends a token to create a new user account.
# It assumes that the login has the correct format and is not already in use.
sub issue_new_user_account_token {
@@ -482,14 +466,6 @@ Bugzilla::Token - Provides different routines to manage tokens.
=over
-=item C
-
- Description: Creates a token that can be used for API calls on the web page.
-
- Params: None.
-
- Returns: The token.
-
=item C
Description: Creates and sends a token per email to the email address
diff --git a/mozilla/webtools/bugzilla/Bugzilla/Update.pm b/mozilla/webtools/bugzilla/Bugzilla/Update.pm
index 72a7108a8e3..6a101219956 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/Update.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/Update.pm
@@ -9,7 +9,6 @@ package Bugzilla::Update;
use 5.10.1;
use strict;
-use warnings;
use Bugzilla::Constants;
diff --git a/mozilla/webtools/bugzilla/Bugzilla/User.pm b/mozilla/webtools/bugzilla/Bugzilla/User.pm
index fa267436618..3efe02633f9 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/User.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/User.pm
@@ -9,7 +9,6 @@ package Bugzilla::User;
use 5.10.1;
use strict;
-use warnings;
use Bugzilla::Error;
use Bugzilla::Util;
@@ -32,7 +31,7 @@ use URI::QueryParam;
use parent qw(Bugzilla::Object Exporter);
@Bugzilla::User::EXPORT = qw(is_available_username
- login_to_id validate_password validate_password_check
+ login_to_id validate_password
USER_MATCH_MULTIPLE USER_MATCH_FAILED USER_MATCH_SUCCESS
MATCH_SKIP_CONFIRM
);
@@ -632,14 +631,6 @@ sub is_bug_ignored {
return (grep {$_->{'id'} == $bug_id} @{$self->bugs_ignored}) ? 1 : 0;
}
-sub use_markdown {
- my ($self, $comment) = @_;
- return Bugzilla->feature('markdown')
- && $self->settings->{use_markdown}->{is_enabled}
- && $self->settings->{use_markdown}->{value} eq 'on'
- && (!defined $comment || $comment->is_markdown);
-}
-
##########################
# Saved Recent Bug Lists #
##########################
@@ -2457,35 +2448,29 @@ sub login_to_id {
}
sub validate_password {
- my $check = validate_password_check(@_);
- ThrowUserError($check) if $check;
- return 1;
-}
-
-sub validate_password_check {
my ($password, $matchpassword) = @_;
if (length($password) < USER_PASSWORD_MIN_LENGTH) {
- return 'password_too_short';
+ ThrowUserError('password_too_short');
} elsif ((defined $matchpassword) && ($password ne $matchpassword)) {
- return 'passwords_dont_match';
+ ThrowUserError('passwords_dont_match');
}
-
+
my $complexity_level = Bugzilla->params->{password_complexity};
if ($complexity_level eq 'letters_numbers_specialchars') {
- return 'password_not_complex'
+ ThrowUserError('password_not_complex')
if ($password !~ /[[:alpha:]]/ || $password !~ /\d/ || $password !~ /[[:punct:]]/);
} elsif ($complexity_level eq 'letters_numbers') {
- return 'password_not_complex'
+ ThrowUserError('password_not_complex')
if ($password !~ /[[:lower:]]/ || $password !~ /[[:upper:]]/ || $password !~ /\d/);
} elsif ($complexity_level eq 'mixed_letters') {
- return 'password_not_complex'
+ ThrowUserError('password_not_complex')
if ($password !~ /[[:lower:]]/ || $password !~ /[[:upper:]]/);
}
# Having done these checks makes us consider the password untainted.
trick_taint($_[0]);
- return;
+ return 1;
}
@@ -2631,12 +2616,6 @@ C The current summary of the bug.
Returns true if the user does not want email notifications for the
specified bug ID, else returns false.
-=item C
-
-Returns true if the user has set their preferences to use Markdown
-for rendering comments. If an optional C object is passed
-then it returns true if the comment has markdown enabled.
-
=back
=head2 Saved Recent Bug Lists
@@ -3162,23 +3141,12 @@ if you need more information about the user than just their ID.
=item C
Returns true if a password is valid (i.e. meets Bugzilla's
-requirements for length and content), else throws an error.
+requirements for length and content), else returns false.
Untaints C<$passwd1> if successful.
If a second password is passed in, this function also verifies that
the two passwords match.
-=item C
-
-This sub routine is similair to C, except that it allows
-the calling code to handle its own errors.
-
-Returns undef and untaints C<$passwd1> if a password is valid (i.e. meets
-Bugzilla's requirements for length and content), else returns the error.
-
-If a second password is passed in, this function also verifies that
-the two passwords match.
-
=item C
=over
diff --git a/mozilla/webtools/bugzilla/Bugzilla/User/APIKey.pm b/mozilla/webtools/bugzilla/Bugzilla/User/APIKey.pm
deleted file mode 100644
index d268a0a93c4..00000000000
--- a/mozilla/webtools/bugzilla/Bugzilla/User/APIKey.pm
+++ /dev/null
@@ -1,155 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-# This Source Code Form is "Incompatible With Secondary Licenses", as
-# defined by the Mozilla Public License, v. 2.0.
-
-package Bugzilla::User::APIKey;
-
-use 5.10.1;
-use strict;
-use warnings;
-
-use parent qw(Bugzilla::Object);
-
-use Bugzilla::User;
-use Bugzilla::Util qw(generate_random_password trim);
-
-#####################################################################
-# Overriden Constants that are used as methods
-#####################################################################
-
-use constant DB_TABLE => 'user_api_keys';
-use constant DB_COLUMNS => qw(
- id
- user_id
- api_key
- description
- revoked
- last_used
-);
-
-use constant UPDATE_COLUMNS => qw(description revoked last_used);
-use constant VALIDATORS => {
- api_key => \&_check_api_key,
- description => \&_check_description,
- revoked => \&Bugzilla::Object::check_boolean,
-};
-use constant LIST_ORDER => 'id';
-use constant NAME_FIELD => 'api_key';
-
-# turn off auditing and exclude these objects from memcached
-use constant { AUDIT_CREATES => 0,
- AUDIT_UPDATES => 0,
- AUDIT_REMOVES => 0,
- USE_MEMCACHED => 0 };
-
-# Accessors
-sub id { return $_[0]->{id} }
-sub user_id { return $_[0]->{user_id} }
-sub api_key { return $_[0]->{api_key} }
-sub description { return $_[0]->{description} }
-sub revoked { return $_[0]->{revoked} }
-sub last_used { return $_[0]->{last_used} }
-
-# Helpers
-sub user {
- my $self = shift;
- $self->{user} //= Bugzilla::User->new({name => $self->user_id, cache => 1});
- return $self->{user};
-}
-
-sub update_last_used {
- my $self = shift;
- my $timestamp = shift
- || Bugzilla->dbh->selectrow_array('SELECT LOCALTIMESTAMP(0)');
- $self->set('last_used', $timestamp);
- $self->update;
-}
-
-# Setters
-sub set_description { $_[0]->set('description', $_[1]); }
-sub set_revoked { $_[0]->set('revoked', $_[1]); }
-
-# Validators
-sub _check_api_key { return generate_random_password(40); }
-sub _check_description { return trim($_[1]) || ''; }
-1;
-
-__END__
-
-=head1 NAME
-
-Bugzilla::User::APIKey - Model for an api key belonging to a user.
-
-=head1 SYNOPSIS
-
- use Bugzilla::User::APIKey;
-
- my $api_key = Bugzilla::User::APIKey->new($id);
- my $api_key = Bugzilla::User::APIKey->new({ name => $api_key });
-
- # Class Functions
- $user_api_key = Bugzilla::User::APIKey->create({
- description => $description,
- });
-
-=head1 DESCRIPTION
-
-This package handles Bugzilla User::APIKey.
-
-C is an implementation of L, and
-thus provides all the methods of L in addition to the methods
-listed below.
-
-=head1 METHODS
-
-=head2 Accessor Methods
-
-=over
-
-=item C
-
-The internal id of the api key.
-
-=item C
-
-The Bugzilla::User object that this api key belongs to.
-
-=item C
-
-The user id that this api key belongs to.
-
-=item C
-
-The API key, which is a random string.
-
-=item C
-
-An optional string that lets the user describe what a key is used for.
-For example: "Dashboard key", "Application X key".
-
-=item C
-
-If true, this api key cannot be used.
-
-=item C
-
-The date that this key was last used. undef if never used.
-
-=item C
-
-Updates the last used value to the current timestamp. This is updated even
-if the RPC call resulted in an error. It is not updated when the description
-or the revoked flag is changed.
-
-=item C
-
-Sets the new description
-
-=item C
-
-Sets the revoked flag
-
-=back
diff --git a/mozilla/webtools/bugzilla/Bugzilla/User/Setting.pm b/mozilla/webtools/bugzilla/Bugzilla/User/Setting.pm
index ea3bbfb5423..451e946f774 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/User/Setting.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/User/Setting.pm
@@ -10,18 +10,13 @@ package Bugzilla::User::Setting;
use 5.10.1;
use strict;
-use warnings;
use parent qw(Exporter);
# Module stuff
-@Bugzilla::User::Setting::EXPORT = qw(
- get_all_settings
- get_defaults
- add_setting
- clear_settings_cache
-);
+@Bugzilla::User::Setting::EXPORT = qw(get_all_settings get_defaults
+ add_setting);
use Bugzilla::Error;
use Bugzilla::Util qw(trick_taint get_text);
@@ -164,20 +159,15 @@ sub get_all_settings {
my $settings = {};
my $dbh = Bugzilla->dbh;
- my $cache_key = "user_settings.$user_id";
- my $rows = Bugzilla->memcached->get_config({ key => $cache_key });
- if (!$rows) {
- $rows = $dbh->selectall_arrayref(
- q{SELECT name, default_value, is_enabled, setting_value, subclass
- FROM setting
- LEFT JOIN profile_setting
- ON setting.name = profile_setting.setting_name
- AND profile_setting.user_id = ?}, undef, ($user_id));
- Bugzilla->memcached->set_config({ key => $cache_key, data => $rows });
- }
+ my $rows = $dbh->selectall_arrayref(
+ q{SELECT name, default_value, is_enabled, setting_value, subclass
+ FROM setting
+ LEFT JOIN profile_setting
+ ON setting.name = profile_setting.setting_name
+ AND profile_setting.user_id = ?}, undef, ($user_id));
foreach my $row (@$rows) {
- my ($name, $default_value, $is_enabled, $value, $subclass) = @$row;
+ my ($name, $default_value, $is_enabled, $value, $subclass) = @$row;
my $is_default;
@@ -189,18 +179,13 @@ sub get_all_settings {
}
$settings->{$name} = new Bugzilla::User::Setting(
- $name, $user_id, $is_enabled,
+ $name, $user_id, $is_enabled,
$default_value, $value, $is_default, $subclass);
}
return $settings;
}
-sub clear_settings_cache {
- my ($user_id) = @_;
- Bugzilla->memcached->clear_config({ key => "user_settings.$user_id" });
-}
-
sub get_defaults {
my ($user_id) = @_;
my $dbh = Bugzilla->dbh;
@@ -383,13 +368,6 @@ Params: C<$setting_name> - string - the name of the setting
C<$is_enabled> - boolean - if false, all users must use the global default
Returns: nothing
-=item C
-
-Description: Clears cached settings data for the specified user. Must be
- called after updating any user's setting.
-Params: C<$user_id> - integer - the user id.
-Returns: nothing
-
=begin private
=item C<_setting_exists>
diff --git a/mozilla/webtools/bugzilla/Bugzilla/User/Setting/Lang.pm b/mozilla/webtools/bugzilla/Bugzilla/User/Setting/Lang.pm
index d980b7a92e0..4465185e3ff 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/User/Setting/Lang.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/User/Setting/Lang.pm
@@ -9,7 +9,6 @@ package Bugzilla::User::Setting::Lang;
use 5.10.1;
use strict;
-use warnings;
use parent qw(Bugzilla::User::Setting);
diff --git a/mozilla/webtools/bugzilla/Bugzilla/User/Setting/Skin.pm b/mozilla/webtools/bugzilla/Bugzilla/User/Setting/Skin.pm
index 7b0688c0c83..1e4e95a03e3 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/User/Setting/Skin.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/User/Setting/Skin.pm
@@ -10,7 +10,6 @@ package Bugzilla::User::Setting::Skin;
use 5.10.1;
use strict;
-use warnings;
use parent qw(Bugzilla::User::Setting);
diff --git a/mozilla/webtools/bugzilla/Bugzilla/User/Setting/Timezone.pm b/mozilla/webtools/bugzilla/Bugzilla/User/Setting/Timezone.pm
index 8959d1ddace..848fa418f8b 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/User/Setting/Timezone.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/User/Setting/Timezone.pm
@@ -9,7 +9,6 @@ package Bugzilla::User::Setting::Timezone;
use 5.10.1;
use strict;
-use warnings;
use DateTime::TimeZone;
diff --git a/mozilla/webtools/bugzilla/Bugzilla/UserAgent.pm b/mozilla/webtools/bugzilla/Bugzilla/UserAgent.pm
index 6ceb9d3c5ce..4e685cacc75 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/UserAgent.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/UserAgent.pm
@@ -9,7 +9,6 @@ package Bugzilla::UserAgent;
use 5.10.1;
use strict;
-use warnings;
use parent qw(Exporter);
our @EXPORT = qw(detect_platform detect_op_sys);
@@ -106,7 +105,6 @@ use constant OS_MAP => (
qr/\(.*Android.*\)/ => ["Android"],
# Windows
qr/\(.*Windows XP.*\)/ => ["Windows XP"],
- qr/\(.*Windows NT 6\.4.*\)/ => ["Windows 10"],
qr/\(.*Windows NT 6\.3.*\)/ => ["Windows 8.1"],
qr/\(.*Windows NT 6\.2.*\)/ => ["Windows 8"],
qr/\(.*Windows NT 6\.1.*\)/ => ["Windows 7"],
diff --git a/mozilla/webtools/bugzilla/Bugzilla/Util.pm b/mozilla/webtools/bugzilla/Bugzilla/Util.pm
index 670f5f8f28b..4f0711b7e0c 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/Util.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/Util.pm
@@ -9,7 +9,6 @@ package Bugzilla::Util;
use 5.10.1;
use strict;
-use warnings;
use parent qw(Exporter);
@Bugzilla::Util::EXPORT = qw(trick_taint detaint_natural detaint_signed
@@ -552,14 +551,9 @@ sub datetime_from {
# In the database, this is the "0" date.
return undef if $date =~ /^0000/;
- my @time;
- # Most dates will be in this format, avoid strptime's generic parser
- if ($date =~ /^(\d{4})[\.-](\d{2})[\.-](\d{2})(?: (\d{2}):(\d{2}):(\d{2}))?$/) {
- @time = ($6, $5, $4, $3, $2 - 1, $1 - 1900, undef);
- }
- else {
- @time = strptime($date);
- }
+ # strptime($date) returns an empty array if $date has an invalid
+ # date format.
+ my @time = strptime($date);
unless (scalar @time) {
# If an unknown timezone is passed (such as MSK, for Moskow),
@@ -571,14 +565,10 @@ sub datetime_from {
return undef if !@time;
- # strptime() counts years from 1900, except if they are older than 1901
- # in which case it returns the full year (so 1890 -> 1890, but 1984 -> 84,
- # and 3790 -> 1890). We make a guess and assume that 1100 <= year < 3000.
- $time[5] += 1900 if $time[5] < 1100;
-
+ # strptime() counts years from 1900, and months from 0 (January).
+ # We have to fix both values.
my %args = (
- year => $time[5],
- # Months start from 0 (January).
+ year => $time[5] + 1900,
month => $time[4] + 1,
day => $time[3],
hour => $time[2],
diff --git a/mozilla/webtools/bugzilla/Bugzilla/Version.pm b/mozilla/webtools/bugzilla/Bugzilla/Version.pm
index 4b332ff2bc9..c6b178a8ab9 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/Version.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/Version.pm
@@ -9,7 +9,6 @@ package Bugzilla::Version;
use 5.10.1;
use strict;
-use warnings;
use parent qw(Bugzilla::Object Exporter);
diff --git a/mozilla/webtools/bugzilla/Bugzilla/WebService.pm b/mozilla/webtools/bugzilla/Bugzilla/WebService.pm
index 1bdeb49d1f6..1dc04c1f6c9 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/WebService.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/WebService.pm
@@ -11,7 +11,6 @@ package Bugzilla::WebService;
use 5.10.1;
use strict;
-use warnings;
use Bugzilla::WebService::Server;
@@ -135,22 +134,14 @@ how this is implemented for those frontends.
=head1 LOGGING IN
-Some methods do not require you to log in. An example of this is Bug.get.
-However, authenticating yourself allows you to see non public information. For
-example, a bug that is not publicly visible.
-
-There are two ways to authenticate yourself:
+There are various ways to log in:
=over
-=item C
+=item C
-B
-
-You can specify C as an argument to any WebService method, and
-you will be logged in as that user if the key is correct, and has not been
-revoked. You can set up an API key by using the 'API Key' tab in the
-Preferences pages.
+You can use L to log in as a Bugzilla
+user. This issues a token that you must then use in future calls.
=item C and C
@@ -173,29 +164,15 @@ then your login will only be valid for your IP address.
=back
The C option is only used when you have also
-specified C and C. This value will be
-deprecated in the release after Bugzilla 5.0 and you will be required to
-pass the Bugzilla_login and Bugzilla_password for every call.
+specified C and C.
For REST, you may also use the C and C variable
names instead of C and C as a
convenience. You may also use C instead of C.
-=back
-
-There are also two deprecreated methods of authentications. This will be
-removed in the version after Bugzilla 5.0.
-
-=over
-
-=item C
-
-You can use L to log in as a Bugzilla
-user. This issues a token that you must then use in future calls.
-
=item C
-B
+B
You can specify C as argument to any WebService method,
and you will be logged in as that user if the token is correct. This is
@@ -315,7 +292,7 @@ hashes.
Some RPC calls support specifying sub fields. If an RPC call states that
it support sub field restrictions, you can restrict what information is
-returned within the first field. For example, if you call Product.get
+returned within the first field. For example, if you call Products.get
with an include_fields of components.name, then only the component name
would be returned (and nothing else). You can include the main field,
and exclude a sub field.
@@ -390,8 +367,6 @@ objects.
=item L
-=item L
-
=item L
=item L
diff --git a/mozilla/webtools/bugzilla/Bugzilla/WebService/Bug.pm b/mozilla/webtools/bugzilla/Bugzilla/WebService/Bug.pm
index de358b1e027..0346511a943 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/WebService/Bug.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/WebService/Bug.pm
@@ -9,7 +9,6 @@ package Bugzilla::WebService::Bug;
use 5.10.1;
use strict;
-use warnings;
use parent qw(Bugzilla::WebService);
@@ -331,9 +330,7 @@ sub render_comment {
Bugzilla->switch_to_shadow_db();
my $bug = $params->{id} ? Bugzilla::Bug->check($params->{id}) : undef;
- my $markdown = $params->{markdown} ? 1 : 0;
- my $tmpl = $markdown ? '[% text FILTER markdown(bug, { is_markdown => 1 }) %]' : '[% text FILTER markdown(bug) %]';
-
+ my $tmpl = '[% text FILTER quoteUrls(bug) %]';
my $html;
my $template = Bugzilla->template;
$template->process(
@@ -352,16 +349,15 @@ sub _translate_comment {
: undef;
my $comment_hash = {
- id => $self->type('int', $comment->id),
- bug_id => $self->type('int', $comment->bug_id),
- creator => $self->type('email', $comment->author->login),
- time => $self->type('dateTime', $comment->creation_ts),
+ id => $self->type('int', $comment->id),
+ bug_id => $self->type('int', $comment->bug_id),
+ creator => $self->type('email', $comment->author->login),
+ time => $self->type('dateTime', $comment->creation_ts),
creation_time => $self->type('dateTime', $comment->creation_ts),
- is_private => $self->type('boolean', $comment->is_private),
- is_markdown => $self->type('boolean', $comment->is_markdown),
- text => $self->type('string', $comment->body_full),
+ is_private => $self->type('boolean', $comment->is_private),
+ text => $self->type('string', $comment->body_full),
attachment_id => $self->type('int', $attach_id),
- count => $self->type('int', $comment->count),
+ count => $self->type('int', $comment->count),
};
# Don't load comment tags unless enabled
@@ -471,7 +467,7 @@ sub history {
# alias is returned in case users passes a mixture of ids and aliases
# then they get to know which bug activity relates to which value
# they passed
- $item{alias} = [ map { $self->type('string', $_) } @{ $bug->alias } ];
+ $item{alias} = $self->type('string', $bug->alias);
push(@return, \%item);
}
@@ -635,16 +631,6 @@ sub update {
# called using those field names.
delete $values{dependencies};
- # For backwards compatibility, treat alias string or array as a set action
- if (exists $values{alias}) {
- if (not ref $values{alias}) {
- $values{alias} = { set => [ $values{alias} ] };
- }
- elsif (ref $values{alias} eq 'ARRAY') {
- $values{alias} = { set => $values{alias} };
- }
- }
-
my $flags = delete $values{flags};
foreach my $bug (@bugs) {
@@ -682,7 +668,7 @@ sub update {
# alias is returned in case users pass a mixture of ids and aliases,
# so that they can know which set of changes relates to which value
# they passed.
- $hash{alias} = [ map { $self->type('string', $_) } @{ $bug->alias } ];
+ $hash{alias} = $self->type('string', $bug->alias);
my %changes = %{ $all_changes{$bug->id} };
foreach my $field (keys %changes) {
@@ -825,21 +811,10 @@ sub add_attachment {
$attachment->update($timestamp);
my $comment = $params->{comment} || '';
-
- my $is_markdown = 0;
- if (ref $params->{comment} eq 'HASH') {
- $is_markdown = $params->{comment}->{is_markdown};
- $comment = $params->{comment}->{body};
- }
-
- ThrowUserError('markdown_disabled')
- if $is_markdown && !Bugzilla->user->use_markdown();
-
- $attachment->bug->add_comment($comment,
- { is_markdown => $is_markdown,
- isprivate => $attachment->isprivate,
- type => CMT_ATTACHMENT_CREATED,
- extra_data => $attachment->id });
+ $attachment->bug->add_comment($comment,
+ { isprivate => $attachment->isprivate,
+ type => CMT_ATTACHMENT_CREATED,
+ extra_data => $attachment->id });
push(@created, $attachment);
}
$_->bug->update($timestamp) foreach @created;
@@ -885,15 +860,6 @@ sub update_attachment {
my $flags = delete $params->{flags};
my $comment = delete $params->{comment};
- my $is_markdown = 0;
-
- if (ref $comment eq 'HASH') {
- $is_markdown = $comment->{is_markdown};
- $comment = $comment->{body};
- }
-
- ThrowUserError('markdown_disabled')
- if $is_markdown && !$user->use_markdown();
# Update the values
foreach my $attachment (@attachments) {
@@ -913,10 +879,9 @@ sub update_attachment {
if ($comment = trim($comment)) {
$attachment->bug->add_comment($comment,
- { is_markdown => $is_markdown,
- isprivate => $attachment->isprivate,
- type => CMT_ATTACHMENT_UPDATED,
- extra_data => $attachment->id });
+ { isprivate => $attachment->isprivate,
+ type => CMT_ATTACHMENT_UPDATED,
+ extra_data => $attachment->id });
}
$changes = translate($changes, ATTACHMENT_MAPPED_RETURNS);
@@ -973,14 +938,9 @@ sub add_comment {
if (defined $params->{private}) {
$params->{is_private} = delete $params->{private};
}
-
- ThrowUserError('markdown_disabled')
- if $params->{is_markdown} && !$user->use_markdown();
-
# Append comment
- $bug->add_comment($comment, { isprivate => $params->{is_private},
- is_markdown => $params->{is_markdown},
- work_time => $params->{work_time} });
+ $bug->add_comment($comment, { isprivate => $params->{is_private},
+ work_time => $params->{work_time} });
# Capture the call to bug->update (which creates the new comment) in
# a transaction so we're sure to get the correct comment_id.
@@ -1175,11 +1135,7 @@ sub search_comment_tags {
my $query = $params->{query};
$query
// ThrowCodeError('param_required', { param => 'query' });
- my $limit = $params->{limit} || 7;
- detaint_natural($limit)
- || ThrowCodeError('param_must_be_numeric', { param => 'limit',
- function => 'Bug.search_comment_tags' });
-
+ my $limit = detaint_natural($params->{limit}) || 7;
my $tags = Bugzilla::Comment::TagWeights->match({
WHERE => {
@@ -1206,11 +1162,14 @@ sub _bug_to_hash {
# A bug attribute is "basic" if it doesn't require an additional
# database call to get the info.
my %item = %{ filter $params, {
+ alias => $self->type('string', $bug->alias),
+ creation_time => $self->type('dateTime', $bug->creation_ts),
# No need to format $bug->deadline specially, because Bugzilla::Bug
# already does it for us.
deadline => $self->type('string', $bug->deadline),
id => $self->type('int', $bug->bug_id),
is_confirmed => $self->type('boolean', $bug->everconfirmed),
+ last_change_time => $self->type('dateTime', $bug->delta_ts),
op_sys => $self->type('string', $bug->op_sys),
platform => $self->type('string', $bug->rep_platform),
priority => $self->type('string', $bug->priority),
@@ -1224,11 +1183,9 @@ sub _bug_to_hash {
whiteboard => $self->type('string', $bug->status_whiteboard),
} };
- # First we handle any fields that require extra work (such as date parsing
- # or SQL calls).
- if (filter_wants $params, 'alias') {
- $item{alias} = [ map { $self->type('string', $_) } @{ $bug->alias } ];
- }
+ # First we handle any fields that require extra SQL calls.
+ # We don't do the SQL calls at all if the filter would just
+ # eliminate them anyway.
if (filter_wants $params, 'assigned_to') {
$item{'assigned_to'} = $self->type('email', $bug->assigned_to->login);
$item{'assigned_to_detail'} = $self->_user_to_hash($bug->assigned_to, $params, undef, 'assigned_to');
@@ -1248,9 +1205,6 @@ sub _bug_to_hash {
$item{'cc'} = \@cc;
$item{'cc_detail'} = [ map { $self->_user_to_hash($_, $params, undef, 'cc') } @{ $bug->cc_users } ];
}
- if (filter_wants $params, 'creation_time') {
- $item{'creation_time'} = $self->type('dateTime', $bug->creation_ts);
- }
if (filter_wants $params, 'creator') {
$item{'creator'} = $self->type('email', $bug->reporter->login);
$item{'creator_detail'} = $self->_user_to_hash($bug->reporter, $params, undef, 'creator');
@@ -1275,9 +1229,6 @@ sub _bug_to_hash {
@{ $bug->keyword_objects };
$item{'keywords'} = \@keywords;
}
- if (filter_wants $params, 'last_change_time') {
- $item{'last_change_time'} = $self->type('dateTime', $bug->delta_ts);
- }
if (filter_wants $params, 'product') {
$item{product} = $self->type('string', $bug->product);
}
@@ -1531,12 +1482,6 @@ C The number of the fieldtype. The following values are defined:
=item C<7> Bug URLs ("See Also")
-=item C<8> Keywords
-
-=item C<9> Date
-
-=item C<10> Integer value
-
=back
=item C
@@ -2105,10 +2050,6 @@ may be deprecated and removed in a future release.
C True if this comment is private (only visible to a certain
group called the "insidergroup"), False otherwise.
-=item is_markdown
-
-C True if this comment needs Markdown processing, false otherwise.
-
=back
=item B
@@ -2226,8 +2167,7 @@ in the return value.
=item C
-C of Cs The unique aliases of this bug. An empty array will be
-returned if this bug has no aliases.
+C The unique alias of this bug.
=item C
@@ -2672,8 +2612,7 @@ C The numeric id of the bug.
=item alias
-C of Cs The unique aliases of this bug. An empty array will be
-returned if this bug has no aliases.
+C The alias of this bug. If there is no alias, this will be undef.
=item history
@@ -2856,8 +2795,7 @@ just reuse the query parameter portion in the REST call itself.
=item C
-C of Cs The unique aliases of this bug. An empty array will be
-returned if this bug has no aliases.
+C The unique alias for this bug.
=item C
@@ -3114,7 +3052,7 @@ in by the developer, compared to the developer's other bugs.
=item C (string) B - How severe the bug is.
-=item C (array) - A brief alias for the bug that can be used
+=item C (string) - A brief alias for the bug that can be used
instead of a bug number when accessing this bug. Must be unique in
all of this Bugzilla.
@@ -3126,9 +3064,6 @@ don't want it to be assigned to the component owner.
=item C (boolean) - If set to true, the description
is private, otherwise it is assumed to be public.
-=item C (boolean) - If set to true, the description
-has Markdown structures, otherwise it is a normal text.
-
=item C (array) - An array of group names to put this
bug into. You can see valid group names on the Permissions
tab of the Preferences screen, or, if you are an administrator,
@@ -3284,8 +3219,6 @@ Bugzilla B<4.4>.
=item REST API call added in Bugzilla B<5.0>.
-=item C option added in Bugzilla B<5.0>.
-
=back
=back
@@ -3345,21 +3278,7 @@ C or C.
=item C
-C or hash. A comment to add along with this attachment. If C
-is a hash, it has the following keys:
-
-=over
-
-=item C
-
-C The body of the comment.
-
-=item C
-
-C If set to true, the comment has Markdown structures; otherwise, it
-is an ordinary text.
-
-=back
+C A comment to add along with this attachment.
=item C
@@ -3437,10 +3356,6 @@ the type id value to update or add a flag.
The flag type is inactive and cannot be used to create new flags.
-=item 140 (Markdown Disabled)
-
-You tried to set the C flag of the comment to true but the Markdown feature is not enabled.
-
=item 600 (Attachment Too Large)
You tried to attach a file that was larger than Bugzilla will accept.
@@ -3476,8 +3391,6 @@ You set the "data" field to an empty string.
=item REST API call added in Bugzilla B<5.0>.
-=item C added in Bugzilla B<5.0>.
-
=back
=back
@@ -3524,21 +3437,7 @@ attachment.
=item C
-C or hash: An optional comment to add to the attachment's bug. If C is
-a hash, it has the following keys:
-
-=over
-
-=item C
-
-C The body of the comment to be added.
-
-=item C
-
-C If set to true, the comment has Markdown structures; otherwise it is a normal
-text.
-
-=back
+C An optional comment to add to the attachment's bug.
=item C
@@ -3687,11 +3586,6 @@ the type id value to update or add a flag.
The flag type is inactive and cannot be used to create new flags.
-=item 140 (Markdown Disabled)
-
-You tried to set the C flag of the C to true but Markdown feature is
-not enabled.
-
=item 601 (Invalid MIME Type)
You specified a C argument that was blank, not a valid
@@ -3752,9 +3646,6 @@ you did not set the C parameter.
=item C (boolean) - If set to true, the comment is private,
otherwise it is assumed to be public.
-=item C (boolean) - If set to true, the comment has Markdown
-structures, otherwise it is a normal text.
-
=item C (double) - Adds this many hours to the "Hours Worked"
on the bug. If you are not in the time tracking group, this value will
be ignored.
@@ -3796,11 +3687,6 @@ You tried to add a private comment, but don't have the necessary rights.
You tried to add a comment longer than the maximum allowed length
(65,535 characters).
-=item 140 (Markdown Disabled)
-
-You tried to set the C flag to true but the Markdown feature
-is not enabled.
-
=back
=item B
@@ -3823,8 +3709,6 @@ code of 32000.
=item REST API call added in Bugzilla B<5.0>.
-=item C option added in Bugzilla B<5.0>.
-
=back
=back
@@ -3869,29 +3753,9 @@ bugs you are updating.
=item C
-C These specify the aliases of a bug that can be used instead of a bug
-number when acessing this bug. To set these, you should pass a hash as the
-value. The hash may contain the following fields:
-
-=over
-
-=item C An array of Cs. Aliases to add to this field.
-
-=item C An array of Cs. Aliases to remove from this field.
-If the aliases are not already in the field, they will be ignored.
-
-=item C An array of Cs. An exact set of aliases to set this
-field to, overriding the current value. If you specify C, then C
-and C will be ignored.
-
-=back
-
-You can only set this if you are modifying a single bug. If there is more
-than one bug specified in C, passing in a value for C will cause
-an error to be thrown.
-
-For backwards compatibility, you can also specify a single string. This will
-be treated as if you specified the set key above.
+(string) The alias of the bug. You can only set this if you are modifying
+a single bug. If there is more than one bug specified in C, passing in
+a value for C will cause an error to be thrown.
=item C
@@ -4210,8 +4074,7 @@ C The id of the bug that was updated.
=item C
-C of Cs The aliases of the bug that was updated, if this bug
-has any alias.
+C The alias of the bug that was updated, if this bug has an alias.
=item C
@@ -4245,7 +4108,7 @@ Here's an example of what a return value might look like:
bugs => [
{
id => 123,
- alias => [ 'foo' ],
+ alias => 'foo',
last_change_time => '2010-01-01T12:34:56',
changes => {
status => {
diff --git a/mozilla/webtools/bugzilla/Bugzilla/WebService/BugUserLastVisit.pm b/mozilla/webtools/bugzilla/Bugzilla/WebService/BugUserLastVisit.pm
index a29d2633b83..71b637fef65 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/WebService/BugUserLastVisit.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/WebService/BugUserLastVisit.pm
@@ -9,7 +9,6 @@ package Bugzilla::WebService::BugUserLastVisit;
use 5.10.1;
use strict;
-use warnings;
use parent qw(Bugzilla::WebService);
@@ -69,10 +68,10 @@ sub get {
$user->visible_bugs([grep /^[0-9]$/, @$ids]);
}
- my @last_visits = @{ $user->last_visited };
+ my @last_visits = @{ $user->last_visits };
if ($ids) {
- # remove bugs that we are not interested in if ids is passed in.
+ # remove bugs that we arn't interested in if ids is passed in.
my %id_set = map { ($_ => 1) } @$ids;
@last_visits = grep { $id_set{ $_->bug_id } } @last_visits;
}
@@ -167,13 +166,20 @@ B
=item B
-Get the last visited timestamp for one or more specified bug ids.
+Get the last visited timestamp for one or more specified bug ids or get a
+list of the last 20 visited bugs and their timestamps.
=item B
To return the last visited timestamp for a single bug id:
- GET /rest/bug_user_last_visit/
+GET /rest/bug_visit/
+
+To return more than one bug timestamp or the last 20:
+
+GET /rest/bug_visit
+
+The returned data format is the same as below.
=item B
diff --git a/mozilla/webtools/bugzilla/Bugzilla/WebService/Bugzilla.pm b/mozilla/webtools/bugzilla/Bugzilla/WebService/Bugzilla.pm
index 8333f99c480..6b5f9844ffc 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/WebService/Bugzilla.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/WebService/Bugzilla.pm
@@ -9,7 +9,6 @@ package Bugzilla::WebService::Bugzilla;
use 5.10.1;
use strict;
-use warnings;
use parent qw(Bugzilla::WebService);
use Bugzilla::Constants;
diff --git a/mozilla/webtools/bugzilla/Bugzilla/WebService/Classification.pm b/mozilla/webtools/bugzilla/Bugzilla/WebService/Classification.pm
index 8e1b3ae8a6e..bbc967ce7ac 100644
--- a/mozilla/webtools/bugzilla/Bugzilla/WebService/Classification.pm
+++ b/mozilla/webtools/bugzilla/Bugzilla/WebService/Classification.pm
@@ -9,7 +9,6 @@ package Bugzilla::WebService::Classification;
use 5.10.1;
use strict;
-use warnings;
use parent qw (Bugzilla::WebService);
diff --git a/mozilla/webtools/bugzilla/Bugzilla/WebService/Component.pm b/mozilla/webtools/bugzilla/Bugzilla/WebService/Component.pm
deleted file mode 100644
index 893e244b892..00000000000
--- a/mozilla/webtools/bugzilla/Bugzilla/WebService/Component.pm
+++ /dev/null
@@ -1,149 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-# This Source Code Form is "Incompatible With Secondary Licenses", as
-# defined by the Mozilla Public License, v. 2.0.
-
-package Bugzilla::WebService::Component;
-
-use 5.10.1;
-use strict;
-use warnings;
-
-use base qw(Bugzilla::WebService);
-
-use Bugzilla::Component;
-use Bugzilla::Constants;
-use Bugzilla::Error;
-use Bugzilla::WebService::Constants;
-use Bugzilla::WebService::Util qw(translate params_to_objects validate);
-
-use constant MAPPED_FIELDS => {
- default_assignee => 'initialowner',
- default_qa_contact => 'initialqacontact',
- default_cc => 'initial_cc',
- is_open => 'isactive',
-};
-
-sub create {
- my ($self, $params) = @_;
-
- my $user = Bugzilla->login(LOGIN_REQUIRED);
-
- $user->in_group('editcomponents')
- || scalar @{ $user->get_products_by_permission('editcomponents') }
- || ThrowUserError('auth_failure', { group => 'editcomponents',
- action => 'edit',
- object => 'components' });
-
- my $product = $user->check_can_admin_product($params->{product});
-
- # Translate the fields
- my $values = translate($params, MAPPED_FIELDS);
- $values->{product} = $product;
-
- # Create the component and return the newly created id.
- my $component = Bugzilla::Component->create($values);
- return { id => $self->type('int', $component->id) };
-}
-
-1;
-
-__END__
-
-=head1 NAME
-
-Bugzilla::Webservice::Component - The Component API
-
-=head1 DESCRIPTION
-
-This part of the Bugzilla API allows you to deal with the available product components.
-You will be able to get information about them as well as manipulate them.
-
-=head1 METHODS
-
-See L for a description of how parameters are passed,
-and what B, B, and B mean.
-
-=head1 Component Creation and Modification
-
-=head2 create
-
-B
-
-=over
-
-=item B
-
-This allows you to create a new component in Bugzilla.
-
-=item B
-
-Some params must be set, or an error will be thrown. These params are
-marked B.
-
-=over
-
-=item C
-
-B C The name of the new component.
-
-=item C
-
-B C