diff options
Diffstat (limited to 'extensions')
29 files changed, 211 insertions, 211 deletions
diff --git a/extensions/BMO/Extension.pm b/extensions/BMO/Extension.pm index 09bd347d2..0f63ffbb4 100644 --- a/extensions/BMO/Extension.pm +++ b/extensions/BMO/Extension.pm @@ -116,7 +116,7 @@ sub template_before_process { my @order_columns; foreach my $o (@orderstrings) { $o =~ s/bugs.//; - $o = $db_order_column_name_map{$o} if + $o = $db_order_column_name_map{$o} if grep($_ eq $o, keys(%db_order_column_name_map)); next if (grep($_ eq $o, @order_columns)); push(@order_columns, $o); @@ -124,7 +124,7 @@ sub template_before_process { $vars->{'order_columns'} = \@order_columns; - # fields that have a custom sortkey. (So they are correctly sorted + # fields that have a custom sortkey. (So they are correctly sorted # when using js) my @sortkey_fields = qw(bug_status resolution bug_severity priority rep_platform op_sys); @@ -141,7 +141,7 @@ sub template_before_process { my $format = $1; if (!$vars->{'cloned_bug_id'}) { # Allow status whiteboard values to be bookmarked - $vars->{'status_whiteboard'} = + $vars->{'status_whiteboard'} = Bugzilla->cgi->param('status_whiteboard') || ""; } @@ -159,7 +159,7 @@ sub template_before_process { if ($file =~ /^list\/list/ || $file =~ /^bug\/create\/create[\.-]/) { - # hack to allow the bug entry templates to use check_can_change_field + # hack to allow the bug entry templates to use check_can_change_field # to see if various field values should be available to the current user. $vars->{'default'} = Bugzilla::Extension::BMO::FakeBug->new($vars->{'default'} || {}); } @@ -238,7 +238,7 @@ sub page_before_template { # were changed for better performance and are now only loaded once. # I have not found an easy way to allow our hook template to check if # it is called from pages/fields.html.tmpl. So we set a value in request_cache - # that our hook template can see. + # that our hook template can see. Bugzilla->request_cache->{'bmo_fields_page'} = 1; } elsif ($page eq 'query_database.html') { @@ -423,7 +423,7 @@ sub active_custom_fields { my $component_name = blessed $component ? $component->name : $component; my @tmp_fields; - foreach my $field (@$$fields) { + foreach my $field (@$$fields) { next if cf_hidden_in_product($field->name, $product_name, $component_name); push(@tmp_fields, $field); } @@ -445,7 +445,7 @@ sub cf_hidden_in_product { ? $product_name->name : $product_name; - # Also in buglist.cgi, we pass in a list of components instead + # Also in buglist.cgi, we pass in a list of components instead # of a single component name everywhere else. my $component_list = []; if ($component_name) { @@ -482,7 +482,7 @@ sub cf_hidden_in_product { } # If product matches and at at least one component matches - # from component_list (if a matching component was required), + # from component_list (if a matching component was required), # we allow the field to be seen if ($product eq $product_name && (!@$components || $found_component)) { return 0; @@ -495,7 +495,7 @@ sub cf_hidden_in_product { return 0; } -# Purpose: CC certain email addresses on bugmail when a bug is added or +# Purpose: CC certain email addresses on bugmail when a bug is added or # removed from a particular group. sub bugmail_recipients { my ($self, $args) = @_; @@ -529,9 +529,9 @@ sub bugmail_recipients { sub _cc_if_special_group { my ($group, $recipients) = @_; - + return if !$group; - + if (exists $group_change_notification{$group}) { foreach my $login (@{ $group_change_notification{$group} }) { my $id = login_to_id($login); @@ -542,7 +542,7 @@ sub _cc_if_special_group { sub _check_trusted { my ($field, $trusted, $priv_results) = @_; - + my $needed_group = $trusted->{'_default'} || ""; foreach my $dfield (keys %$trusted) { if ($field =~ $dfield) { @@ -551,7 +551,7 @@ sub _check_trusted { } if ($needed_group && !Bugzilla->user->in_group($needed_group)) { push (@$priv_results, PRIVILEGES_REQUIRED_EMPOWERED); - } + } } sub _is_field_set { @@ -616,7 +616,7 @@ sub bug_check_can_change_field { } } elsif ($user->in_group('canconfirm', $bug->{'product_id'})) { - # Canconfirm is really "cantriage"; users with canconfirm can also mark + # Canconfirm is really "cantriage"; users with canconfirm can also mark # bugs as DUPLICATE, WORKSFORME, and INCOMPLETE. if ($field eq 'bug_status' && is_open_state($old_value) @@ -638,9 +638,9 @@ sub bug_check_can_change_field { } elsif ($field eq 'bug_status') { # Disallow reopening of bugs which have been resolved for > 1 year - if (is_open_state($new_value) + if (is_open_state($new_value) && !is_open_state($old_value) - && $bug->resolution eq 'FIXED') + && $bug->resolution eq 'FIXED') { my $days_ago = DateTime->now(time_zone => Bugzilla->local_timezone); $days_ago->subtract(days => 365); @@ -789,7 +789,7 @@ sub bug_format_comment { # link to hg.m.o # Note: for grouping in this regexp, always use non-capturing parentheses. - my $hgrepos = join('|', qw!(?:releases/)?comm-[\w.]+ + my $hgrepos = join('|', qw!(?:releases/)?comm-[\w.]+ (?:releases/)?mozilla-[\w.]+ (?:releases/)?mobile-[\w.]+ tracemonkey @@ -2541,7 +2541,7 @@ sub install_filesystem { # our repository. We already have this information in the (static) # contribute.json file, so parse that in my $json = JSON::XS->new->pretty->utf8->canonical(); - my $contribute = eval { + my $contribute = eval { $json->decode(scalar read_file(bz_locations()->{cgi_path} . "/contribute.json")); }; my $commit = `git rev-parse HEAD`; diff --git a/extensions/BMO/lib/Constants.pm b/extensions/BMO/lib/Constants.pm index 3670cb9a2..8227208c8 100644 --- a/extensions/BMO/lib/Constants.pm +++ b/extensions/BMO/lib/Constants.pm @@ -17,7 +17,7 @@ our @EXPORT = qw( DEV_ENGAGE_DISCUSS_NEEDINFO ); -# Maximum attachment size in lines that will be sent with a +# Maximum attachment size in lines that will be sent with a # requested attachment flag notification. use constant REQUEST_MAX_ATTACH_LINES => 1000; diff --git a/extensions/BMO/lib/WebService.pm b/extensions/BMO/lib/WebService.pm index 6ee7cfa6e..327c8563f 100644 --- a/extensions/BMO/lib/WebService.pm +++ b/extensions/BMO/lib/WebService.pm @@ -4,7 +4,7 @@ # 1.1 (the "License"); you may not use this file except in compliance with the # License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ # -# Software distributed under the License is distributed on an "AS IS" basis, +# Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for # the specific language governing rights and limitations under the License. # @@ -40,7 +40,7 @@ sub getBugsConfirmer { my ($self, $params) = validate(@_, 'names'); my $dbh = Bugzilla->dbh; - defined($params->{names}) + defined($params->{names}) || ThrowCodeError('params_required', { function => 'BMO.getBugsConfirmer', params => ['names'] }); @@ -53,7 +53,7 @@ sub getBugsConfirmer { my $query = "SELECT DISTINCT bugs_activity.bug_id FROM bugs_activity - LEFT JOIN bug_group_map + LEFT JOIN bug_group_map ON bugs_activity.bug_id = bug_group_map.bug_id WHERE bugs_activity.fieldid = ? AND bugs_activity.added = 'NEW' @@ -75,7 +75,7 @@ sub getBugsVerifier { my ($self, $params) = validate(@_, 'names'); my $dbh = Bugzilla->dbh; - defined($params->{names}) + defined($params->{names}) || ThrowCodeError('params_required', { function => 'BMO.getBugsVerifier', params => ['names'] }); @@ -88,7 +88,7 @@ sub getBugsVerifier { my $query = "SELECT DISTINCT bugs_activity.bug_id FROM bugs_activity - LEFT JOIN bug_group_map + LEFT JOIN bug_group_map ON bugs_activity.bug_id = bug_group_map.bug_id WHERE bugs_activity.fieldid = ? AND bugs_activity.removed = 'RESOLVED' @@ -120,7 +120,7 @@ This module contains API methods that are useful to user's of bugzilla.mozilla.o =head1 METHODS -See L<Bugzilla::WebService> for a description of how parameters are passed, +See L<Bugzilla::WebService> for a description of how parameters are passed, and what B<STABLE>, B<UNSTABLE>, and B<EXPERIMENTAL> mean. =head2 getBugsConfirmer @@ -131,7 +131,7 @@ B<UNSTABLE> =item B<Description> -This method returns public bug ids that a given user has confirmed (changed from +This method returns public bug ids that a given user has confirmed (changed from C<UNCONFIRMED> to C<NEW>). =item B<Params> @@ -140,7 +140,7 @@ You pass a field called C<names> that is a list of Bugzilla login names to find =over -=item C<names> (array) - An array of strings representing Bugzilla login names. +=item C<names> (array) - An array of strings representing Bugzilla login names. =back @@ -169,7 +169,7 @@ B<UNSTABLE> =item B<Description> This method returns public bug ids that a given user has verified (changed from -C<RESOLVED> to C<VERIFIED>). +C<RESOLVED> to C<VERIFIED>). =item B<Params> @@ -177,7 +177,7 @@ You pass a field called C<names> that is a list of Bugzilla login names to find =over -=item C<names> (array) - An array of strings representing Bugzilla login names. +=item C<names> (array) - An array of strings representing Bugzilla login names. =back diff --git a/extensions/Example/Extension.pm b/extensions/Example/Extension.pm index a8cf8189f..22c4042b5 100644 --- a/extensions/Example/Extension.pm +++ b/extensions/Example/Extension.pm @@ -90,11 +90,11 @@ sub bug_check_can_change_field { my $user = Bugzilla->user; - # Disallow a bug from being reopened if currently closed unless user + # Disallow a bug from being reopened if currently closed unless user # is in 'admin' group if ($field eq 'bug_status' && $bug->product_obj->name eq 'Example') { - if (!is_open_state($old_value) && is_open_state($new_value) - && !$user->in_group('admin')) + if (!is_open_state($old_value) && is_open_state($new_value) + && !$user->in_group('admin')) { push(@$priv_results, PRIVILEGES_REQUIRED_EMPOWERED); return; @@ -102,18 +102,18 @@ sub bug_check_can_change_field { } # Disallow a bug's keywords from being edited unless user is the - # reporter of the bug - if ($field eq 'keywords' && $bug->product_obj->name eq 'Example' - && $user->login ne $bug->reporter->login) + # reporter of the bug + if ($field eq 'keywords' && $bug->product_obj->name eq 'Example' + && $user->login ne $bug->reporter->login) { push(@$priv_results, PRIVILEGES_REQUIRED_REPORTER); return; } - # Allow updating of priority even if user cannot normally edit the bug + # Allow updating of priority even if user cannot normally edit the bug # and they are in group 'engineering' if ($field eq 'priority' && $bug->product_obj->name eq 'Example' - && $user->in_group('engineering')) + && $user->in_group('engineering')) { push(@$priv_results, PRIVILEGES_REQUIRED_NONE); return; @@ -133,7 +133,7 @@ sub bug_end_of_create { # how to use this hook. my $bug = $args->{'bug'}; my $timestamp = $args->{'timestamp'}; - + my $bug_id = $bug->id; # Uncomment this line to see a line in your webserver's error log whenever # you file a bug. @@ -142,15 +142,15 @@ sub bug_end_of_create { sub bug_end_of_create_validators { my ($self, $args) = @_; - + # This code doesn't actually *do* anything, it's just here to show you # how to use this hook. my $bug_params = $args->{'params'}; - + # Uncomment this line below to see a line in your webserver's error log # containing all validated bug field values every time you file a bug. # warn Dumper($bug_params); - + # This would remove all ccs from the bug, preventing ANY ccs from being # added on bug creation. # $bug_params->{cc} = []; @@ -161,7 +161,7 @@ sub bug_start_of_update { # This code doesn't actually *do* anything, it's just here to show you # how to use this hook. - my ($bug, $old_bug, $timestamp, $changes) = + my ($bug, $old_bug, $timestamp, $changes) = @$args{qw(bug old_bug timestamp changes)}; foreach my $field (keys %$changes) { @@ -194,12 +194,12 @@ sub bug_start_of_update { sub bug_end_of_update { my ($self, $args) = @_; - + # This code doesn't actually *do* anything, it's just here to show you # how to use this hook. - my ($bug, $old_bug, $timestamp, $changes) = + my ($bug, $old_bug, $timestamp, $changes) = @$args{qw(bug old_bug timestamp changes)}; - + foreach my $field (keys %$changes) { my $used_to_be = $changes->{$field}->[0]; my $now_it_is = $changes->{$field}->[1]; @@ -218,7 +218,7 @@ sub bug_end_of_update { $status_message = "Bug closed!"; } } - + my $bug_id = $bug->id; my $num_changes = scalar keys %$changes; my $result = "There were $num_changes changes to fields on bug $bug_id" @@ -237,13 +237,13 @@ sub bug_fields { sub bug_format_comment { my ($self, $args) = @_; - + # This replaces every occurrence of the word "foo" with the word # "bar" - + my $regexes = $args->{'regexes'}; push(@$regexes, { match => qr/\bfoo\b/, replace => 'bar' }); - + # And this links every occurrence of the word "bar" to example.com, # but it won't affect "foo"s that have already been turned into "bar" # above (because each regex is run in order, and later regexes don't modify @@ -258,8 +258,8 @@ sub bug_format_comment { # Used by bug_format_comment--see its code for an explanation. sub _replace_bar { my $args = shift; - # $match is the first parentheses match in the $bar_match regex - # in bug-format_comment.pl. We get up to 10 regex matches as + # $match is the first parentheses match in the $bar_match regex + # in bug-format_comment.pl. We get up to 10 regex matches as # arguments to this function. my $match = $args->{matches}->[0]; # Remember, you have to HTML-escape any data that you are returning! @@ -269,7 +269,7 @@ sub _replace_bar { sub buglist_columns { my ($self, $args) = @_; - + my $columns = $args->{'columns'}; $columns->{'example'} = { 'name' => 'bugs.delta_ts' , 'title' => 'Example' }; $columns->{'product_desc'} = { 'name' => 'prod_desc.description', @@ -292,7 +292,7 @@ sub buglist_column_joins { sub search_operator_field_override { my ($self, $args) = @_; - + my $operators = $args->{'operators'}; my $original = $operators->{component}->{_non_changed}; @@ -316,7 +316,7 @@ sub bugmail_recipients { my $recipients = $args->{recipients}; my $bug = $args->{bug}; - my $user = + my $user = new Bugzilla::User({ name => Bugzilla->params->{'maintainer'} }); if ($bug->id == 1) { @@ -339,16 +339,16 @@ sub bugmail_relationships { sub config_add_panels { my ($self, $args) = @_; - + my $modules = $args->{panel_modules}; $modules->{Example} = "Bugzilla::Extension::Example::Config"; } sub config_modify_panels { my ($self, $args) = @_; - + my $panels = $args->{panels}; - + # Add the "Example" auth methods. my $auth_params = $panels->{'auth'}->{params}; my ($info_class) = grep($_->{name} eq 'user_info_class', @$auth_params); @@ -360,7 +360,7 @@ sub config_modify_panels { push(@$auth_params, { name => 'param_example', type => 't', default => 0, - checker => \&check_numeric }); + checker => \&check_numeric }); } sub db_schema_abstract_schema { @@ -426,7 +426,7 @@ sub email_in_after_parse { sub enter_bug_entrydefaultvars { my ($self, $args) = @_; - + my $vars = $args->{vars}; $vars->{'example'} = 1; } @@ -458,7 +458,7 @@ sub error_catch { sub flag_end_of_update { my ($self, $args) = @_; - + # This code doesn't actually *do* anything, it's just here to show you # how to use this hook. my $flag_params = $args; @@ -470,7 +470,7 @@ sub flag_end_of_update { $granted++ if $new_flag =~ /\+$/; $denied++ if $new_flag =~ /-$/; } - my $bug_id = $object->isa('Bugzilla::Bug') ? $object->id + my $bug_id = $object->isa('Bugzilla::Bug') ? $object->id : $object->bug_id; my $result = "$granted flags were granted and $denied flags were denied" . " on bug $bug_id at $timestamp."; @@ -517,7 +517,7 @@ sub group_end_of_update { my $group_id = $group->id; my $num_changes = scalar keys %$changes; - my $result = + my $result = "There were $num_changes changes to fields on group $group_id."; # Uncomment this line to see $result in your webserver's error log whenever # you update a group. @@ -527,7 +527,7 @@ sub group_end_of_update { sub install_before_final_checks { my ($self, $args) = @_; print "Install-before_final_checks hook\n" unless $args->{silent}; - + # Add a new user setting like this: # # add_setting({ @@ -535,8 +535,8 @@ sub install_before_final_checks { # options => ['pretty', 'full', 'small'], # options # category => 'pretty' # default # }); - # To add descriptions for the setting and choices, add extra values to - # the hash defined in global/setting-descs.none.tmpl. Do this in a hook: + # To add descriptions for the setting and choices, add extra values to + # the hash defined in global/setting-descs.none.tmpl. Do this in a hook: # hook/global/setting-descs-settings.none.tmpl . } @@ -551,15 +551,15 @@ sub install_filesystem { # code as well as allow the webserver to server content from it. # my $data_path = bz_locations->{'datadir'} . "/" . __PACKAGE__->NAME; # $create_dirs->{$data_path} = Bugzilla::Install::Filesystem::DIR_CGI_WRITE; - + # Update the permissions of any files and directories that currently reside - # in the extension's directory. + # in the extension's directory. # $recurse_dirs->{$data_path} = { # files => Bugzilla::Install::Filesystem::CGI_READ, # dirs => Bugzilla::Install::Filesystem::DIR_CGI_WRITE # }; - - # Create a htaccess file that allows specific content to be served from the + + # Create a htaccess file that allows specific content to be served from the # extension's directory. # $htaccess->{"$data_path/.htaccess"} = { # perms => Bugzilla::Install::Filesystem::WS_SERVE, @@ -576,19 +576,19 @@ sub install_update_db { sub install_update_db_fielddefs { my $dbh = Bugzilla->dbh; -# $dbh->bz_add_column('fielddefs', 'example_column', +# $dbh->bz_add_column('fielddefs', 'example_column', # {TYPE => 'MEDIUMTEXT', NOTNULL => 1, DEFAULT => ''}); } sub job_map { my ($self, $args) = @_; - + my $job_map = $args->{job_map}; - + # This adds the named class (an instance of TheSchwartz::Worker) as a # handler for when a job is added with the name "some_task". $job_map->{'some_task'} = 'Bugzilla::Extension::Example::Job::SomeClass'; - + # Schedule a job like this: # my $queue = Bugzilla->job_queue(); # $queue->insert('some_task', { some_parameter => $some_variable }); @@ -596,7 +596,7 @@ sub job_map { sub mailer_before_send { my ($self, $args) = @_; - + my $email = $args->{email}; # If you add a header to an email, it's best to start it with # 'X-Bugzilla-<Extension>' so that you don't conflict with @@ -606,14 +606,14 @@ sub mailer_before_send { sub object_before_create { my ($self, $args) = @_; - + my $class = $args->{'class'}; my $object_params = $args->{'params'}; - + # Note that this is a made-up class, for this example. if ($class->isa('Bugzilla::ExampleObject')) { warn "About to create an ExampleObject!"; - warn "Got the following parameters: " + warn "Got the following parameters: " . join(', ', keys(%$object_params)); } } @@ -627,17 +627,17 @@ sub object_before_delete { if ($object->isa('Bugzilla::ExampleObject')) { my $id = $object->id; warn "An object with id $id is about to be deleted!"; - } + } } sub object_before_set { my ($self, $args) = @_; - + my ($object, $field, $value) = @$args{qw(object field value)}; - + # Note that this is a made-up class, for this example. if ($object->isa('Bugzilla::ExampleObject')) { - warn "The field $field is changing from " . $object->{$field} + warn "The field $field is changing from " . $object->{$field} . " to $value!"; } } @@ -653,7 +653,7 @@ sub object_columns { sub object_end_of_create { my ($self, $args) = @_; - + my $class = $args->{'class'}; my $object = $args->{'object'}; @@ -662,16 +662,16 @@ sub object_end_of_create { sub object_end_of_create_validators { my ($self, $args) = @_; - + my $class = $args->{'class'}; my $object_params = $args->{'params'}; - + # Note that this is a made-up class, for this example. if ($class->isa('Bugzilla::ExampleObject')) { # Always set example_field to 1, even if the validators said otherwise. $object_params->{example_field} = 1; } - + } sub object_end_of_set { @@ -687,25 +687,25 @@ sub object_end_of_set { sub object_end_of_set_all { my ($self, $args) = @_; - + my $object = $args->{'object'}; my $object_params = $args->{'params'}; - + # Note that this is a made-up class, for this example. if ($object->isa('Bugzilla::ExampleObject')) { if ($object_params->{example_field} == 1) { $object->{example_field} = 1; } } - + } sub object_end_of_update { my ($self, $args) = @_; - - my ($object, $old_object, $changes) = + + my ($object, $old_object, $changes) = @$args{qw(object old_object changes)}; - + # Note that this is a made-up class, for this example. if ($object->isa('Bugzilla::ExampleObject')) { if (defined $changes->{'name'}) { @@ -767,9 +767,9 @@ sub _check_short_desc { sub page_before_template { my ($self, $args) = @_; - + my ($vars, $page) = @$args{qw(vars page_id)}; - + # You can see this hook in action by loading page.cgi?id=example.html if ($page eq 'example.html') { $vars->{cgi_variables} = { Bugzilla->cgi->Vars }; @@ -784,14 +784,14 @@ sub path_info_whitelist { sub post_bug_after_creation { my ($self, $args) = @_; - + my $vars = $args->{vars}; $vars->{'example'} = 1; } sub product_confirm_delete { my ($self, $args) = @_; - + my $vars = $args->{vars}; $vars->{'example'} = 1; } @@ -813,7 +813,7 @@ sub product_end_of_create { my $example_group = new Bugzilla::Group({ name => 'example_group' }); if ($example_group) { - $product->set_group_controls($example_group, + $product->set_group_controls($example_group, { entry => 1, membercontrol => CONTROLMAPMANDATORY, othercontrol => CONTROLMAPMANDATORY }); @@ -830,7 +830,7 @@ sub product_end_of_create { # Bugzilla::Component->create( # { name => 'No Component', # product => $product, -# description => 'Select this component if one does not ' . +# description => 'Select this component if one does not ' . # 'exist in the current list of components', # initialowner => $default_assignee }); } @@ -846,20 +846,20 @@ sub quicksearch_map { sub sanitycheck_check { my ($self, $args) = @_; - + my $dbh = Bugzilla->dbh; my $sth; - + my $status = $args->{'status'}; - + # Check that all users are Australian $status->('example_check_au_user'); - + $sth = $dbh->prepare("SELECT userid, login_name FROM profiles WHERE login_name NOT LIKE '%.au'"); $sth->execute; - + my $seen_nonau = 0; while (my ($userid, $login, $numgroups) = $sth->fetchrow_array) { $status->('example_check_au_user_alert', @@ -867,32 +867,32 @@ sub sanitycheck_check { 'alert'); $seen_nonau = 1; } - + $status->('example_check_au_user_prompt') if $seen_nonau; } sub sanitycheck_repair { my ($self, $args) = @_; - + my $cgi = Bugzilla->cgi; my $dbh = Bugzilla->dbh; - + my $status = $args->{'status'}; - + if ($cgi->param('example_repair_au_user')) { $status->('example_repair_au_user_start'); - + #$dbh->do("UPDATE profiles # SET login_name = CONCAT(login_name, '.au') # WHERE login_name NOT LIKE '%.au'"); - + $status->('example_repair_au_user_end'); } } sub template_before_create { my ($self, $args) = @_; - + my $config = $args->{'config'}; # This will be accessible as "example_global_variable" in every # template in Bugzilla. See Bugzilla/Template.pm's create() function @@ -902,7 +902,7 @@ sub template_before_create { sub template_before_process { my ($self, $args) = @_; - + my ($vars, $file, $context) = @$args{qw(vars file context)}; if ($file eq 'bug/edit.html.tmpl') { diff --git a/extensions/Example/template/en/default/setup/strings.txt.pl b/extensions/Example/template/en/default/setup/strings.txt.pl index 8da19c0aa..7b19a9f4d 100644 --- a/extensions/Example/template/en/default/setup/strings.txt.pl +++ b/extensions/Example/template/en/default/setup/strings.txt.pl @@ -14,7 +14,7 @@ # # The Original Code is the Bugzilla Bug Tracking System. # -# Contributor(s): +# Contributor(s): # Max Kanat-Alexander <mkanat@bugzilla.org> %strings = ( diff --git a/extensions/FlagDefaultRequestee/Extension.pm b/extensions/FlagDefaultRequestee/Extension.pm index f599feac2..b534f9904 100644 --- a/extensions/FlagDefaultRequestee/Extension.pm +++ b/extensions/FlagDefaultRequestee/Extension.pm @@ -67,8 +67,8 @@ sub template_before_process { $vars->{flag_currently_requested} ||= {}; foreach my $type (@$flag_types) { my $flags = Bugzilla::Flag->match({ - type_id => $type->id, - bug_id => $bug->id, + type_id => $type->id, + bug_id => $bug->id, status => '?' }); map { $vars->{flag_currently_requested}->{$_->id} = 1 } @$flags; diff --git a/extensions/FlagDefaultRequestee/lib/Constants.pm b/extensions/FlagDefaultRequestee/lib/Constants.pm index fd7298484..2c2cdf35c 100644 --- a/extensions/FlagDefaultRequestee/lib/Constants.pm +++ b/extensions/FlagDefaultRequestee/lib/Constants.pm @@ -18,9 +18,9 @@ our @EXPORT = qw( ); use constant FLAGTYPE_TEMPLATES => ( - "attachment/edit.html.tmpl", - "attachment/createformcontents.html.tmpl", - "bug/edit.html.tmpl", + "attachment/edit.html.tmpl", + "attachment/createformcontents.html.tmpl", + "bug/edit.html.tmpl", "bug/create/create.html.tmpl" ); diff --git a/extensions/FlagTypeComment/Config.pm b/extensions/FlagTypeComment/Config.pm index 590ef4555..f9ac463b6 100644 --- a/extensions/FlagTypeComment/Config.pm +++ b/extensions/FlagTypeComment/Config.pm @@ -10,7 +10,7 @@ # # The Original Code is the FlagTypeComment Bugzilla Extension. # -# The Initial Developer of the Original Code is Alex Keybl +# The Initial Developer of the Original Code is Alex Keybl # Portions created by the Initial Developer are Copyright (C) 2011 the # Initial Developer. All Rights Reserved. # diff --git a/extensions/FlagTypeComment/Extension.pm b/extensions/FlagTypeComment/Extension.pm index 34cd4c460..3ec506176 100644 --- a/extensions/FlagTypeComment/Extension.pm +++ b/extensions/FlagTypeComment/Extension.pm @@ -10,7 +10,7 @@ # # The Original Code is the FlagTypeComment Bugzilla Extension. # -# The Initial Developer of the Original Code is Alex Keybl +# The Initial Developer of the Original Code is Alex Keybl # Portions created by the Initial Developer are Copyright (C) 2011 the # Initial Developer. All Rights Reserved. # @@ -58,7 +58,7 @@ sub db_schema_abstract_schema { comment => { TYPE => 'MEDIUMTEXT', NOTNULL => 1 - }, + }, ], INDEXES => [ flagtype_comments_idx => ['type_id'], @@ -104,7 +104,7 @@ sub _set_ftc_states { if ($id) { $db_result = $dbh->selectall_arrayref( "SELECT type_id AS flagtype, on_status AS state, comment AS text - FROM flagtype_comments + FROM flagtype_comments WHERE type_id = ?", { Slice => {} }, $id); } @@ -124,16 +124,16 @@ sub _set_ftc_states { 'product_id' => $bug->product_id, 'component_id' => $bug->component_id, 'bug_id' => $bug->id, - 'active_or_has_flags' => $bug->id, + 'active_or_has_flags' => $bug->id, }); my $types = join(',', map { $_->id } @$flag_types); my $states = "'" . join("','", FLAGTYPE_COMMENT_STATES) . "'"; $db_result = $dbh->selectall_arrayref( "SELECT type_id AS flagtype, on_status AS state, comment AS text - FROM flagtype_comments - WHERE type_id IN ($types) AND on_status IN ($states)", - { Slice => {} }); + FROM flagtype_comments + WHERE type_id IN ($types) AND on_status IN ($states)", + { Slice => {} }); } foreach my $row (@$db_result) { diff --git a/extensions/FlagTypeComment/lib/Constants.pm b/extensions/FlagTypeComment/lib/Constants.pm index dcac4976a..d6242b78b 100644 --- a/extensions/FlagTypeComment/lib/Constants.pm +++ b/extensions/FlagTypeComment/lib/Constants.pm @@ -10,7 +10,7 @@ # # The Original Code is the FlagTypeComment Bugzilla Extension. # -# The Initial Developer of the Original Code is Alex Keybl +# The Initial Developer of the Original Code is Alex Keybl # Portions created by the Initial Developer are Copyright (C) 2011 the # Initial Developer. All Rights Reserved. # diff --git a/extensions/LastResolved/Extension.pm b/extensions/LastResolved/Extension.pm index 0c3741b84..197bb15d9 100644 --- a/extensions/LastResolved/Extension.pm +++ b/extensions/LastResolved/Extension.pm @@ -43,7 +43,7 @@ sub _migrate_last_resolved { my $dbh = Bugzilla->dbh; my $field_id = get_field_id('bug_status'); my $resolved_activity = $dbh->selectall_arrayref( - "SELECT bugs_activity.bug_id, bugs_activity.bug_when, bugs_activity.who + "SELECT bugs_activity.bug_id, bugs_activity.bug_when, bugs_activity.who FROM bugs_activity WHERE bugs_activity.fieldid = ? AND bugs_activity.added = 'RESOLVED' @@ -107,8 +107,8 @@ sub buglist_columns { my ($self, $args) = @_; my $columns = $args->{columns}; $columns->{'cf_last_resolved'} = { - name => 'bugs.cf_last_resolved', - title => 'Last Resolved', + name => 'bugs.cf_last_resolved', + title => 'Last Resolved', }; } diff --git a/extensions/MyDashboard/lib/WebService.pm b/extensions/MyDashboard/lib/WebService.pm index 7e5ce05cf..5407c1d0b 100644 --- a/extensions/MyDashboard/lib/WebService.pm +++ b/extensions/MyDashboard/lib/WebService.pm @@ -176,5 +176,5 @@ This module contains API methods that are useful to user's of bugzilla.mozilla.o =head1 METHODS -See L<Bugzilla::WebService> for a description of how parameters are passed, +See L<Bugzilla::WebService> for a description of how parameters are passed, and what B<STABLE>, B<UNSTABLE>, and B<EXPERIMENTAL> mean. diff --git a/extensions/Needinfo/Extension.pm b/extensions/Needinfo/Extension.pm index c2d0c7304..8926618b7 100644 --- a/extensions/Needinfo/Extension.pm +++ b/extensions/Needinfo/Extension.pm @@ -36,7 +36,7 @@ sub install_update_db { return; } - print "Creating needinfo flag ... " . + print "Creating needinfo flag ... " . "enable the Needinfo feature by editing the flag's properties.\n"; # inclusions 0:0 maps to __ANY__ : __ANY__ in the UI, diff --git a/extensions/OldBugMove/Extension.pm b/extensions/OldBugMove/Extension.pm index 8394f99cf..1fa96c1ef 100644 --- a/extensions/OldBugMove/Extension.pm +++ b/extensions/OldBugMove/Extension.pm @@ -118,7 +118,7 @@ sub object_validators { my ($class, $validators) = @$args{qw(class validators)}; if ($class->isa('Bugzilla::Comment')) { my $extra_data_validator = $validators->{extra_data}; - $validators->{extra_data} = + $validators->{extra_data} = sub { _check_comment_extra_data($extra_data_validator, @_) }; } elsif ($class->isa('Bugzilla::Bug')) { @@ -170,7 +170,7 @@ sub _move_bug { my $dbh = Bugzilla->dbh; my $template = Bugzilla->template; - _user_is_mover(Bugzilla->user) + _user_is_mover(Bugzilla->user) or ThrowUserError("auth_failure", { action => 'move', object => 'bugs' }); diff --git a/extensions/Persona/Extension.pm b/extensions/Persona/Extension.pm index 61e222f53..f94c54446 100644 --- a/extensions/Persona/Extension.pm +++ b/extensions/Persona/Extension.pm @@ -42,8 +42,8 @@ sub config_modify_panels { my ($self, $args) = @_; my $panels = $args->{'panels'}; my $auth_panel_params = $panels->{'auth'}->{'params'}; - - my ($user_info_class) = + + my ($user_info_class) = grep { $_->{'name'} eq 'user_info_class' } @$auth_panel_params; if ($user_info_class) { diff --git a/extensions/PhabBugz/lib/Util.pm b/extensions/PhabBugz/lib/Util.pm index d86cd01a5..124de6faf 100644 --- a/extensions/PhabBugz/lib/Util.pm +++ b/extensions/PhabBugz/lib/Util.pm @@ -179,7 +179,7 @@ sub get_project_phid { }; my $result = request('project.search', $data); - return undef + return undef unless (exists $result->{result}{data} && @{ $result->{result}{data} }); return $result->{result}{data}[0]{phid}; diff --git a/extensions/ProductDashboard/lib/Queries.pm b/extensions/ProductDashboard/lib/Queries.pm index 8c9d5bd92..c5ed55b18 100644 --- a/extensions/ProductDashboard/lib/Queries.pm +++ b/extensions/ProductDashboard/lib/Queries.pm @@ -47,7 +47,7 @@ sub total_bugs { my $dbh = Bugzilla->dbh; return $dbh->selectrow_array("SELECT COUNT(bug_id) - FROM bugs + FROM bugs WHERE product_id = ?", undef, $product->id); } @@ -56,9 +56,9 @@ sub total_open_bugs { my $bug_status = shift; my $dbh = Bugzilla->dbh; - return $dbh->selectrow_array("SELECT COUNT(bug_id) - FROM bugs - WHERE bug_status IN (" . join(',', quoted_open_states()) . ") + return $dbh->selectrow_array("SELECT COUNT(bug_id) + FROM bugs + WHERE bug_status IN (" . join(',', quoted_open_states()) . ") AND product_id = ?", undef, $product->id); } @@ -66,9 +66,9 @@ sub total_closed_bugs { my $product = shift; my $dbh = Bugzilla->dbh; - return $dbh->selectrow_array("SELECT COUNT(bug_id) - FROM bugs - WHERE bug_status IN (" . join(',', quoted_closed_states()) . ") + return $dbh->selectrow_array("SELECT COUNT(bug_id) + FROM bugs + WHERE bug_status IN (" . join(',', quoted_closed_states()) . ") AND product_id = ?", undef, $product->id); } @@ -100,8 +100,8 @@ sub by_version { return $dbh->selectall_arrayref("SELECT version, COUNT(bug_id), ROUND(((COUNT(bugs.bug_id) / ( SELECT COUNT(*) FROM bugs WHERE bugs.product_id = ? $extra)) * 100)) - FROM bugs - WHERE product_id = ? + FROM bugs + WHERE product_id = ? $extra GROUP BY version ORDER BY COUNT(bug_id) DESC", @@ -118,7 +118,7 @@ sub by_milestone { return $dbh->selectall_arrayref("SELECT target_milestone, COUNT(bug_id), ROUND(((COUNT(bugs.bug_id) / ( SELECT COUNT(*) FROM bugs WHERE bugs.product_id = ? $extra)) * 100)) - FROM bugs + FROM bugs WHERE product_id = ? $extra GROUP BY target_milestone @@ -136,7 +136,7 @@ sub by_priority { return $dbh->selectall_arrayref("SELECT priority, COUNT(bug_id), ROUND(((COUNT(bugs.bug_id) / ( SELECT COUNT(*) FROM bugs WHERE bugs.product_id = ? $extra)) * 100)) - FROM bugs + FROM bugs WHERE product_id = ? $extra GROUP BY priority @@ -154,8 +154,8 @@ sub by_severity { return $dbh->selectall_arrayref("SELECT bug_severity, COUNT(bug_id), ROUND(((COUNT(bugs.bug_id) / ( SELECT COUNT(*) FROM bugs WHERE bugs.product_id = ? $extra)) * 100)) - FROM bugs - WHERE product_id = ? + FROM bugs + WHERE product_id = ? $extra GROUP BY bug_severity ORDER BY COUNT(bug_id) DESC", @@ -172,7 +172,7 @@ sub by_component { return $dbh->selectall_arrayref("SELECT components.name, COUNT(bugs.bug_id), ROUND(((COUNT(bugs.bug_id) / ( SELECT COUNT(*) FROM bugs WHERE bugs.product_id = ? $extra)) * 100)) - FROM bugs INNER JOIN components ON bugs.component_id = components.id + FROM bugs INNER JOIN components ON bugs.component_id = components.id WHERE bugs.product_id = ? $extra GROUP BY components.name @@ -184,7 +184,7 @@ sub by_value_summary { my ($product, $type, $value, $bug_status) = @_; my $dbh = Bugzilla->dbh; - my $query = "SELECT bugs.bug_id AS id, + my $query = "SELECT bugs.bug_id AS id, bugs.bug_status AS status, bugs.version AS version, components.name AS component, @@ -197,7 +197,7 @@ sub by_value_summary { if ($type eq 'component') { Bugzilla::Component->check({ product => $product, name => $value }); $query .= "AND components.name = ? " if $type eq 'component'; - } + } elsif ($type eq 'version') { Bugzilla::Version->check({ product => $product, name => $value }); $query .= "AND bugs.version = ? " if $type eq 'version'; @@ -224,7 +224,7 @@ sub by_value_summary { my $timestamp = $dbh->selectrow_array("SELECT " . $dbh->sql_date_format("LOCALTIMESTAMP(0)", "%Y-%m-%d")); - return { + return { timestamp => $timestamp, past_due => _filter_bugs($past_due_bugs), updated_recently => _filter_bugs($updated_recently_bugs), @@ -249,7 +249,7 @@ sub by_assignee { AND bugs.assigned_to = profiles.userid $extra GROUP BY profiles.login_name - ORDER BY COUNT(bugs.bug_id) DESC $limit", + ORDER BY COUNT(bugs.bug_id) DESC $limit", undef, $product->id, $product->id)}; return \@result; @@ -267,7 +267,7 @@ sub by_status { ROUND(((COUNT(bugs.bug_id) / ( SELECT COUNT(*) FROM bugs WHERE bugs.product_id = ? $extra)) * 100)) FROM bugs WHERE bugs.product_id = ? - $extra + $extra GROUP BY bugs.bug_status ORDER BY COUNT(bugs.bug_id) DESC", undef, $product->id, $product->id); @@ -277,9 +277,9 @@ sub total_bug_milestone { my ($product, $milestone) = @_; my $dbh = Bugzilla->dbh; - return $dbh->selectrow_array("SELECT COUNT(bug_id) - FROM bugs - WHERE target_milestone = ? + return $dbh->selectrow_array("SELECT COUNT(bug_id) + FROM bugs + WHERE target_milestone = ? AND product_id = ?", undef, $milestone->name, $product->id); } @@ -293,7 +293,7 @@ sub bug_milestone_by_status { $extra = "AND bugs.bug_status IN (" . join(',', quoted_closed_states()) . ")" if $bug_status eq 'closed'; return $dbh->selectrow_array("SELECT COUNT(bug_id) - FROM bugs + FROM bugs WHERE target_milestone = ? AND product_id = ? $extra", undef, @@ -335,7 +335,7 @@ sub by_duplicate { sub by_popularity { my ($product, $bug_status, $limit) = @_; my $dbh = Bugzilla->dbh; - $limit = ($limit && detaint_natural($limit)) ? $dbh->sql_limit($limit) : ""; + $limit = ($limit && detaint_natural($limit)) ? $dbh->sql_limit($limit) : ""; my $extra = ''; $extra = "AND bugs.bug_status IN (" . join(',', quoted_open_states()) . ")" if $bug_status eq 'open'; @@ -438,7 +438,7 @@ sub recently_closed { push(@values, $days); } - my $unfiltered_bugs = $dbh->selectall_arrayref("SELECT DISTINCT bugs.bug_id AS id, + my $unfiltered_bugs = $dbh->selectall_arrayref("SELECT DISTINCT bugs.bug_id AS id, bugs.bug_status AS status, bugs.version AS version, components.name AS component, diff --git a/extensions/ProductDashboard/lib/Util.pm b/extensions/ProductDashboard/lib/Util.pm index f02f033b2..651d76bf5 100644 --- a/extensions/ProductDashboard/lib/Util.pm +++ b/extensions/ProductDashboard/lib/Util.pm @@ -62,35 +62,35 @@ sub bug_link_all { sub bug_link_open { my $product = shift; - return correct_urlbase() . 'buglist.cgi?product=' . url_quote($product->name) . + return correct_urlbase() . 'buglist.cgi?product=' . url_quote($product->name) . "&bug_status=__open__"; } sub bug_link_closed { my $product = shift; - return correct_urlbase() . 'buglist.cgi?product=' . url_quote($product->name) . + return correct_urlbase() . 'buglist.cgi?product=' . url_quote($product->name) . "&bug_status=__closed__"; } sub bug_milestone_link_total { my ($product, $milestone) = @_; - return correct_urlbase() . 'buglist.cgi?product=' . url_quote($product->name) . + return correct_urlbase() . 'buglist.cgi?product=' . url_quote($product->name) . "&target_milestone=" . url_quote($milestone->name); } sub bug_milestone_link_open { my ($product, $milestone) = @_; - return correct_urlbase() . 'buglist.cgi?product=' . url_quote($product->name) . + return correct_urlbase() . 'buglist.cgi?product=' . url_quote($product->name) . "&target_milestone=" . url_quote($milestone->name) . "&bug_status=__open__"; } sub bug_milestone_link_closed { my ($product, $milestone) = @_; - return correct_urlbase() . 'buglist.cgi?product=' . url_quote($product->name) . + return correct_urlbase() . 'buglist.cgi?product=' . url_quote($product->name) . "&target_milestone=" . url_quote($milestone->name) . "&bug_status=__closed__"; } diff --git a/extensions/Profanivore/Extension.pm b/extensions/Profanivore/Extension.pm index 9584ee695..013f92fee 100644 --- a/extensions/Profanivore/Extension.pm +++ b/extensions/Profanivore/Extension.pm @@ -45,7 +45,7 @@ sub bug_format_comment { # it tries to stop an arms race starting.) if ($comment && !$comment->author->in_group('editbugs') && - $comment->author->id != Bugzilla->user->id) + $comment->author->id != Bugzilla->user->id) { push (@$regexes, { match => RE_profanity('-i'), @@ -76,7 +76,7 @@ sub mailer_before_send { $author = new Bugzilla::User({ name => $author }); if ($author && - $author->id && + $author->id && !$author->in_group('editbugs')) { # Multipart emails diff --git a/extensions/REMO/Config.pm b/extensions/REMO/Config.pm index 3317ebc05..a679d64a0 100644 --- a/extensions/REMO/Config.pm +++ b/extensions/REMO/Config.pm @@ -12,7 +12,7 @@ # # The Original Code is the REMO Bugzilla Extension. # -# The Initial Developer of the Original Code is Mozilla Foundation +# The Initial Developer of the Original Code is Mozilla Foundation # Portions created by the Initial Developer are Copyright (C) 2011 the # Initial Developer. All Rights Reserved. # diff --git a/extensions/Review/lib/WebService.pm b/extensions/Review/lib/WebService.pm index c17e4c12d..3f6816916 100644 --- a/extensions/Review/lib/WebService.pm +++ b/extensions/Review/lib/WebService.pm @@ -487,7 +487,7 @@ The id of the bugzilla user. A unique integer value. =item C<real_name> (string) -The real name of the bugzilla user. +The real name of the bugzilla user. =item C<name> (string) diff --git a/extensions/SiteMapIndex/Extension.pm b/extensions/SiteMapIndex/Extension.pm index 901b80092..1e2010adb 100644 --- a/extensions/SiteMapIndex/Extension.pm +++ b/extensions/SiteMapIndex/Extension.pm @@ -101,21 +101,21 @@ sub install_filesystem { my $recurse_dirs = $args->{'recurse_dirs'}; my $htaccess = $args->{'htaccess'}; - # Create the sitemap directory to store the index and sitemap files + # Create the sitemap directory to store the index and sitemap files my $sitemap_path = bz_locations->{'datadir'} . "/" . __PACKAGE__->NAME; $create_dirs->{$sitemap_path} = Bugzilla::Install::Filesystem::DIR_CGI_WRITE | Bugzilla::Install::Filesystem::DIR_ALSO_WS_SERVE; - $recurse_dirs->{$sitemap_path} = { + $recurse_dirs->{$sitemap_path} = { files => Bugzilla::Install::Filesystem::CGI_WRITE | Bugzilla::Install::Filesystem::DIR_ALSO_WS_SERVE, - dirs => Bugzilla::Install::Filesystem::DIR_CGI_WRITE - | Bugzilla::Install::Filesystem::DIR_ALSO_WS_SERVE + dirs => Bugzilla::Install::Filesystem::DIR_CGI_WRITE + | Bugzilla::Install::Filesystem::DIR_ALSO_WS_SERVE }; # Create a htaccess file that allows the sitemap files to be served out - $htaccess->{"$sitemap_path/.htaccess"} = { + $htaccess->{"$sitemap_path/.htaccess"} = { perms => Bugzilla::Install::Filesystem::WS_SERVE, contents => <<EOT # Allow access to sitemap files created by the SiteMapIndex extension diff --git a/extensions/SiteMapIndex/lib/Constants.pm b/extensions/SiteMapIndex/lib/Constants.pm index 12f11597e..4f404c8b1 100644 --- a/extensions/SiteMapIndex/lib/Constants.pm +++ b/extensions/SiteMapIndex/lib/Constants.pm @@ -38,11 +38,11 @@ our @EXPORT = qw( use constant SITEMAP_AGE => 12; # This is the largest number of entries that can be in a single sitemap file, -# per the sitemaps.org standard. +# per the sitemaps.org standard. use constant SITEMAP_MAX => 50_000; # We only show bugs that are at least 12 hours old, because if somebody -# files a bug that's a security bug but doesn't protect it, we want to give +# files a bug that's a security bug but doesn't protect it, we want to give # them time to fix that. use constant SITEMAP_DELAY => 12; diff --git a/extensions/SiteMapIndex/lib/Util.pm b/extensions/SiteMapIndex/lib/Util.pm index 38fe1cf80..3548e5af5 100644 --- a/extensions/SiteMapIndex/lib/Util.pm +++ b/extensions/SiteMapIndex/lib/Util.pm @@ -28,7 +28,7 @@ use warnings; use base qw(Exporter); our @EXPORT = qw( - generate_sitemap + generate_sitemap bug_is_ok_to_index ); @@ -98,7 +98,7 @@ sub generate_sitemap { 'SELECT bugs.bug_id, bugs.delta_ts FROM bugs LEFT JOIN bug_group_map ON bugs.bug_id = bug_group_map.bug_id - WHERE bug_group_map.bug_id IS NULL AND creation_ts < ? + WHERE bug_group_map.bug_id IS NULL AND creation_ts < ? ' . $dbh->sql_limit($num_bugs, '?')); my $filecount = 1; @@ -122,7 +122,7 @@ sub generate_sitemap { push(@$filelist, _generate_sitemap_file($extension_name, $filecount, $products, $bugs)); $filecount++; - $offset += $num_bugs; + $offset += $num_bugs; } # Generate index file @@ -131,7 +131,7 @@ sub generate_sitemap { sub _generate_sitemap_index { my ($extension_name, $filelist) = @_; - + my $dbh = Bugzilla->dbh; my $timestamp = $dbh->selectrow_array( "SELECT " . $dbh->sql_date_format('NOW()', '%Y-%m-%d')); @@ -181,7 +181,7 @@ END <changefreq>daily</changefreq> <priority>0.4</priority> </url> -"; +"; } foreach my $bug (@$bugs) { @@ -189,7 +189,7 @@ END <url> <loc>" . $bug_url . $bug->{bug_id} . "</loc> <lastmod>" . datetime_from($bug->{delta_ts}, 'UTC')->iso8601 . 'Z' . "</lastmod> - </url> + </url> "; } @@ -200,8 +200,8 @@ END # Write the compressed sitemap data to a file in the cgi root so that they can # be accessed by the search engines. my $filename = "sitemap$filecount.xml.gz"; - gzip \$sitemap_xml => bz_locations->{'datadir'} . "/$extension_name/$filename" - || die "gzip failed: $GzipError\n"; + gzip \$sitemap_xml => bz_locations->{'datadir'} . "/$extension_name/$filename" + || die "gzip failed: $GzipError\n"; return $filename; } diff --git a/extensions/Splinter/Extension.pm b/extensions/Splinter/Extension.pm index e0f42b8d0..eb2006f47 100644 --- a/extensions/Splinter/Extension.pm +++ b/extensions/Splinter/Extension.pm @@ -107,11 +107,11 @@ sub page_before_template { sub bug_format_comment { my ($self, $args) = @_; - + my $bug = $args->{'bug'}; my $regexes = $args->{'regexes'}; my $text = $args->{'text'}; - + # Add [review] link to the end of "Created attachment" comments # # We need to work around the way that the hook works, which is intended @@ -124,7 +124,7 @@ sub bug_format_comment { replace => get_review_link("$2", "[review]") })) && (attachment_id_is_patch($2) ? "$1 __REVIEW__$2" : $1) ~egmx; - + # And linkify "Review of attachment", this is less of a workaround since # there is no issue with overlap; note that there is an assumption that # there is only one match in the text we are linkifying, since they all @@ -150,7 +150,7 @@ sub config_add_panels { sub mailer_before_send { my ($self, $args) = @_; - + # Post-process bug mail to add review links to bug mail. # It would be nice to be able to hook in earlier in the # process when the email body is being formatted in the diff --git a/extensions/Splinter/lib/Util.pm b/extensions/Splinter/lib/Util.pm index a24881c1d..d85b0532b 100644 --- a/extensions/Splinter/lib/Util.pm +++ b/extensions/Splinter/lib/Util.pm @@ -53,14 +53,14 @@ use base qw(Exporter); sub attachment_id_is_valid { my ($attach_id, $dont_validate_access) = @_; - # Validate the specified attachment id. + # Validate the specified attachment id. detaint_natural($attach_id) || return 0; # Make sure the attachment exists in the database. my $attachment = new Bugzilla::Attachment({ id => $attach_id, cache => 1 }) || return 0; - return $attachment + return $attachment if ($dont_validate_access || attachment_is_visible($attachment)); } @@ -71,9 +71,9 @@ sub attachment_is_visible { $attachment->isa('Bugzilla::Attachment') || return 0; - return (Bugzilla->user->can_see_bug($attachment->bug->id) - && (!$attachment->isprivate - || Bugzilla->user->id == $attachment->attacher->id + return (Bugzilla->user->can_see_bug($attachment->bug->id) + && (!$attachment->isprivate + || Bugzilla->user->id == $attachment->attacher->id || Bugzilla->user->is_insider)); } @@ -107,7 +107,7 @@ sub get_review_link { my $attachment = attachment_id_is_valid($attach_id); if (attachment_id_is_patch($attach_id)) { - return "<a href='" . html_quote(get_review_url($attachment->bug, $attach_id)) . + return "<a href='" . html_quote(get_review_url($attachment->bug, $attach_id)) . "'>$link_text</a>"; } else { @@ -122,7 +122,7 @@ sub munge_create_attachment { return ("$intro_text" . " View: $view_link\015\012" . " Review: " . get_review_url($bug, $attach_id, 1) . "\015\012"); - } + } else { return ("$intro_text --> ($view_link)"); } @@ -143,7 +143,7 @@ sub add_review_links_to_email { my $new_body = 0; my $bug; - if ($email->header('Subject') =~ /^\[Bug\s+(\d+)\]/ + if ($email->header('Subject') =~ /^\[Bug\s+(\d+)\]/ && Bugzilla->user->can_see_bug($1)) { $bug = Bugzilla::Bug->new({ id => $1, cache => 1 }); diff --git a/extensions/UserProfile/lib/Util.pm b/extensions/UserProfile/lib/Util.pm index e50260af2..6b2eff098 100644 --- a/extensions/UserProfile/lib/Util.pm +++ b/extensions/UserProfile/lib/Util.pm @@ -74,7 +74,7 @@ EOF SELECT COUNT(*) FROM attachments WHERE submitter_id = ? - AND (ispatch = 1 + AND (ispatch = 1 OR mimetype IN ('text/x-github-pull-request', 'text/x-review-board-request', 'text/x-phabricator-request')) diff --git a/extensions/Voting/Extension.pm b/extensions/Voting/Extension.pm index 90d4db1d3..198b065fa 100644 --- a/extensions/Voting/Extension.pm +++ b/extensions/Voting/Extension.pm @@ -88,7 +88,7 @@ sub install_update_db { $dbh->bz_add_column('products', 'votesperuser', {TYPE => 'INT2', NOTNULL => 1, DEFAULT => 0}); - $dbh->bz_add_column('products', 'maxvotesperbug', + $dbh->bz_add_column('products', 'maxvotesperbug', {TYPE => 'INT2', NOTNULL => 1, DEFAULT => DEFAULT_VOTES_PER_BUG}); $dbh->bz_add_column('products', 'votestoconfirm', {TYPE => 'INT2', NOTNULL => 1, DEFAULT => 0}); @@ -113,7 +113,7 @@ sub _bug_user_votes { my ($self) = @_; return $self->{'user_votes'} if exists $self->{'user_votes'}; $self->{'user_votes'} = Bugzilla->dbh->selectrow_array( - "SELECT vote_count FROM votes WHERE bug_id = ? AND who = ?", + "SELECT vote_count FROM votes WHERE bug_id = ? AND who = ?", undef, $self->id, Bugzilla->user->id); return $self->{'user_votes'}; } @@ -184,8 +184,8 @@ sub object_end_of_update { my ($self, $args) = @_; my ($object, $changes) = @$args{qw(object changes)}; if ( $object->isa('Bugzilla::Product') - and ($changes->{maxvotesperbug} or $changes->{votesperuser} - or $changes->{votestoconfirm}) ) + and ($changes->{maxvotesperbug} or $changes->{votesperuser} + or $changes->{votestoconfirm}) ) { _modify_bug_votes($object, $changes); } @@ -420,11 +420,11 @@ sub _page_user { if ($canedit && $bug) { # Make sure there is an entry for this bug # in the vote table, just so that things display right. - my $has_votes = $dbh->selectrow_array('SELECT vote_count FROM votes + my $has_votes = $dbh->selectrow_array('SELECT vote_count FROM votes WHERE bug_id = ? AND who = ?', undef, ($bug->id, $who->id)); if (!$has_votes) { - $dbh->do('INSERT INTO votes (who, bug_id, vote_count) + $dbh->do('INSERT INTO votes (who, bug_id, vote_count) VALUES (?, ?, 0)', undef, ($who->id, $bug->id)); } } @@ -495,7 +495,7 @@ sub _update_votes { my $input = Bugzilla->input_params; # Build a list of bug IDs for which votes have been submitted. Votes - # are submitted in form fields in which the field names are the bug + # are submitted in form fields in which the field names are the bug # IDs and the field values are the number of votes. my @buglist = grep {/^\d+$/} keys %$input; @@ -634,9 +634,9 @@ sub _update_votes { $vars->{'title_tag'} = 'change_votes'; foreach my $bug_id (@updated_bugs) { $vars->{'id'} = $bug_id; - $vars->{'sent_bugmail'} = + $vars->{'sent_bugmail'} = Bugzilla::BugMail::Send($bug_id, { 'changer' => $user }); - + $template->process("bug/process/results.html.tmpl", $vars) || ThrowTemplateError($template->error()); # Set header_done to 1 only after the first bug. @@ -714,7 +714,7 @@ sub _modify_bug_votes { foreach my $bug_id (@$bug_ids) { # _remove_votes returns a list of messages to send # in case some voters had too many votes. - push(@msgs, _remove_votes($bug_id, $who, + push(@msgs, _remove_votes($bug_id, $who, 'votes_too_many_per_user')); my $name = user_id_to_login($who); @@ -727,7 +727,7 @@ sub _modify_bug_votes { # 3. enough votes to confirm my $bug_list = $dbh->selectcol_arrayref( - 'SELECT bug_id FROM bugs + 'SELECT bug_id FROM bugs WHERE product_id = ? AND bug_status = ? AND votes >= ?', undef, ($product->id, 'UNCONFIRMED', $product->{votestoconfirm})); diff --git a/extensions/create.pl b/extensions/create.pl index 80fc49448..8927c172c 100755 --- a/extensions/create.pl +++ b/extensions/create.pl @@ -30,12 +30,12 @@ if ($name !~ /^[A-Z]/) { ThrowUserError('extension_first_letter_caps', { name => $name }); } -my $extension_dir = "$base_dir/$name"; -mkpath($extension_dir) +my $extension_dir = "$base_dir/$name"; +mkpath($extension_dir) || die "$extension_dir already exists or cannot be created.\n"; my $lcname = lc($name); -foreach my $path (qw(lib web template/en/default/hook), +foreach my $path (qw(lib web template/en/default/hook), "template/en/default/$lcname") { mkpath("$extension_dir/$path") || die "$extension_dir/$path: $!"; |