diff --git a/Bugzilla.pm b/Bugzilla.pm --- a/Bugzilla.pm +++ b/Bugzilla.pm @@ -172,7 +172,7 @@ } sub user { - return request_cache->{user} ||= new Bugzilla::User; + return request_cache->{user} ||= Bugzilla::User->new(); } sub set_user { @@ -257,7 +257,7 @@ return $class->user if $class->user->id; - my $authorizer = new Bugzilla::Auth(); + my $authorizer = Bugzilla::Auth->new(); $type = LOGIN_REQUIRED if $class->cgi->param('GoAheadAndLogIn'); if (!defined $type || $type == LOGIN_NORMAL) { @@ -363,7 +363,7 @@ ThrowUserError('sudo_invalid_cookie'); } - my $sudo_target = new Bugzilla::User($sudo_target_id); + my $sudo_target = Bugzilla::User->new($sudo_target_id); if ( $authenticated_user->in_group('bz_sudoers') && defined $sudo_target && !$sudo_target->in_group('bz_sudo_protect')) @@ -432,7 +432,7 @@ # just a compatibility front-end to logout_user that gets a user by id sub logout_user_by_id { my ($class, $id) = @_; - my $user = new Bugzilla::User($id); + my $user = Bugzilla::User->new($id); $class->logout_user($user); } @@ -539,7 +539,7 @@ sub installation_answers { my (undef, $filename) = @_; if ($filename) { - my $s = new Safe; + my $s = Safe->new(); $s->rdo($filename); die "Error reading $filename: $!" if $!; diff --git a/Bugzilla/Attachment.pm b/Bugzilla/Attachment.pm --- a/Bugzilla/Attachment.pm +++ b/Bugzilla/Attachment.pm @@ -20,7 +20,7 @@ use Bugzilla::Attachment; # Get the attachment with the given ID. - my $attachment = new Bugzilla::Attachment($attach_id); + my $attachment = Bugzilla::Attachment->new($attach_id); # Get the attachments with the given IDs. my $attachments = Bugzilla::Attachment->new_from_list($attach_ids); @@ -186,7 +186,7 @@ sub attacher { return $_[0]->{attacher} - //= new Bugzilla::User({id => $_[0]->{submitter_id}, cache => 1}); + //= Bugzilla::User->new({id => $_[0]->{submitter_id}, cache => 1}); } =over @@ -670,7 +670,7 @@ || ThrowCodeError('invalid_attach_id_to_obsolete', $vars); # Make sure the attachment exists in the database. - my $attachment = new Bugzilla::Attachment($attachid) + my $attachment = Bugzilla::Attachment->new($attachid) || ThrowUserError('invalid_attach_id', $vars); # Check that the user can view and edit this attachment. diff --git a/Bugzilla/Attachment/PatchReader.pm b/Bugzilla/Attachment/PatchReader.pm --- a/Bugzilla/Attachment/PatchReader.pm +++ b/Bugzilla/Attachment/PatchReader.pm @@ -30,7 +30,7 @@ if ($format eq 'raw') { require Bugzilla::PatchReader::DiffPrinter::raw; - $last_reader->sends_data_to(new Bugzilla::PatchReader::DiffPrinter::raw()); + $last_reader->sends_data_to(Bugzilla::PatchReader::DiffPrinter::raw->new()); Bugzilla->log_user_request($attachment->bug_id, $attachment->id, "attachment-get") @@ -147,7 +147,7 @@ if ($format eq 'raw') { require Bugzilla::PatchReader::DiffPrinter::raw; - $last_reader->sends_data_to(new Bugzilla::PatchReader::DiffPrinter::raw()); + $last_reader->sends_data_to(Bugzilla::PatchReader::DiffPrinter::raw->new()); # Actually print out the patch. print $cgi->header(-type => 'text/plain', -expires => '+3M'); @@ -194,19 +194,19 @@ || ThrowCodeError('must_be_patch', {'attach_id' => $attachment->id}); # Reads in the patch, converting to unified diff in a temp file. - my $reader = new Bugzilla::PatchReader::Raw; + my $reader = Bugzilla::PatchReader::Raw->new(); my $last_reader = $reader; # Fixes patch root (makes canonical if possible). if (Bugzilla->params->{'cvsroot'}) { my $fix_patch_root - = new Bugzilla::PatchReader::FixPatchRoot(Bugzilla->params->{'cvsroot'}); + = Bugzilla::PatchReader::FixPatchRoot->new(Bugzilla->params->{'cvsroot'}); $last_reader->sends_data_to($fix_patch_root); $last_reader = $fix_patch_root; } # Grabs the patch file info. - my $patch_info_grabber = new Bugzilla::PatchReader::PatchInfoGrabber(); + my $patch_info_grabber = Bugzilla::PatchReader::PatchInfoGrabber->new(); $last_reader->sends_data_to($patch_info_grabber); $last_reader = $patch_info_grabber; @@ -217,7 +217,7 @@ # The HTML page will be displayed with the UTF-8 encoding. binmode $fh, ':utf8'; } - my $raw_printer = new Bugzilla::PatchReader::DiffPrinter::raw($fh); + my $raw_printer = Bugzilla::PatchReader::DiffPrinter::raw->new($fh); $last_reader->sends_data_to($raw_printer); $last_reader = $raw_printer; @@ -261,13 +261,13 @@ # Define the patch readers. # The reader that reads the patch in (whatever its format). require Bugzilla::PatchReader::Raw; - my $reader = new Bugzilla::PatchReader::Raw; + my $reader = Bugzilla::PatchReader::Raw->new(); my $last_reader = $reader; # Fix the patch root if we have a cvs root. if (Bugzilla->params->{'cvsroot'}) { require Bugzilla::PatchReader::FixPatchRoot; - $last_reader->sends_data_to(new Bugzilla::PatchReader::FixPatchRoot( + $last_reader->sends_data_to(Bugzilla::PatchReader::FixPatchRoot->new( Bugzilla->params->{'cvsroot'})); $last_reader->sends_data_to->diff_root($diff_root) if defined($diff_root); $last_reader = $last_reader->sends_data_to; @@ -283,7 +283,7 @@ # We need to set $cvsbin as global, because PatchReader::CVSClient # needs it in order to find 'cvs'. $main::cvsbin = Bugzilla->localconfig->cvsbin; - $last_reader->sends_data_to(new Bugzilla::PatchReader::AddCVSContext( + $last_reader->sends_data_to(Bugzilla::PatchReader::AddCVSContext->new( $context, Bugzilla->params->{'cvsroot_get'} )); $last_reader = $last_reader->sends_data_to; @@ -317,7 +317,7 @@ # Print everything out. print $cgi->header(-type => 'text/html'); - $last_reader->sends_data_to(new Bugzilla::PatchReader::DiffPrinter::template( + $last_reader->sends_data_to(Bugzilla::PatchReader::DiffPrinter::template->new( $template, "attachment/diff-header.$format.tmpl", "attachment/diff-file.$format.tmpl", diff --git a/Bugzilla/Auth.pm b/Bugzilla/Auth.pm --- a/Bugzilla/Auth.pm +++ b/Bugzilla/Auth.pm @@ -38,12 +38,12 @@ $params->{Login} ||= Bugzilla->params->{'user_info_class'} . ',Cookie,APIKey'; $params->{Verify} ||= Bugzilla->params->{'user_verify_class'}; - $self->{_info_getter} = new Bugzilla::Auth::Login::Stack($params->{Login}); - $self->{_verifier} = new Bugzilla::Auth::Verify::Stack($params->{Verify}); + $self->{_info_getter} = Bugzilla::Auth::Login::Stack->new($params->{Login}); + $self->{_verifier} = Bugzilla::Auth::Verify::Stack->new($params->{Verify}); # If we ever have any other login persistence methods besides cookies, # this could become more configurable. - $self->{_persister} = new Bugzilla::Auth::Persist::Cookie(); + $self->{_persister} = Bugzilla::Auth::Persist::Cookie->new(); return $self; } diff --git a/Bugzilla/Auth/Verify.pm b/Bugzilla/Auth/Verify.pm --- a/Bugzilla/Auth/Verify.pm +++ b/Bugzilla/Auth/Verify.pm @@ -139,7 +139,7 @@ } ) unless $user_id; - my $user = new Bugzilla::User({id => $user_id, cache => 1}); + my $user = Bugzilla::User->new({id => $user_id, cache => 1}); # Now that we have a valid User, we need to see if any data has to be # updated. diff --git a/Bugzilla/Auth/Verify/DB.pm b/Bugzilla/Auth/Verify/DB.pm --- a/Bugzilla/Auth/Verify/DB.pm +++ b/Bugzilla/Auth/Verify/DB.pm @@ -23,7 +23,7 @@ my $dbh = Bugzilla->dbh; my $username = $login_data->{username}; - my $user = new Bugzilla::User({name => $username}); + my $user = Bugzilla::User->new({name => $username}); return {failure => AUTH_NO_SUCH_USER} unless $user; diff --git a/Bugzilla/Auth/Verify/LDAP.pm b/Bugzilla/Auth/Verify/LDAP.pm --- a/Bugzilla/Auth/Verify/LDAP.pm +++ b/Bugzilla/Auth/Verify/LDAP.pm @@ -176,7 +176,7 @@ ThrowCodeError("ldap_server_not_defined") unless @servers; foreach (@servers) { - $self->{ldap} = new Net::LDAP(trim($_)); + $self->{ldap} = Net::LDAP->new(trim($_)); last if $self->{ldap}; } ThrowCodeError("ldap_connect_failed", {server => join(", ", @servers)}) diff --git a/Bugzilla/Auth/Verify/RADIUS.pm b/Bugzilla/Auth/Verify/RADIUS.pm --- a/Bugzilla/Auth/Verify/RADIUS.pm +++ b/Bugzilla/Auth/Verify/RADIUS.pm @@ -35,7 +35,7 @@ } # Create RADIUS object. - my $radius = new Authen::Radius( + my $radius = Authen::Radius->new( Host => Bugzilla->params->{'RADIUS_server'}, Secret => Bugzilla->params->{'RADIUS_secret'} ) diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -1553,7 +1553,7 @@ } # Make sure the alias is unique, or that it's already our alias. - my $other_bug = new Bugzilla::Bug($alias); + my $other_bug = Bugzilla::Bug->new($alias); if (!$other_bug->{error} && (!ref $invocant || $other_bug->id != $invocant->id)) { ThrowUserError("alias_in_use", {alias => $alias, bug_id => $other_bug->id}); @@ -2837,7 +2837,7 @@ } # Update the other bug. - my $dupe_of = new Bugzilla::Bug($self->dup_id); + my $dupe_of = Bugzilla::Bug->new($self->dup_id); if (delete $self->{_add_dup_cc}) { $dupe_of->add_cc($self->reporter); } @@ -3709,7 +3709,7 @@ return $self->{'assigned_to_obj'} if exists $self->{'assigned_to_obj'}; $self->{'assigned_to'} = 0 if $self->{'error'}; return $self->{'assigned_to_obj'} - = new Bugzilla::User({id => $self->{'assigned_to'}, cache => 1}); + = Bugzilla::User->new({id => $self->{'assigned_to'}, cache => 1}); } sub blocked { @@ -3786,7 +3786,7 @@ return $self->{component_obj} if defined $self->{component_obj}; return {} if $self->{error}; $self->{component_obj} - = new Bugzilla::Component({id => $self->{component_id}, cache => 1}); + = Bugzilla::Component->new({id => $self->{component_id}, cache => 1}); return $self->{component_obj}; } @@ -4005,7 +4005,7 @@ my $self = shift; return {} if $self->{error}; $self->{product_obj} - ||= new Bugzilla::Product({id => $self->{product_id}, cache => 1}); + ||= Bugzilla::Product->new({id => $self->{product_id}, cache => 1}); return $self->{product_obj}; } @@ -4016,7 +4016,7 @@ if (Bugzilla->params->{'useqacontact'} && $self->{'qa_contact'}) { $self->{'qa_contact_obj'} - = new Bugzilla::User({id => $self->{'qa_contact'}, cache => 1}); + = Bugzilla::User->new({id => $self->{'qa_contact'}, cache => 1}); } else { # XXX - This is somewhat inconsistent with the assignee/reporter @@ -4064,7 +4064,7 @@ return $self->{'reporter'} if exists $self->{'reporter'}; $self->{'reporter_id'} = 0 if $self->{'error'}; return $self->{'reporter'} - = new Bugzilla::User({id => $self->{'reporter_id'}, cache => 1}); + = Bugzilla::User->new({id => $self->{'reporter_id'}, cache => 1}); } sub see_also { @@ -4096,7 +4096,7 @@ my $self = shift; return undef if $self->{'error'}; - $self->{'status'} ||= new Bugzilla::Status({name => $self->{'bug_status'}}); + $self->{'status'} ||= Bugzilla::Status->new({name => $self->{'bug_status'}}); return $self->{'status'}; } @@ -4345,7 +4345,7 @@ target_milestone => $self->product_obj->milestones, ); - my $resolution_field = new Bugzilla::Field({name => 'resolution'}); + my $resolution_field = Bugzilla::Field->new({name => 'resolution'}); # Don't include the empty resolution in drop-downs. my @resolutions = grep($_->name, @{$resolution_field->legal_values}); diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm --- a/Bugzilla/BugMail.pm +++ b/Bugzilla/BugMail.pm @@ -54,7 +54,7 @@ $params ||= {}; my $dbh = Bugzilla->dbh; - my $bug = new Bugzilla::Bug($id); + my $bug = Bugzilla::Bug->new($id); my $start = $bug->lastdiffed; my $end = $dbh->selectrow_array('SELECT LOCALTIMESTAMP(0)'); @@ -200,7 +200,7 @@ # Make sure %user_cache has every user in it so far referenced foreach my $user_id (keys %recipients) { - $user_cache{$user_id} ||= new Bugzilla::User({id => $user_id, cache => 1}); + $user_cache{$user_id} ||= Bugzilla::User->new({id => $user_id, cache => 1}); } Bugzilla::Hook::process( @@ -257,7 +257,7 @@ foreach my $user_id (keys %recipients) { my %rels_which_want; my $user = $user_cache{$user_id} - ||= new Bugzilla::User({id => $user_id, cache => 1}); + ||= Bugzilla::User->new({id => $user_id, cache => 1}); # Deleted users must be excluded. next unless $user; @@ -554,7 +554,7 @@ } # TT trims the trailing newline, and threadingmarker may be ignored. - my $email = new Email::MIME("$msg_header\n"); + my $email = Email::MIME->new("$msg_header\n"); # For tracking/diagnostic purposes, add our hostname $email->header_set('X-Generated-By' => hostname()); @@ -604,7 +604,7 @@ foreach my $diff (@$diffs) { $user_cache->{$diff->{who}} - ||= new Bugzilla::User({id => $diff->{who}, cache => 1}); + ||= Bugzilla::User->new({id => $diff->{who}, cache => 1}); $diff->{who} = $user_cache->{$diff->{who}}; if ($diff->{attach_id}) { $diff->{isprivate} diff --git a/Bugzilla/BugUrl.pm b/Bugzilla/BugUrl.pm --- a/Bugzilla/BugUrl.pm +++ b/Bugzilla/BugUrl.pm @@ -185,7 +185,7 @@ # This works better than setting $uri->scheme('http'), because # that creates URLs like "http:domain.com" and doesn't properly # differentiate the path from the domain. - $uri = new URI("http://$value"); + $uri = URI->new("http://$value"); } elsif ($uri->scheme ne 'http' && $uri->scheme ne 'https') { ThrowUserError('bug_url_invalid', {url => $value, reason => 'http'}); diff --git a/Bugzilla/BugUrl/Bugzilla.pm b/Bugzilla/BugUrl/Bugzilla.pm --- a/Bugzilla/BugUrl/Bugzilla.pm +++ b/Bugzilla/BugUrl/Bugzilla.pm @@ -53,7 +53,7 @@ sub target_bug_id { my ($self) = @_; - return new URI($self->name)->query_param('id'); + return URI->new($self->name)->query_param('id'); } 1; diff --git a/Bugzilla/BugUrl/Bugzilla/Local.pm b/Bugzilla/BugUrl/Bugzilla/Local.pm --- a/Bugzilla/BugUrl/Bugzilla/Local.pm +++ b/Bugzilla/BugUrl/Bugzilla/Local.pm @@ -31,10 +31,10 @@ my $self = shift; if (!exists $self->{ref_bug_url}) { - my $ref_bug_id = new URI($self->name)->query_param('id'); + my $ref_bug_id = URI->new($self->name)->query_param('id'); my $ref_bug = Bugzilla::Bug->check($ref_bug_id); my $ref_value = $self->local_uri($self->bug_id); - $self->{ref_bug_url} = new Bugzilla::BugUrl::Bugzilla::Local( + $self->{ref_bug_url} = Bugzilla::BugUrl::Bugzilla::Local->new( {bug_id => $ref_bug->id, value => $ref_value}); } return $self->{ref_bug_url}; @@ -66,7 +66,7 @@ # bug id/alias to the local Bugzilla. my $value = $uri->as_string; if ($value =~ m/^\w+$/) { - $uri = new URI($class->local_uri($value)); + $uri = URI->new($class->local_uri($value)); } else { # It's not a word, then we have to check diff --git a/Bugzilla/BugUrl/Debian.pm b/Bugzilla/BugUrl/Debian.pm --- a/Bugzilla/BugUrl/Debian.pm +++ b/Bugzilla/BugUrl/Debian.pm @@ -46,7 +46,7 @@ # This is the shortest standard URL form for Debian BTS URLs, # and so we reduce all URLs to this. - return new URI("http://bugs.debian.org/" . $bug_id); + return URI->new("http://bugs.debian.org/" . $bug_id); } 1; diff --git a/Bugzilla/BugUrl/Google.pm b/Bugzilla/BugUrl/Google.pm --- a/Bugzilla/BugUrl/Google.pm +++ b/Bugzilla/BugUrl/Google.pm @@ -54,7 +54,7 @@ . "/issues/detail?id=" . $bug_id; - return new URI($value); + return URI->new($value); } 1; diff --git a/Bugzilla/BugUrl/Launchpad.pm b/Bugzilla/BugUrl/Launchpad.pm --- a/Bugzilla/BugUrl/Launchpad.pm +++ b/Bugzilla/BugUrl/Launchpad.pm @@ -44,7 +44,7 @@ ThrowUserError('bug_url_invalid', {url => $value, reason => 'id'}); } - return new URI($value); + return URI->new($value); } 1; diff --git a/Bugzilla/CGI.pm b/Bugzilla/CGI.pm --- a/Bugzilla/CGI.pm +++ b/Bugzilla/CGI.pm @@ -711,7 +711,7 @@ use Bugzilla::CGI; - my $cgi = new Bugzilla::CGI(); + my $cgi = Bugzilla::CGI->new(); =head1 DESCRIPTION diff --git a/Bugzilla/Chart.pm b/Bugzilla/Chart.pm --- a/Bugzilla/Chart.pm +++ b/Bugzilla/Chart.pm @@ -65,7 +65,7 @@ if ($param =~ /^line(\d+)$/) { foreach my $series_id ($cgi->param($param)) { detaint_natural($series_id) || ThrowCodeError("invalid_series_id"); - my $series = new Bugzilla::Series($series_id); + my $series = Bugzilla::Series->new($series_id); push(@{$self->{'lines'}[$1]}, $series) if $series; } } @@ -124,7 +124,7 @@ # Note that new lines have no label; the display template is responsible # for inventing something sensible. foreach my $series_id (@series_ids) { - my $series = new Bugzilla::Series($series_id); + my $series = Bugzilla::Series->new($series_id); if ($series) { push(@{$self->{'lines'}}, [$series]); push(@{$self->{'labels'}}, ""); diff --git a/Bugzilla/Classification.pm b/Bugzilla/Classification.pm --- a/Bugzilla/Classification.pm +++ b/Bugzilla/Classification.pm @@ -94,7 +94,7 @@ ThrowUserError('classification_name_too_long', {'name' => $name}); } - my $classification = new Bugzilla::Classification({name => $name}); + my $classification = Bugzilla::Classification->new({name => $name}); if ($classification && (!ref $invocant || $classification->id != $invocant->id)) { ThrowUserError("classification_already_exists", @@ -188,8 +188,8 @@ use Bugzilla::Classification; - my $classification = new Bugzilla::Classification(1); - my $classification = new Bugzilla::Classification({name => 'Acme'}); + my $classification = Bugzilla::Classification->new(1); + my $classification = Bugzilla::Classification->new({name => 'Acme'}); my $id = $classification->id; my $name = $classification->name; diff --git a/Bugzilla/Comment.pm b/Bugzilla/Comment.pm --- a/Bugzilla/Comment.pm +++ b/Bugzilla/Comment.pm @@ -239,7 +239,7 @@ sub bug { my $self = shift; require Bugzilla::Bug; - my $bug = $self->{bug} ||= new Bugzilla::Bug($self->bug_id); + my $bug = $self->{bug} ||= Bugzilla::Bug->new($self->bug_id); weaken($self->{bug}) unless isweak($self->{bug}); return $bug; } @@ -256,14 +256,14 @@ my ($self) = @_; return undef if not $self->is_about_attachment; $self->{attachment} - ||= new Bugzilla::Attachment({id => $self->extra_data, cache => 1}); + ||= Bugzilla::Attachment->new({id => $self->extra_data, cache => 1}); return $self->{attachment}; } sub author { my $self = shift; return $self->{'author'} - ||= new Bugzilla::User({id => $self->{'who'}, cache => 1}); + ||= Bugzilla::User->new({id => $self->{'who'}, cache => 1}); } sub body_full { diff --git a/Bugzilla/Component.pm b/Bugzilla/Component.pm --- a/Bugzilla/Component.pm +++ b/Bugzilla/Component.pm @@ -160,7 +160,7 @@ # Note: We allow admins to delete bugs even if they can't # see them, as long as they can see the product. - my $bug = new Bugzilla::Bug($bug_id); + my $bug = Bugzilla::Bug->new($bug_id); $bug->remove_from_db(); } } @@ -192,7 +192,7 @@ ThrowUserError('component_name_too_long', {'name' => $name}); } - my $component = new Bugzilla::Component({product => $product, name => $name}); + my $component = Bugzilla::Component->new({product => $product, name => $name}); if ($component && (!ref $invocant || $component->id != $invocant->id)) { ThrowUserError('component_already_exists', {name => $component->name, product => $product}); @@ -326,7 +326,7 @@ foreach my $sdata (@series) { my $series - = new Bugzilla::Series(undef, $self->product->name, $self->name, $sdata->[0], + = Bugzilla::Series->new(undef, $self->product->name, $self->name, $sdata->[0], Bugzilla->user->id, 1, $sdata->[1], 1); $series->writeToDatabase(); } @@ -409,7 +409,7 @@ sub default_assignee { my $self = shift; return $self->{'default_assignee'} - ||= new Bugzilla::User({id => $self->{'initialowner'}, cache => 1}); + ||= Bugzilla::User->new({id => $self->{'initialowner'}, cache => 1}); } sub default_qa_contact { @@ -420,7 +420,7 @@ = $self->{'initialqacontact'} ? {id => $self->{'initialqacontact'}, cache => 1} : $self->{'initialqacontact'}; - $self->{'default_qa_contact'} = new Bugzilla::User($params); + $self->{'default_qa_contact'} = Bugzilla::User->new($params); } return $self->{'default_qa_contact'}; } @@ -533,8 +533,8 @@ use Bugzilla::Component; - my $component = new Bugzilla::Component($comp_id); - my $component = new Bugzilla::Component({ product => $product, name => $name }); + my $component = Bugzilla::Component->new($comp_id); + my $component = Bugzilla::Component->new({ product => $product, name => $name }); my $bug_count = $component->bug_count(); my $bug_ids = $component->bug_ids(); diff --git a/Bugzilla/Config/Common.pm b/Bugzilla/Config/Common.pm --- a/Bugzilla/Config/Common.pm +++ b/Bugzilla/Config/Common.pm @@ -170,7 +170,7 @@ my $group_name = shift; return "" unless $group_name; try { - my $group = new Bugzilla::Group({'name' => $group_name}); + my $group = Bugzilla::Group->new({'name' => $group_name}); unless (defined $group) { return "Must be an existing group name"; } diff --git a/Bugzilla/DB/Schema.pm b/Bugzilla/DB/Schema.pm --- a/Bugzilla/DB/Schema.pm +++ b/Bugzilla/DB/Schema.pm @@ -53,7 +53,7 @@ # Obtain MySQL database schema. # Do not do this. Use Bugzilla::DB instead. use Bugzilla::DB::Schema; - my $mysql_schema = new Bugzilla::DB::Schema('Mysql'); + my $mysql_schema = Bugzilla::DB::Schema->new('Mysql'); # Recommended way to obtain database schema. use Bugzilla::DB; @@ -3237,7 +3237,7 @@ $thawed_hash = thaw($serialized); } else { - my $cpt = new Safe; + my $cpt = Safe->new(); $cpt->reval($serialized) || die "Unable to restore cached schema: " . $@; $thawed_hash = ${$cpt->varglob('VAR1')}; } diff --git a/Bugzilla/Field.pm b/Bugzilla/Field.pm --- a/Bugzilla/Field.pm +++ b/Bugzilla/Field.pm @@ -33,7 +33,7 @@ {name => 'cf_silly', description => 'Silly', custom => 1}); # Instantiate a Field object for an existing field. - my $field = new Bugzilla::Field({name => 'qacontact_accessible'}); + my $field = Bugzilla::Field->new({name => 'qacontact_accessible'}); if ($field->obsolete) { print $field->description . " is obsolete\n"; } @@ -630,7 +630,7 @@ # Assure the name is unique. Names can't be changed, so we don't have # to worry about what to do on updates. - my $field = new Bugzilla::Field({name => $name}); + my $field = Bugzilla::Field->new({name => $name}); ThrowUserError('field_already_exists', {'field' => $field}) if $field; return $name; @@ -1504,7 +1504,7 @@ # ADD and UPDATE field definitions foreach my $def (DEFAULT_FIELDS) { - my $field = new Bugzilla::Field({name => $def->{name}}); + my $field = Bugzilla::Field->new({name => $def->{name}}); if ($field) { $field->set_description($def->{desc}); $field->set_in_new_bugmail($def->{in_new_bugmail}); @@ -1606,7 +1606,7 @@ Bugzilla::Field->create({ name => $new_field_name, description => $field_description }) - unless new Bugzilla::Field({name => $new_field_name}); + unless Bugzilla::Field->new({name => $new_field_name}); } @@ -1660,7 +1660,7 @@ { return 0 if $no_warn; # We don't want an error to be thrown; return. - my $field = new Bugzilla::Field({name => $name}); + my $field = Bugzilla::Field->new({name => $name}); my $field_desc = $field ? $field->description : $name; ThrowCodeError('illegal_field', {field => $field_desc}); } diff --git a/Bugzilla/Field/Choice.pm b/Bugzilla/Field/Choice.pm --- a/Bugzilla/Field/Choice.pm +++ b/Bugzilla/Field/Choice.pm @@ -290,9 +290,9 @@ =head1 SYNOPSIS - my $field = new Bugzilla::Field({name => 'bug_status'}); + my $field = Bugzilla::Field->new({name => 'bug_status'}); - my $choice = new Bugzilla::Field::Choice->type($field)->new(1); + my $choice = Bugzilla::Field::Choice->->new()->type($field)->new(1); my $choices = Bugzilla::Field::Choice->type($field)->new_from_list([1,2,3]); my $choices = Bugzilla::Field::Choice->type($field)->get_all(); diff --git a/Bugzilla/Field/ChoiceInterface.pm b/Bugzilla/Field/ChoiceInterface.pm --- a/Bugzilla/Field/ChoiceInterface.pm +++ b/Bugzilla/Field/ChoiceInterface.pm @@ -78,7 +78,7 @@ # This is just to make life easier for subclasses. Our auto-generated # subclasses from Bugzilla::Field::Choice->type() already have this set. - $cache->{"field_$class"} ||= new Bugzilla::Field({name => $class->FIELD_NAME}); + $cache->{"field_$class"} ||= Bugzilla::Field->new({name => $class->FIELD_NAME}); return $cache->{"field_$class"}; } diff --git a/Bugzilla/Flag.pm b/Bugzilla/Flag.pm --- a/Bugzilla/Flag.pm +++ b/Bugzilla/Flag.pm @@ -183,14 +183,14 @@ my $self = shift; return $self->{'type'} - ||= new Bugzilla::FlagType($self->{'type_id'}, cache => 1); + ||= Bugzilla::FlagType->new($self->{'type_id'}, cache => 1); } sub setter { my $self = shift; return $self->{'setter'} - ||= new Bugzilla::User({id => $self->{'setter_id'}, cache => 1}); + ||= Bugzilla::User->new({id => $self->{'setter_id'}, cache => 1}); } sub requestee { @@ -198,7 +198,7 @@ if (!defined $self->{'requestee'} && $self->{'requestee_id'}) { $self->{'requestee'} - = new Bugzilla::User({id => $self->{'requestee_id'}, cache => 1}); + = Bugzilla::User->new({id => $self->{'requestee_id'}, cache => 1}); } return $self->{'requestee'}; } @@ -209,14 +209,14 @@ require Bugzilla::Attachment; return $self->{'attachment'} - ||= new Bugzilla::Attachment({id => $self->attach_id, cache => 1}); + ||= Bugzilla::Attachment->new({id => $self->attach_id, cache => 1}); } sub bug { my $self = shift; require Bugzilla::Bug; - return $self->{'bug'} ||= new Bugzilla::Bug({id => $self->bug_id, cache => 1}); + return $self->{'bug'} ||= Bugzilla::Bug->new({id => $self->bug_id, cache => 1}); } ################################ @@ -1071,7 +1071,7 @@ my %recipients; foreach my $cc (split(/[, ]+/, $cc_list)) { - my $ccuser = new Bugzilla::User({name => $cc, cache => 1}); + my $ccuser = Bugzilla::User->new({name => $cc, cache => 1}); next if (scalar(@bug_in_groups) && (!$ccuser || !$ccuser->can_see_bug($bug->bug_id))); diff --git a/Bugzilla/FlagType.pm b/Bugzilla/FlagType.pm --- a/Bugzilla/FlagType.pm +++ b/Bugzilla/FlagType.pm @@ -470,7 +470,7 @@ my @custusers; my @allusers = @{Bugzilla->user->get_userlist}; foreach my $user (@allusers) { - my $user_obj = new Bugzilla::User({name => $user->{login}, cache => 1}); + my $user_obj = Bugzilla::User->new({name => $user->{login}, cache => 1}); push(@custusers, $user) if $user_obj->can_set_flag($self); } return \@custusers; @@ -480,7 +480,7 @@ my $self = shift; if (!defined $self->{'grant_group'} && $self->{'grant_group_id'}) { - $self->{'grant_group'} = new Bugzilla::Group($self->{'grant_group_id'}); + $self->{'grant_group'} = Bugzilla::Group->new($self->{'grant_group_id'}); } return $self->{'grant_group'}; } @@ -489,7 +489,7 @@ my $self = shift; if (!defined $self->{'request_group'} && $self->{'request_group_id'}) { - $self->{'request_group'} = new Bugzilla::Group($self->{'request_group_id'}); + $self->{'request_group'} = Bugzilla::Group->new($self->{'request_group_id'}); } return $self->{'request_group'}; } diff --git a/Bugzilla/Group.pm b/Bugzilla/Group.pm --- a/Bugzilla/Group.pm +++ b/Bugzilla/Group.pm @@ -459,7 +459,7 @@ # Since we created a new group, give the "admin" group all privileges # initially. - my $admin = new Bugzilla::Group({name => 'admin'}); + my $admin = Bugzilla::Group->new({name => 'admin'}); # This function is also used to create the "admin" group itself, # so there's a chance it won't exist yet. @@ -529,7 +529,7 @@ # If we're creating a Group or changing the name... if (!ref($invocant) || lc($invocant->name) ne lc($name)) { - my $exists = new Bugzilla::Group({name => $name}); + my $exists = Bugzilla::Group->new({name => $name}); ThrowUserError("group_exists", {name => $name}) if $exists; } return $name; @@ -588,8 +588,8 @@ use Bugzilla::Group; - my $group = new Bugzilla::Group(1); - my $group = new Bugzilla::Group({name => 'AcmeGroup'}); + my $group = Bugzilla::Group->new(1); + my $group = Bugzilla::Group->new({name => 'AcmeGroup'}); my $id = $group->id; my $name = $group->name; diff --git a/Bugzilla/Install.pm b/Bugzilla/Install.pm --- a/Bugzilla/Install.pm +++ b/Bugzilla/Install.pm @@ -306,14 +306,14 @@ # If there is no editbugs group, this is the first time we're # adding groups. - my $editbugs_exists = new Bugzilla::Group({name => 'editbugs'}); + my $editbugs_exists = Bugzilla::Group->new({name => 'editbugs'}); if (!$editbugs_exists) { print get_text('install_groups_setup'), "\n"; } # Create most of the system groups foreach my $definition (SYSTEM_GROUPS) { - my $exists = new Bugzilla::Group({name => $definition->{name}}); + my $exists = Bugzilla::Group->new({name => $definition->{name}}); if (!$exists) { $definition->{isbuggroup} = 0; $definition->{silently} = !$editbugs_exists; @@ -364,7 +364,7 @@ # Get the user who will be the owner of the Component. # We pick the admin with the lowest id, which is probably the # admin checksetup.pl just created. - my $admin_group = new Bugzilla::Group({name => 'admin'}); + my $admin_group = Bugzilla::Group->new({name => 'admin'}); my ($admin_id) = $dbh->selectrow_array( 'SELECT user_id FROM user_group_map WHERE group_id = ? ORDER BY user_id ' . $dbh->sql_limit(1), undef, $admin_group->id @@ -405,7 +405,7 @@ my $dbh = Bugzilla->dbh; my $template = Bugzilla->template; - my $admin_group = new Bugzilla::Group({name => 'admin'}); + my $admin_group = Bugzilla::Group->new({name => 'admin'}); my $admin_inheritors = Bugzilla::Group->flatten_group_membership($admin_group->id); my $admin_group_ids = join(',', @$admin_inheritors); @@ -459,7 +459,7 @@ my $dbh = Bugzilla->dbh; $user - = ref($user) ? $user : new Bugzilla::User(login_to_id($user, THROW_ERROR)); + = ref($user) ? $user : Bugzilla::User->new(login_to_id($user, THROW_ERROR)); my $group_insert = $dbh->prepare( 'INSERT INTO user_group_map (user_id, group_id, isbless, grant_type) @@ -467,7 +467,7 @@ ); # Admins get explicit membership and bless capability for the admin group - my $admin_group = new Bugzilla::Group({name => 'admin'}); + my $admin_group = Bugzilla::Group->new({name => 'admin'}); # These are run in an eval so that we can ignore the error of somebody # already being granted these things. @@ -476,7 +476,7 @@ # Admins should also have editusers directly, even though they'll usually # inherit it. People could have changed their inheritance structure. - my $editusers = new Bugzilla::Group({name => 'editusers'}); + my $editusers = Bugzilla::Group->new({name => 'editusers'}); eval { $group_insert->execute($user->id, $editusers->id, 0, GRANT_DIRECT); }; # If there is no maintainer set, make this user the maintainer. diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm --- a/Bugzilla/Install/DB.pm +++ b/Bugzilla/Install/DB.pm @@ -1517,7 +1517,7 @@ # Move quips to the db. if (-e "$datadir/comments") { print "Populating quips table from $datadir/comments...\n"; - my $comments = new IO::File("$datadir/comments", 'r') + my $comments = IO::File->new("$datadir/comments", 'r') || die "$datadir/comments: $!"; $comments->untaint; while (<$comments>) { @@ -2340,7 +2340,7 @@ foreach my $field (@fields) { # Create a Series for each field in this product. - my $series = new Bugzilla::Series(undef, $product, $all_name, $field, undef, 1, + my $series = Bugzilla::Series->new(undef, $product, $all_name, $field, undef, 1, $queries{$field}, 1); $series->writeToDatabase(); $seriesids{$field} = $series->{'series_id'}; @@ -2351,7 +2351,7 @@ my @openedstatuses = ("UNCONFIRMED", "NEW", "ASSIGNED", "REOPENED"); my $query = join("&", map {"bug_status=$_"} @openedstatuses); my $series - = new Bugzilla::Series(undef, $product, $all_name, $open_name, undef, 1, + = Bugzilla::Series->new(undef, $product, $all_name, $open_name, undef, 1, $query_prod . $query, 1); $series->writeToDatabase(); $seriesids{$open_name} = $series->{'series_id'}; @@ -2364,7 +2364,7 @@ # There are many reasons that this might fail (e.g. no stats # for this product), so we don't worry if it does. - my $in = new IO::File($product_file) or next; + my $in = IO::File->new($product_file) or next; # The data files should be in a standard format, even for old # Bugzillas, because of the conversion code further up this file. @@ -3210,7 +3210,7 @@ # We have a data/nomail file, read it in and delete it my %nomail; print "Found a data/nomail file. Moving nomail entries into DB...\n"; - my $nomail_file = new IO::File("$datadir/nomail", 'r'); + my $nomail_file = IO::File->new("$datadir/nomail", 'r'); while (<$nomail_file>) { $nomail{trim($_)} = 1; } @@ -3236,7 +3236,7 @@ # and say something to the user. if (scalar(keys %nomail)) { print "\n", install_string('update_nomail_bad', {data => $datadir}), "\n"; - my $nomail_bad = new IO::File("$datadir/nomail.bad", '>>'); + my $nomail_bad = IO::File->new("$datadir/nomail.bad", '>>'); foreach my $unknown_user (keys %nomail) { print "\t$unknown_user\n"; print $nomail_bad "$unknown_user\n"; diff --git a/Bugzilla/Install/Util.pm b/Bugzilla/Install/Util.pm --- a/Bugzilla/Install/Util.pm +++ b/Bugzilla/Install/Util.pm @@ -430,7 +430,7 @@ require Safe; return undef if !-e $file; - my $safe = new Safe; + my $safe = Safe->new(); $safe->rdo($file); my %strings = %{$safe->varglob('strings')}; _cache()->{strings_from_file}->{$file} = \%strings; diff --git a/Bugzilla/Keyword.pm b/Bugzilla/Keyword.pm --- a/Bugzilla/Keyword.pm +++ b/Bugzilla/Keyword.pm @@ -115,7 +115,7 @@ # We only want to validate the non-existence of the name if # we're creating a new Keyword or actually renaming the keyword. if (!ref($self) || $self->name ne $name) { - my $keyword = new Bugzilla::Keyword({name => $name}); + my $keyword = Bugzilla::Keyword->new({name => $name}); ThrowUserError("keyword_already_exists", {name => $name}) if $keyword; } diff --git a/Bugzilla/Migrate.pm b/Bugzilla/Migrate.pm --- a/Bugzilla/Migrate.pm +++ b/Bugzilla/Migrate.pm @@ -520,7 +520,7 @@ ThrowUserError('migrate_config_created', {file => $file}); } open(my $fh, "<", $file) || die "$file: $!"; - my $safe = new Safe; + my $safe = Safe->new(); $safe->rdo($file); my @read_symbols = map($_->{name}, $self->CONFIG_VARS); my %config; @@ -562,7 +562,7 @@ sub insert_users { my ($self, $users) = @_; foreach my $user (@$users) { - next if new Bugzilla::User({name => $user->{login_name}}); + next if Bugzilla::User->new({name => $user->{login_name}}); my $generated_password; if (!defined $user->{cryptpassword}) { $generated_password = lc(generate_random_password()); @@ -581,7 +581,7 @@ foreach my $product (@$products) { my $components = delete $product->{components}; - my $created_prod = new Bugzilla::Product({name => $product->{name}}); + my $created_prod = Bugzilla::Product->new({name => $product->{name}}); if (!$created_prod) { $created_prod = Bugzilla::Product->create($product); print get_text('migrate_product_created', {created => $created_prod}), "\n"; @@ -589,7 +589,7 @@ foreach my $component (@$components) { next - if new Bugzilla::Component({ + if Bugzilla::Component->new({ product => $created_prod, name => $component->{name} }); my $created_comp @@ -605,7 +605,7 @@ sub create_custom_fields { my $self = shift; foreach my $field (keys %{$self->CUSTOM_FIELDS}) { - next if new Bugzilla::Field({name => $field}); + next if Bugzilla::Field->new({name => $field}); my %values = %{$self->CUSTOM_FIELDS->{$field}}; # We set these all here for the dry-run case. @@ -660,7 +660,7 @@ foreach my $product (keys %product_values) { my $prod_obj = Bugzilla::Product->check($product); foreach my $version (keys %{$product_values{$product}->{version}}) { - next if new Bugzilla::Version({product => $prod_obj, name => $version}); + next if Bugzilla::Version->new({product => $prod_obj, name => $version}); my $created = Bugzilla::Version->create({product => $prod_obj, value => $version}); my $field = $self->bug_fields->{version}; @@ -669,7 +669,7 @@ "\n"; } foreach my $milestone (keys %{$product_values{$product}->{target_milestone}}) { - next if new Bugzilla::Milestone({product => $prod_obj, name => $milestone}); + next if Bugzilla::Milestone->new({product => $prod_obj, name => $milestone}); my $created = Bugzilla::Milestone->create({product => $prod_obj, value => $milestone}); my $field = $self->bug_fields->{target_milestone}; @@ -755,7 +755,7 @@ ->new({name => delete $bug->{resolution}}); } if (!$allowed_statuses{lc($bug->{bug_status})}) { - $set_status = new Bugzilla::Status({name => $bug->{bug_status}}); + $set_status = Bugzilla::Status->new({name => $bug->{bug_status}}); # Set the starting status to some status that Bugzilla will # accept. We're going to overwrite it immediately afterward. diff --git a/Bugzilla/Migrate/Gnats.pm b/Bugzilla/Migrate/Gnats.pm --- a/Bugzilla/Migrate/Gnats.pm +++ b/Bugzilla/Migrate/Gnats.pm @@ -626,7 +626,7 @@ $unformatted --$boundary-- END - my $email = new Email::MIME(\$unformatted); + my $email = Email::MIME->new(\$unformatted); my @parts = $email->parts; # Remove the fake body. diff --git a/Bugzilla/Milestone.pm b/Bugzilla/Milestone.pm --- a/Bugzilla/Milestone.pm +++ b/Bugzilla/Milestone.pm @@ -175,7 +175,7 @@ ThrowUserError('milestone_name_too_long', {name => $name}); } - my $milestone = new Bugzilla::Milestone({product => $product, name => $name}); + my $milestone = Bugzilla::Milestone->new({product => $product, name => $name}); if ($milestone && (!ref $invocant || $milestone->id != $invocant->id)) { ThrowUserError('milestone_already_exists', {name => $milestone->name, product => $product->name}); @@ -259,7 +259,7 @@ use Bugzilla::Milestone; - my $milestone = new Bugzilla::Milestone({ name => $name, product => $product }); + my $milestone = Bugzilla::Milestone->new({ name => $name, product => $product }); my $name = $milestone->name; my $product_id = $milestone->product_id; diff --git a/Bugzilla/Object.pm b/Bugzilla/Object.pm --- a/Bugzilla/Object.pm +++ b/Bugzilla/Object.pm @@ -986,8 +986,8 @@ =head1 SYNOPSIS - my $object = new Bugzilla::Object(1); - my $object = new Bugzilla::Object({name => 'TestProduct'}); + my $object = Bugzilla::Object->new(1); + my $object = Bugzilla::Object->new({name => 'TestProduct'}); my $id = $object->id; my $name = $object->name; diff --git a/Bugzilla/PatchReader.pm b/Bugzilla/PatchReader.pm --- a/Bugzilla/PatchReader.pm +++ b/Bugzilla/PatchReader.pm @@ -23,8 +23,8 @@ # Create the reader that parses the patch and the object that # extracts info from the reader's datastream - my $reader = new PatchReader::Raw(); - my $patch_info_grabber = new PatchReader::PatchInfoGrabber(); + my $reader = PatchReader::Raw->new(); + my $patch_info_grabber = PatchReader::PatchInfoGrabber->new(); $reader->sends_data_to($patch_info_grabber); # Iterate over the file diff --git a/Bugzilla/PatchReader/Raw.pm b/Bugzilla/PatchReader/Raw.pm --- a/Bugzilla/PatchReader/Raw.pm +++ b/Bugzilla/PatchReader/Raw.pm @@ -3,7 +3,7 @@ # # USAGE: # use PatchReader::Raw; -# my $parser = new PatchReader::Raw(); +# my $parser = PatchReader::Raw->new(); # $parser->sends_data_to($my_target); # $parser->start_lines(); # open FILE, "mypatch.patch"; diff --git a/Bugzilla/Product.pm b/Bugzilla/Product.pm --- a/Bugzilla/Product.pm +++ b/Bugzilla/Product.pm @@ -313,7 +313,7 @@ # Note that we allow the user to delete bugs they can't see, # which is okay, because they’re deleting the whole Product. - my $bug = new Bugzilla::Bug($bug_id); + my $bug = Bugzilla::Bug->new($bug_id); $bug->remove_from_db(); } } @@ -387,7 +387,7 @@ ThrowUserError('product_name_too_long', {'name' => $name}); } - my $product = new Bugzilla::Product({name => $name}); + my $product = Bugzilla::Product->new({name => $name}); if ($product && (!ref $invocant || $product->id != $invocant->id)) { # Check for exact case sensitive match: @@ -441,7 +441,7 @@ # The default milestone must be one of the existing milestones. my $mil_obj - = new Bugzilla::Milestone({name => $milestone, product => $invocant}); + = Bugzilla::Milestone->new({name => $milestone, product => $invocant}); $mil_obj || ThrowUserError('product_must_define_defaultmilestone', {product => $invocant->name, milestone => $milestone}); @@ -480,7 +480,7 @@ my $dbh = Bugzilla->dbh; my $group_name = $self->name; - while (new Bugzilla::Group({name => $group_name})) { + while (Bugzilla::Group->new({name => $group_name})) { $group_name .= '_'; } my $group_description = get_text('bug_group_description', {product => $self}); @@ -520,7 +520,7 @@ foreach my $sdata (@series) { my $series - = new Bugzilla::Series(undef, $self->name, get_text('series_subcategory'), + = Bugzilla::Series->new(undef, $self->name, get_text('series_subcategory'), $sdata->[0], Bugzilla->user->id, 1, $sdata->[1] . "&product=" . url_quote($self->name), 1); $series->writeToDatabase(); @@ -909,7 +909,7 @@ sub classification { my $self = shift; - $self->{'classification'} ||= new Bugzilla::Classification( + $self->{'classification'} ||= Bugzilla::Classification->new( {id => $self->classification_id, cache => 1}); return $self->{'classification'}; } @@ -971,8 +971,8 @@ use Bugzilla::Product; - my $product = new Bugzilla::Product(1); - my $product = new Bugzilla::Product({ name => 'AcmeProduct' }); + my $product = Bugzilla::Product->new(1); + my $product = Bugzilla::Product->new({ name => 'AcmeProduct' }); my @components = $product->components(); my $groups_controls = $product->group_controls(); diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -1582,7 +1582,7 @@ $self->_convert_old_params(); $self->_special_parse_bug_status(); $self->_special_parse_resolution(); - my $clause = new Bugzilla::Search::Clause(); + my $clause = Bugzilla::Search::Clause->new(); $clause->add($self->_parse_basic_fields()); $clause->add($self->_special_parse_email()); $clause->add($self->_special_parse_chfield()); @@ -1595,7 +1595,7 @@ my $params = $self->_params; my $chart_fields = $self->_chart_fields; - my $clause = new Bugzilla::Search::Clause(); + my $clause = Bugzilla::Search::Clause->new(); foreach my $field_name (keys %$chart_fields) { # CGI params shouldn't have periods in them, so we only accept @@ -1690,7 +1690,7 @@ return undef unless ($date_from ne '' || $date_to ne '' || $value_to ne ''); - my $clause = new Bugzilla::Search::Clause(); + my $clause = Bugzilla::Search::Clause->new(); # It is always safe and useful to push delta_ts into the charts # if there is a "from" date specified. It doesn't conflict with @@ -1717,10 +1717,10 @@ # time ourselves so that the end date is correctly taken into account. $date_to .= ' 23:59:59' if $date_to =~ /^\d{4}-\d{1,2}-\d{1,2}$/; - my $join_clause = new Bugzilla::Search::Clause('OR'); + my $join_clause = Bugzilla::Search::Clause->new('OR'); foreach my $field (@fields) { - my $sub_clause = new Bugzilla::Search::ClauseGroup(); + my $sub_clause = Bugzilla::Search::ClauseGroup->new(); $sub_clause->add(condition($field, 'changedto', $value_to)) if $value_to ne ''; $sub_clause->add(condition($field, 'changedafter', $date_from)) if $date_from ne ''; @@ -1738,7 +1738,7 @@ return if !$self->_user->is_timetracker; my $params = $self->_params; - my $clause = new Bugzilla::Search::Clause(); + my $clause = Bugzilla::Search::Clause->new(); if (my $from = $params->{'deadlinefrom'}) { $clause->add('deadline', 'greaterthaneq', $from); } @@ -1755,7 +1755,7 @@ my @email_params = grep { $_ =~ /^email\d+$/ } keys %$params; - my $clause = new Bugzilla::Search::Clause(); + my $clause = Bugzilla::Search::Clause->new(); foreach my $param (@email_params) { $param =~ /(\d+)$/; my $id = $1; @@ -1764,7 +1764,7 @@ my $type = $params->{"emailtype$id"} || 'anyexact'; $type = "anyexact" if $type eq "exact"; - my $or_clause = new Bugzilla::Search::Clause('OR'); + my $or_clause = Bugzilla::Search::Clause->new('OR'); foreach my $field (qw(assigned_to reporter cc qa_contact bug_mentor)) { if ($params->{"email$field$id"}) { $or_clause->add($field, $type, $email); @@ -1864,19 +1864,19 @@ my @chart_ids = map { /^field(-?\d+)/; $1 } @all_field_params; @chart_ids = sort { $a <=> $b } uniq @chart_ids; - my $clause = new Bugzilla::Search::Clause(); + my $clause = Bugzilla::Search::Clause->new(); foreach my $chart_id (@chart_ids) { my @all_and = grep {/^field$chart_id-\d+/} @param_list; my @and_ids = map { /^field$chart_id-(\d+)/; $1 } @all_and; @and_ids = sort { $a <=> $b } uniq @and_ids; - my $and_clause = new Bugzilla::Search::Clause(); + my $and_clause = Bugzilla::Search::Clause->new(); foreach my $and_id (@and_ids) { my @all_or = grep {/^field$chart_id-$and_id-\d+/} @param_list; my @or_ids = map { /^field$chart_id-$and_id-(\d+)/; $1 } @all_or; @or_ids = sort { $a <=> $b } uniq @or_ids; - my $or_clause = new Bugzilla::Search::Clause('OR'); + my $or_clause = Bugzilla::Search::Clause->new('OR'); foreach my $or_id (@or_ids) { my $identifier = "$chart_id-$and_id-$or_id"; my $field = $params->{"field$identifier"}; @@ -1903,8 +1903,8 @@ my $joiner = $params->{j_top} || ''; my $current_clause = $joiner eq 'AND_G' - ? new Bugzilla::Search::ClauseGroup() - : new Bugzilla::Search::Clause($joiner); + ? Bugzilla::Search::ClauseGroup->new() + : Bugzilla::Search::Clause->new($joiner); my @clause_stack; foreach my $id ($self->_field_ids) { my $field = $params->{"f$id"}; @@ -1912,8 +1912,8 @@ my $joiner = $params->{"j$id"} || ''; my $new_clause = $joiner eq 'AND_G' - ? new Bugzilla::Search::ClauseGroup() - : new Bugzilla::Search::Clause($joiner); + ? Bugzilla::Search::ClauseGroup->new() + : Bugzilla::Search::Clause->new($joiner); $new_clause->negate($params->{"n$id"}); $current_clause->add($new_clause); push(@clause_stack, $current_clause); @@ -3856,7 +3856,7 @@ use Bugzilla::Search; - my $search = new Bugzilla::Search({'fields' => \@fields, + my $search = Bugzilla::Search->new({'fields' => \@fields, 'params' => \%search_criteria, 'sharer' => $sharer_id, 'user' => $user_obj, diff --git a/Bugzilla/Search/Saved.pm b/Bugzilla/Search/Saved.pm --- a/Bugzilla/Search/Saved.pm +++ b/Bugzilla/Search/Saved.pm @@ -123,7 +123,7 @@ sub _check_query { my ($invocant, $query) = @_; $query || ThrowUserError("buglist_parameters_required"); - my $cgi = new Bugzilla::CGI($query); + my $cgi = Bugzilla::CGI->new($query); $cgi->clean_search_url; # Don't store the query name as a parameter. @@ -226,7 +226,7 @@ sub edit_link { my ($self) = @_; return $self->{edit_link} if defined $self->{edit_link}; - my $cgi = new Bugzilla::CGI($self->url); + my $cgi = Bugzilla::CGI->new($self->url); if (!$cgi->param('query_type') || !IsValidQueryType($cgi->param('query_type'))) { $cgi->param('query_type', 'advanced'); @@ -271,7 +271,7 @@ = Bugzilla->dbh->selectrow_array( 'SELECT group_id FROM namedquery_group_map WHERE namedquery_id = ?', undef, $self->id); - $self->{shared_with_group} = $group_id ? new Bugzilla::Group($group_id) : undef; + $self->{shared_with_group} = $group_id ? Bugzilla::Group->new($group_id) : undef; return $self->{shared_with_group}; } @@ -323,7 +323,7 @@ use Bugzilla::Search::Saved; - my $query = new Bugzilla::Search::Saved($query_id); + my $query = Bugzilla::Search::Saved->new($query_id); my $edit_link = $query->edit_link; my $search_url = $query->url; diff --git a/Bugzilla/Series.pm b/Bugzilla/Series.pm --- a/Bugzilla/Series.pm +++ b/Bugzilla/Series.pm @@ -284,7 +284,7 @@ if (!$self->{creator} && $self->{creator_id}) { require Bugzilla::User; - $self->{creator} = new Bugzilla::User($self->{creator_id}); + $self->{creator} = Bugzilla::User->new($self->{creator_id}); } return $self->{creator}; } diff --git a/Bugzilla/Status.pm b/Bugzilla/Status.pm --- a/Bugzilla/Status.pm +++ b/Bugzilla/Status.pm @@ -211,7 +211,7 @@ sub add_missing_bug_status_transitions { my $bug_status = shift || Bugzilla->params->{'duplicate_or_move_bug_status'}; my $dbh = Bugzilla->dbh; - my $new_status = new Bugzilla::Status({name => $bug_status}); + my $new_status = Bugzilla::Status->new({name => $bug_status}); # Silently discard invalid bug statuses. $new_status || return; @@ -249,8 +249,8 @@ use Bugzilla::Status; - my $bug_status = new Bugzilla::Status({ name => 'IN_PROGRESS' }); - my $bug_status = new Bugzilla::Status(4); + my $bug_status = Bugzilla::Status->new({ name => 'IN_PROGRESS' }); + my $bug_status = Bugzilla::Status->new(4); my @closed_bug_statuses = closed_bug_statuses(); diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -270,7 +270,7 @@ my $dbh = Bugzilla->dbh; $user ||= Bugzilla->user; - my $attachment = new Bugzilla::Attachment({id => $attachid, cache => 1}); + my $attachment = Bugzilla::Attachment->new({id => $attachid, cache => 1}); if ($attachment) { my $title = ""; @@ -327,7 +327,7 @@ my $dbh = Bugzilla->dbh; if (defined $bug && $bug ne '') { - $bug = blessed($bug) ? $bug : new Bugzilla::Bug({id => $bug, cache => 1}); + $bug = blessed($bug) ? $bug : Bugzilla::Bug->new({id => $bug, cache => 1}); return $link_text if $bug->{error}; } diff --git a/Bugzilla/Test/MockDB.pm b/Bugzilla/Test/MockDB.pm --- a/Bugzilla/Test/MockDB.pm +++ b/Bugzilla/Test/MockDB.pm @@ -227,7 +227,7 @@ ) ); - $new_product = new Bugzilla::Product({name => $product->{product_name}}); + $new_product = Bugzilla::Product->new({name => $product->{product_name}}); $dbh->do('INSERT INTO milestones (product_id, value) VALUES (?, ?)', undef, ($new_product->id, $product->{defaultmilestone})); @@ -254,13 +254,13 @@ } foreach my $version (@{$product->{versions}}) { - if (!new Bugzilla::Version({name => $version, product => $new_product})) { + if (!Bugzilla::Version->new({name => $version, product => $new_product})) { Bugzilla::Version->create({value => $version, product => $new_product}); } } foreach my $milestone (@{$product->{milestones}}) { - if (!new Bugzilla::Milestone({name => $milestone, product => $new_product})) { + if (!Bugzilla::Milestone->new({name => $milestone, product => $new_product})) { $dbh->do('INSERT INTO milestones (product_id, value) VALUES (?,?)', undef, $new_product->id, $milestone); } diff --git a/Bugzilla/Token.pm b/Bugzilla/Token.pm --- a/Bugzilla/Token.pm +++ b/Bugzilla/Token.pm @@ -365,7 +365,7 @@ # If we are canceling the creation of a new user account, then there # is no entry in the 'profiles' table. - my $user = new Bugzilla::User($userid); + my $user = Bugzilla::User->new($userid); $vars->{'emailaddress'} = $userid ? $user->email : $eventdata; $vars->{'remoteaddress'} = remote_ip(); diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -701,7 +701,7 @@ my ($self) = @_; if (!$self->{authorizer}) { require Bugzilla::Auth; - $self->{authorizer} = new Bugzilla::Auth(); + $self->{authorizer} = Bugzilla::Auth->new(); } return $self->{authorizer}; } @@ -1602,7 +1602,7 @@ } my $product - = blessed($input) ? $input : new Bugzilla::Product({name => $input}); + = blessed($input) ? $input : Bugzilla::Product->new({name => $input}); my $can_enter = $product && grep($_->name eq $product->name, @{$self->get_enterable_products}); @@ -2091,7 +2091,7 @@ . $dbh->sql_istrcmp('login_name', '?'), undef, $str ); - push(@users, new Bugzilla::User($user_id)) if $user_id; + push(@users, Bugzilla::User->new($user_id)) if $user_id; } # then try substring search @@ -2160,11 +2160,11 @@ my $flag_type; if ($1) { require Bugzilla::FlagType; - $flag_type = new Bugzilla::FlagType($2); + $flag_type = Bugzilla::FlagType->new($2); } else { require Bugzilla::Flag; - my $flag = new Bugzilla::Flag($2); + my $flag = Bugzilla::Flag->new($2); $flag_type = $flag->type if $flag; } if ($flag_type) { @@ -2887,7 +2887,7 @@ use Bugzilla::User; - my $user = new Bugzilla::User($id); + my $user = Bugzilla::User->new($id); my @get_selectable_classifications = $user->get_selectable_classifications; diff --git a/Bugzilla/User/Setting.pm b/Bugzilla/User/Setting.pm --- a/Bugzilla/User/Setting.pm +++ b/Bugzilla/User/Setting.pm @@ -220,7 +220,7 @@ } $settings->{$name} - = new Bugzilla::User::Setting($name, $user_id, $is_enabled, $default_value, + = Bugzilla::User::Setting->new($name, $user_id, $is_enabled, $default_value, $value, $is_default, $subclass, $category); } @@ -248,7 +248,7 @@ my ($name, $default_value, $is_enabled, $subclass, $category) = @$row; $default_settings->{$name} - = new Bugzilla::User::Setting($name, $user_id, $is_enabled, $default_value, + = Bugzilla::User::Setting->new($name, $user_id, $is_enabled, $default_value, $default_value, 1, $subclass, $category); } @@ -362,12 +362,12 @@ use Bugzilla::User::Setting; my $settings; -$settings->{$setting_name} = new Bugzilla::User::Setting( +$settings->{$setting_name} = Bugzilla::User::Setting->new( $setting_name, $user_id); OR -$settings->{$setting_name} = new Bugzilla::User::Setting( +$settings->{$setting_name} = Bugzilla::User::Setting->new( $setting_name, $user_id, $is_enabled, $default_value, $value, $is_default); diff --git a/Bugzilla/Util.pm b/Bugzilla/Util.pm --- a/Bugzilla/Util.pm +++ b/Bugzilla/Util.pm @@ -637,7 +637,7 @@ delete $args{$arg} if !defined $args{$arg}; } - my $dt = new DateTime(\%args); + my $dt = DateTime->new(\%args); # Now display the date using the given timezone, # or the user's timezone if none is given. diff --git a/Bugzilla/Version.pm b/Bugzilla/Version.pm --- a/Bugzilla/Version.pm +++ b/Bugzilla/Version.pm @@ -173,7 +173,7 @@ # Remove unprintable characters $name = clean_text($name); - my $version = new Bugzilla::Version({product => $product, name => $name}); + my $version = Bugzilla::Version->new({product => $product, name => $name}); if ($version && (!ref $invocant || $version->id != $invocant->id)) { ThrowUserError('version_already_exists', {name => $version->name, product => $product->name}); @@ -256,7 +256,7 @@ use Bugzilla::Version; - my $version = new Bugzilla::Version({ name => $name, product => $product }); + my $version = Bugzilla::Version->new({ name => $name, product => $product }); my $value = $version->name; my $product_id = $version->product_id; diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm --- a/Bugzilla/WebService/Bug.pm +++ b/Bugzilla/WebService/Bug.pm @@ -670,7 +670,7 @@ $options{params} = $match_params; - my $search = new Bugzilla::Search(%options); + my $search = Bugzilla::Search->new(%options); my ($data) = $search->data; # BMO if the caller only wants the count, that's all we need to return @@ -929,7 +929,7 @@ grep($_->id eq $id, @{Bugzilla->user->get_accessible_products}) || ThrowUserError('product_access_denied', {id => $id}); - my $product = new Bugzilla::Product($id); + my $product = Bugzilla::Product->new($id); my @objects; if ($field eq 'version') { @objects = @{$product->versions}; diff --git a/Bugzilla/Whine.pm b/Bugzilla/Whine.pm --- a/Bugzilla/Whine.pm +++ b/Bugzilla/Whine.pm @@ -46,7 +46,7 @@ sub user { my ($self) = @_; return $self->{user} if defined $self->{user}; - $self->{user} = new Bugzilla::User($self->{'owner_userid'}); + $self->{user} = Bugzilla::User->new($self->{'owner_userid'}); return $self->{user}; } @@ -62,7 +62,7 @@ use Bugzilla::Whine; - my $event = new Bugzilla::Whine($event_id); + my $event = Bugzilla::Whine->new($event_id); my $subject = $event->subject; my $body = $event->body; diff --git a/Bugzilla/Whine/Query.pm b/Bugzilla/Whine/Query.pm --- a/Bugzilla/Whine/Query.pm +++ b/Bugzilla/Whine/Query.pm @@ -56,7 +56,7 @@ use Bugzilla::Whine::Query; - my $query = new Bugzilla::Whine::Query($id); + my $query = Bugzilla::Whine::Query->new($id); my $event_id = $query->eventid; my $id = $query->id; diff --git a/Bugzilla/Whine/Schedule.pm b/Bugzilla/Whine/Schedule.pm --- a/Bugzilla/Whine/Schedule.pm +++ b/Bugzilla/Whine/Schedule.pm @@ -91,7 +91,7 @@ use Bugzilla::Whine::Schedule; - my $schedule = new Bugzilla::Whine::Schedule($schedule_id); + my $schedule = Bugzilla::Whine::Schedule->new($schedule_id); my $event_id = $schedule->eventid; my $run_day = $schedule->run_day; diff --git a/attachment.cgi b/attachment.cgi --- a/attachment.cgi +++ b/attachment.cgi @@ -155,7 +155,7 @@ {attach_id => scalar $cgi->param($param)}); # Make sure the attachment exists in the database. - my $attachment = new Bugzilla::Attachment({id => $attach_id, cache => 1}) + my $attachment = Bugzilla::Attachment->new({id => $attach_id, cache => 1}) || ThrowUserError("invalid_attach_id", {attach_id => $attach_id}); return $attachment if ($dont_validate_access || check_can_access($attachment)); @@ -186,7 +186,7 @@ return 0 if Bugzilla->params->{'requirelogin'}; return 0 if $attachment->isprivate; - my $anon_user = new Bugzilla::User; + my $anon_user = Bugzilla::User->new(); return $anon_user->can_see_bug($attachment->bug_id); } @@ -273,7 +273,7 @@ } # Change current user without creating cookies. - Bugzilla->set_user(new Bugzilla::User($userid)); + Bugzilla->set_user(Bugzilla::User->new($userid)); # Tokens are single use only, delete it. delete_token($token); @@ -889,7 +889,7 @@ ThrowUserError('token_does_not_exist'); } - my $bug = new Bugzilla::Bug($attachment->bug_id); + my $bug = Bugzilla::Bug->new($attachment->bug_id); # The token is valid. Delete the content of the attachment. my $msg; diff --git a/buglist.cgi b/buglist.cgi --- a/buglist.cgi +++ b/buglist.cgi @@ -130,7 +130,7 @@ $order ||= $last_search->list_order; # set up the params for this new query - $params = new Bugzilla::CGI({bug_id => $bug_ids, order => $order}); + $params = Bugzilla::CGI->new({bug_id => $bug_ids, order => $order}); $params->param('list_id', $last_list); } @@ -256,7 +256,7 @@ my %legal_groups; foreach my $product_name (@$product_names) { - my $product = new Bugzilla::Product({name => $product_name}); + my $product = Bugzilla::Product->new({name => $product_name}); foreach my $gid (keys %{$product->group_controls}) { @@ -299,7 +299,7 @@ # earlier, for example by setting up a named query search. # This will be modified, so make a copy. -$params ||= new Bugzilla::CGI($cgi); +$params ||= Bugzilla::CGI->new($cgi); # Generate a reasonable filename for the user agent to suggest to the user # when the user saves the bug list. Uses the name of the remembered query @@ -328,7 +328,7 @@ $vars->{'searchtype'} = "saved"; $vars->{'search_id'} = $query_id; } - $params = new Bugzilla::CGI($buffer); + $params = Bugzilla::CGI->new($buffer); $order = $params->param('order') || $order; } @@ -336,7 +336,7 @@ $buffer = LookupSeries(scalar $cgi->param("series_id")); $vars->{'searchname'} = $cgi->param('namedcmd'); $vars->{'searchtype'} = "series"; - $params = new Bugzilla::CGI($buffer); + $params = Bugzilla::CGI->new($buffer); $order = $params->param('order') || $order; } elsif ($remaction eq "forget") { @@ -901,7 +901,7 @@ if (!$user->in_group('editbugs')) { foreach my $product (keys %$bugproducts) { - my $prod = new Bugzilla::Product({name => $product}); + my $prod = Bugzilla::Product->new({name => $product}); if (!$user->in_group('editbugs', $prod->id)) { $vars->{'caneditbugs'} = 0; last; @@ -932,13 +932,13 @@ my @products = keys %$bugproducts; my $one_product; if (scalar(@products) == 1) { - $one_product = new Bugzilla::Product({name => $products[0]}); + $one_product = Bugzilla::Product->new({name => $products[0]}); } # This is used in the "Zarroo Boogs" case. elsif (my @product_input = $cgi->param('product')) { if (scalar(@product_input) == 1 and $product_input[0] ne '') { - $one_product = new Bugzilla::Product({name => $product_input[0]}); + $one_product = Bugzilla::Product->new({name => $product_input[0]}); } } diff --git a/chart.cgi b/chart.cgi --- a/chart.cgi +++ b/chart.cgi @@ -108,11 +108,11 @@ # that the changes they make will be reflected in it. if ($action =~ /^subscribe|unsubscribe$/) { detaint_natural($series_id) || ThrowCodeError("invalid_series_id"); - my $series = new Bugzilla::Series($series_id); + my $series = Bugzilla::Series->new($series_id); $series->$action($user->id); } - my $chart = new Bugzilla::Chart($cgi); + my $chart = Bugzilla::Chart->new($cgi); if ($action =~ /^remove|sum$/) { $chart->$action(getSelectedLines()); @@ -142,7 +142,7 @@ my $token = $cgi->param('token'); check_hash_token($token, ['create-series']); - my $series = new Bugzilla::Series($cgi); + my $series = Bugzilla::Series->new($cgi); ThrowUserError("series_already_exists", {'series' => $series}) if $series->existsInDatabase; @@ -151,7 +151,7 @@ $vars->{'message'} = "series_created"; $vars->{'series'} = $series; - my $chart = new Bugzilla::Chart($cgi); + my $chart = Bugzilla::Chart->new($cgi); view($chart); } elsif ($action eq "edit") { @@ -164,7 +164,7 @@ check_hash_token($token, [$series->id, $series->name]); # XXX - This should be replaced by $series->set_foo() methods. - $series = new Bugzilla::Series($cgi); + $series = Bugzilla::Series->new($cgi); # We need to check if there is _another_ series in the database with # our (potentially new) name. So we call existsInDatabase() to see if @@ -219,7 +219,7 @@ my ($query) = grep { $_->name eq $saved_search } @{$user->queries}; my $url = ''; if ($query) { - my $params = new Bugzilla::CGI($query->edit_link); + my $params = Bugzilla::CGI->new($query->edit_link); # These two parameters conflict with the one below. $url = '&' . $params->canonicalize_query('format', 'query_format'); @@ -252,7 +252,7 @@ my $user = Bugzilla->user; my $series - = new Bugzilla::Series($series_id) || ThrowCodeError('invalid_series_id'); + = Bugzilla::Series->new($series_id) || ThrowCodeError('invalid_series_id'); if (!$user->in_group('admin') && $series->{creator_id} != $user->id) { ThrowUserError('illegal_series_edit'); @@ -314,7 +314,7 @@ sub plot { validateWidthAndHeight(); - $vars->{'chart'} = new Bugzilla::Chart($cgi); + $vars->{'chart'} = Bugzilla::Chart->new($cgi); my $format = $template->get_format("reports/chart", "", scalar($cgi->param('ctype'))); @@ -336,7 +336,7 @@ validateWidthAndHeight(); # We create a Chart object so we can validate the parameters - my $chart = new Bugzilla::Chart($cgi); + my $chart = Bugzilla::Chart->new($cgi); $vars->{'time'} = localtime(time()); diff --git a/colchange.cgi b/colchange.cgi --- a/colchange.cgi +++ b/colchange.cgi @@ -74,7 +74,7 @@ if (defined $cgi->param('rememberedquery')) { my $search; if (defined $cgi->param('saved_search')) { - $search = new Bugzilla::Search::Saved($cgi->param('saved_search')); + $search = Bugzilla::Search::Saved->new($cgi->param('saved_search')); } my $token = $cgi->param('token'); @@ -131,13 +131,13 @@ && defined $search && $search->user->id == Bugzilla->user->id) { - my $params = new Bugzilla::CGI($search->url); + my $params = Bugzilla::CGI->new($search->url); $params->param('columnlist', join(",", @collist)); $search->set_url($params->query_string()); $search->update(); } - my $params = new Bugzilla::CGI($cgi->param('rememberedquery')); + my $params = Bugzilla::CGI->new($cgi->param('rememberedquery')); $params->param('columnlist', join(",", @collist)); $cgi->base_redirect('buglist.cgi?' . $params->query_string()); } diff --git a/collectstats.pl b/collectstats.pl --- a/collectstats.pl +++ b/collectstats.pl @@ -512,14 +512,14 @@ # We set up the user for Search.pm's permission checking - each series # runs with the permissions of its creator. - my $user = new Bugzilla::User($serieses->{$series_id}->{'creator'}); - my $cgi = new Bugzilla::CGI($serieses->{$series_id}->{'query'}); + my $user = Bugzilla::User->new($serieses->{$series_id}->{'creator'}); + my $cgi = Bugzilla::CGI->new($serieses->{$series_id}->{'query'}); my $data; # Do not die if Search->new() detects invalid data, such as an obsolete # login name or a renamed product or component, etc. eval { - my $search = new Bugzilla::Search( + my $search = Bugzilla::Search->new( 'params' => scalar $cgi->Vars, 'fields' => ["bug_id"], 'allow_unlimited' => 1, diff --git a/config.cgi b/config.cgi --- a/config.cgi +++ b/config.cgi @@ -56,7 +56,7 @@ # We don't use check() because config.cgi outputs mostly # in XML and JS and we don't want to display an HTML error # instead of that. - my $product = new Bugzilla::Product({name => $product_name}); + my $product = Bugzilla::Product->new({name => $product_name}); if ($product && $user->can_see_product($product->name)) { push(@{$vars->{'products'}}, $product); } diff --git a/describecomponents.cgi b/describecomponents.cgi --- a/describecomponents.cgi +++ b/describecomponents.cgi @@ -46,7 +46,7 @@ my $product_name = trim($cgi->param('product') || ''); my $component_mark = trim($cgi->param('component') || ''); -my $product = new Bugzilla::Product({'name' => $product_name}); +my $product = Bugzilla::Product->new({'name' => $product_name}); unless ($product && $user->can_access_product($product->name)) { diff --git a/docs/en/rst/integrating/extensions.rst b/docs/en/rst/integrating/extensions.rst --- a/docs/en/rst/integrating/extensions.rst +++ b/docs/en/rst/integrating/extensions.rst @@ -47,7 +47,7 @@ .. code-block:: perl - my $field = new Bugzilla::Field({ name => $name }); + my $field = Bugzilla::Field->new({ name => $name }); return if $field; $field = Bugzilla::Field->create({ diff --git a/editfields.cgi b/editfields.cgi --- a/editfields.cgi +++ b/editfields.cgi @@ -80,7 +80,7 @@ if ($name !~ /^cf_/) { $name = 'cf_' . $name; } - my $field = new Bugzilla::Field({'name' => $name}); + my $field = Bugzilla::Field->new({'name' => $name}); $field || ThrowUserError('customfield_nonexistent', {'name' => $name}); $vars->{'field'} = $field; @@ -100,7 +100,7 @@ if ($name !~ /^cf_/) { $name = 'cf_' . $name; } - my $field = new Bugzilla::Field({'name' => $name}); + my $field = Bugzilla::Field->new({'name' => $name}); $field || ThrowUserError('customfield_nonexistent', {'name' => $name}); $field->set_description($cgi->param('desc')); @@ -133,7 +133,7 @@ if ($name !~ /^cf_/) { $name = 'cf_' . $name; } - my $field = new Bugzilla::Field({'name' => $name}); + my $field = Bugzilla::Field->new({'name' => $name}); $field || ThrowUserError('customfield_nonexistent', {'name' => $name}); $vars->{'field'} = $field; @@ -153,7 +153,7 @@ if ($name !~ /^cf_/) { $name = 'cf_' . $name; } - my $field = new Bugzilla::Field({'name' => $name}); + my $field = Bugzilla::Field->new({'name' => $name}); $field || ThrowUserError('customfield_nonexistent', {'name' => $name}); # Calling remove_from_db will check if field can be deleted. diff --git a/editgroups.cgi b/editgroups.cgi --- a/editgroups.cgi +++ b/editgroups.cgi @@ -157,7 +157,7 @@ # Check that an existing group ID is given my $group_id = CheckGroupID($cgi->param('group')); - my $group = new Bugzilla::Group($group_id); + my $group = Bugzilla::Group->new($group_id); check_for_restricted_groups([$group]); get_current_and_available($group, $vars); @@ -291,7 +291,7 @@ my $changes = doGroupChanges(); delete_token($token); - my $group = new Bugzilla::Group($cgi->param('group_id')); + my $group = Bugzilla::Group->new($cgi->param('group_id')); get_current_and_available($group, $vars); $vars->{'message'} = 'group_updated'; $vars->{'group'} = $group; @@ -305,7 +305,7 @@ } if ($action eq 'confirm_remove') { - my $group = new Bugzilla::Group(CheckGroupID($cgi->param('group_id'))); + my $group = Bugzilla::Group->new(CheckGroupID($cgi->param('group_id'))); check_for_restricted_groups([$group]); $vars->{'group'} = $group; $vars->{'regexp'} = CheckGroupRegexp($cgi->param('regexp')); @@ -322,7 +322,7 @@ # gid = $cgi->param('group') that match the regular expression # stored in the DB for that group or all of them period - my $group = new Bugzilla::Group(CheckGroupID($cgi->param('group_id'))); + my $group = Bugzilla::Group->new(CheckGroupID($cgi->param('group_id'))); check_for_restricted_groups([$group]); my $regexp = CheckGroupRegexp($cgi->param('regexp')); @@ -369,7 +369,7 @@ $dbh->bz_start_transaction(); # Check that the given group ID is valid and make a Group. - my $group = new Bugzilla::Group(CheckGroupID($cgi->param('group_id'))); + my $group = Bugzilla::Group->new(CheckGroupID($cgi->param('group_id'))); check_for_restricted_groups([$group]); if (defined $cgi->param('regexp')) { diff --git a/editkeywords.cgi b/editkeywords.cgi --- a/editkeywords.cgi +++ b/editkeywords.cgi @@ -97,7 +97,7 @@ # if ($action eq 'edit') { - my $keyword = new Bugzilla::Keyword($key_id) + my $keyword = Bugzilla::Keyword->new($key_id) || ThrowCodeError('invalid_keyword_id', {id => $key_id}); $vars->{'keyword'} = $keyword; @@ -116,7 +116,7 @@ if ($action eq 'update') { check_token_data($token, 'edit_keyword'); - my $keyword = new Bugzilla::Keyword($key_id) + my $keyword = Bugzilla::Keyword->new($key_id) || ThrowCodeError('invalid_keyword_id', {id => $key_id}); $keyword->set_all({ @@ -141,7 +141,7 @@ } if ($action eq 'del') { - my $keyword = new Bugzilla::Keyword($key_id) + my $keyword = Bugzilla::Keyword->new($key_id) || ThrowCodeError('invalid_keyword_id', {id => $key_id}); $vars->{'keyword'} = $keyword; @@ -155,7 +155,7 @@ if ($action eq 'delete') { check_token_data($token, 'delete_keyword'); - my $keyword = new Bugzilla::Keyword($key_id) + my $keyword = Bugzilla::Keyword->new($key_id) || ThrowCodeError('invalid_keyword_id', {id => $key_id}); $keyword->remove_from_db(); diff --git a/editmilestones.cgi b/editmilestones.cgi --- a/editmilestones.cgi +++ b/editmilestones.cgi @@ -205,7 +205,7 @@ # Reloading the product since the default milestone name # could have been changed. - $product = new Bugzilla::Product({name => $product_name}); + $product = Bugzilla::Product->new({name => $product_name}); delete_token($token); diff --git a/editproducts.cgi b/editproducts.cgi --- a/editproducts.cgi +++ b/editproducts.cgi @@ -176,7 +176,7 @@ $vars->{'product'} = $product; if (Bugzilla->params->{'useclassification'}) { $vars->{'classification'} - = new Bugzilla::Classification($product->classification_id); + = Bugzilla::Classification->new($product->classification_id); } $vars->{'token'} = issue_session_token('edit_product'); @@ -196,7 +196,7 @@ if (Bugzilla->params->{'useclassification'}) { $vars->{'classification'} - = new Bugzilla::Classification($product->classification_id); + = Bugzilla::Classification->new($product->classification_id); } $vars->{'product'} = $product; $vars->{'token'} = issue_session_token('delete_product'); @@ -261,7 +261,7 @@ if (Bugzilla->params->{'useclassification'}) { $vars->{'classification'} - = new Bugzilla::Classification($product->classification_id); + = Bugzilla::Classification->new($product->classification_id); } $vars->{'product'} = $product; $vars->{'token'} = issue_session_token('edit_product'); @@ -295,7 +295,7 @@ if (Bugzilla->params->{'useclassification'}) { $vars->{'classification'} - = new Bugzilla::Classification($product->classification_id); + = Bugzilla::Classification->new($product->classification_id); } $vars->{'product'} = $product; $vars->{'changes'} = $changes; diff --git a/editsettings.cgi b/editsettings.cgi --- a/editsettings.cgi +++ b/editsettings.cgi @@ -43,7 +43,7 @@ my $old_value = $settings->{$name}->{'default_value'}; my $enabled = defined $cgi->param("${name}-enabled") || 0; my $value = $cgi->param("${name}"); - my $setting = new Bugzilla::User::Setting($name); + my $setting = Bugzilla::User::Setting->new($name); $setting->validate_value($value); diff --git a/editusers.cgi b/editusers.cgi --- a/editusers.cgi +++ b/editusers.cgi @@ -89,7 +89,7 @@ # If a group ID is given, make sure it is a valid one. my $group; if ($grouprestrict) { - $group = new Bugzilla::Group(scalar $cgi->param('groupid')); + $group = Bugzilla::Group->new(scalar $cgi->param('groupid')); $group || ThrowUserError('invalid_group_ID'); } @@ -503,7 +503,7 @@ $otherUserID = $otherUser->id; # Cache for user accounts. - my %usercache = (0 => new Bugzilla::User()); + my %usercache = (0 => Bugzilla::User->new()); my %updatedbugs; # Lock tables during the check+removal session. @@ -649,7 +649,7 @@ $sth_updateAssignee->execute($default_assignee_id, $timestamp, $bug_id); $updatedbugs{$bug_id} = 1; $default_assignee_id ||= 0; - $usercache{$default_assignee_id} ||= new Bugzilla::User($default_assignee_id); + $usercache{$default_assignee_id} ||= Bugzilla::User->new($default_assignee_id); LogActivityEntry($bug_id, 'assigned_to', $otherUser->login, $usercache{$default_assignee_id}->login, $userid, $timestamp); @@ -672,7 +672,7 @@ $updatedbugs{$bug_id} = 1; $default_qa_contact_id ||= 0; $usercache{$default_qa_contact_id} - ||= new Bugzilla::User($default_qa_contact_id); + ||= Bugzilla::User->new($default_qa_contact_id); LogActivityEntry($bug_id, 'qa_contact', $otherUser->login, $usercache{$default_qa_contact_id}->login, $userid, $timestamp); @@ -802,7 +802,7 @@ $vars->{'user_id'} = $otherUserID; } elsif ($otherUserLogin) { - $otherUser = new Bugzilla::User({name => $otherUserLogin}); + $otherUser = Bugzilla::User->new({name => $otherUserLogin}); $vars->{'user_login'} = $otherUserLogin; } ($otherUser && $otherUser->id) || ThrowCodeError('invalid_user', $vars); @@ -835,7 +835,7 @@ # editing code rely on this to call derive_groups(). sub userDataToVars { my $otheruserid = shift; - my $otheruser = new Bugzilla::User($otheruserid); + my $otheruser = Bugzilla::User->new($otheruserid); my $query; my $user = Bugzilla->user; my $dbh = Bugzilla->dbh; diff --git a/email_in.pl b/email_in.pl --- a/email_in.pl +++ b/email_in.pl @@ -301,7 +301,7 @@ } else { my $stripper - = new Email::MIME::Attachment::Stripper($email, force_filename => 1); + = Email::MIME::Attachment::Stripper->new($email, force_filename => 1); my $message = $stripper->message; $body = get_text_alternative($message); $attachments = [$stripper->attachments]; diff --git a/enter_bug.cgi b/enter_bug.cgi --- a/enter_bug.cgi +++ b/enter_bug.cgi @@ -95,7 +95,7 @@ # Get all classifications with at least one enterable product. foreach my $product (@enterable_products) { $class->{$product->classification_id}->{'object'} - ||= new Bugzilla::Classification($product->classification_id); + ||= Bugzilla::Classification->new($product->classification_id); # Nice way to group products per classification, without querying # the DB again. @@ -136,7 +136,7 @@ # Keep only enterable products which are in the specified classification. if ($classification ne "__all") { - my $class = new Bugzilla::Classification({'name' => $classification}); + my $class = Bugzilla::Classification->new({'name' => $classification}); # If the classification doesn't exist, then there is no product in it. if ($class) { diff --git a/extensions/BzAPI/bin/rest.cgi b/extensions/BzAPI/bin/rest.cgi --- a/extensions/BzAPI/bin/rest.cgi +++ b/extensions/BzAPI/bin/rest.cgi @@ -38,6 +38,6 @@ use Bugzilla::WebService::Server::REST; Bugzilla->usage_mode(USAGE_MODE_REST); local @INC = (bz_locations()->{extensionsdir}, @INC); -my $server = new Bugzilla::WebService::Server::REST; +my $server = Bugzilla::WebService::Server::REST->new(); $server->version('1.1'); $server->handle(); diff --git a/extensions/BzAPI/lib/Resources/Bug.pm b/extensions/BzAPI/lib/Resources/Bug.pm --- a/extensions/BzAPI/lib/Resources/Bug.pm +++ b/extensions/BzAPI/lib/Resources/Bug.pm @@ -156,7 +156,7 @@ my @axis_fields = grep {$_} ($row_field, $col_field, $tbl_field); - my $search = new Bugzilla::Search( + my $search = Bugzilla::Search->new( fields => \@axis_fields, params => $params, allow_unlimited => 1, diff --git a/extensions/Ember/lib/FakeBug.pm b/extensions/Ember/lib/FakeBug.pm --- a/extensions/Ember/lib/FakeBug.pm +++ b/extensions/Ember/lib/FakeBug.pm @@ -66,7 +66,7 @@ target_milestone => $self->product_obj->milestones, ); - my $resolution_field = new Bugzilla::Field({name => 'resolution'}); + my $resolution_field = Bugzilla::Field->new({name => 'resolution'}); # Don't include the empty resolution in drop-downs. my @resolutions = grep($_->name, @{$resolution_field->legal_values}); diff --git a/extensions/Example/Extension.pm b/extensions/Example/Extension.pm --- a/extensions/Example/Extension.pm +++ b/extensions/Example/Extension.pm @@ -188,8 +188,8 @@ my $status_message; if (my $status_change = $changes->{'bug_status'}) { - my $old_status = new Bugzilla::Status({name => $status_change->[0]}); - my $new_status = new Bugzilla::Status({name => $status_change->[1]}); + my $old_status = Bugzilla::Status->new({name => $status_change->[0]}); + my $new_status = Bugzilla::Status->new({name => $status_change->[1]}); if ($new_status->is_open && !$old_status->is_open) { $status_message = "Bug re-opened!"; } @@ -225,8 +225,8 @@ my $status_message; if (my $status_change = $changes->{'bug_status'}) { - my $old_status = new Bugzilla::Status({name => $status_change->[0]}); - my $new_status = new Bugzilla::Status({name => $status_change->[1]}); + my $old_status = Bugzilla::Status->new({name => $status_change->[0]}); + my $new_status = Bugzilla::Status->new({name => $status_change->[1]}); if ($new_status->is_open && !$old_status->is_open) { $status_message = "Bug re-opened!"; } @@ -336,7 +336,7 @@ my $recipients = $args->{recipients}; my $bug = $args->{bug}; - my $user = new Bugzilla::User({name => Bugzilla->params->{'maintainer'}}); + my $user = Bugzilla::User->new({name => Bugzilla->params->{'maintainer'}}); if ($bug->id == 1) { @@ -849,7 +849,7 @@ # product hidden to only members of the group. Just remove # the restriction if you want the new product to be public. - my $example_group = new Bugzilla::Group({name => 'example_group'}); + my $example_group = Bugzilla::Group->new({name => 'example_group'}); if ($example_group) { $product->set_group_controls( @@ -868,7 +868,7 @@ # to the new product called 'No Component'. my $default_assignee - = new Bugzilla::User({name => Bugzilla->params->{maintainer}}); + = Bugzilla::User->new({name => Bugzilla->params->{maintainer}}); if ($default_assignee) { diff --git a/extensions/GuidedBugEntry/Extension.pm b/extensions/GuidedBugEntry/Extension.pm --- a/extensions/GuidedBugEntry/Extension.pm +++ b/extensions/GuidedBugEntry/Extension.pm @@ -87,7 +87,7 @@ my $class; foreach my $product (@enterable_products) { $class->{$product->classification_id}->{'object'} - ||= new Bugzilla::Classification($product->classification_id); + ||= Bugzilla::Classification->new($product->classification_id); push(@{$class->{$product->classification_id}->{'products'}}, $product); } @classifications = sort { diff --git a/extensions/MyDashboard/lib/Queries.pm b/extensions/MyDashboard/lib/Queries.pm --- a/extensions/MyDashboard/lib/Queries.pm +++ b/extensions/MyDashboard/lib/Queries.pm @@ -211,9 +211,9 @@ ## HACK to remove POST delete $ENV{REQUEST_METHOD}; - my $params = new Bugzilla::CGI($qdef->{params}); + my $params = Bugzilla::CGI->new ($qdef->{params}); - my $search = new Bugzilla::Search( + my $search = Bugzilla::Search->new( fields => [SELECT_COLUMNS], params => scalar $params->Vars, order => [QUERY_ORDER] diff --git a/extensions/Profanivore/Extension.pm b/extensions/Profanivore/Extension.pm --- a/extensions/Profanivore/Extension.pm +++ b/extensions/Profanivore/Extension.pm @@ -71,7 +71,7 @@ $author =~ s/\Q$email_suffix\E$//; } - $author = new Bugzilla::User({name => $author}); + $author = Bugzilla::User->new({name => $author}); if ($author && $author->id && !$author->in_group('editbugs')) { diff --git a/extensions/REMO/Extension.pm b/extensions/REMO/Extension.pm --- a/extensions/REMO/Extension.pm +++ b/extensions/REMO/Extension.pm @@ -163,7 +163,7 @@ # Define the variables and functions that will be passed to the UI template. $vars->{'attachment'} = $attachment; - $vars->{'bugs'} = [new Bugzilla::Bug($bug_id)]; + $vars->{'bugs'} = [Bugzilla::Bug->new($bug_id)]; $vars->{'header_done'} = 1; $vars->{'contenttypemethod'} = 'autodetect'; diff --git a/extensions/RequestNagger/Extension.pm b/extensions/RequestNagger/Extension.pm --- a/extensions/RequestNagger/Extension.pm +++ b/extensions/RequestNagger/Extension.pm @@ -207,7 +207,7 @@ # user preference if (my $value = $input->{request_nagging}) { my $settings = $user->settings; - my $setting = new Bugzilla::User::Setting('request_nagging'); + my $setting = Bugzilla::User::Setting->new('request_nagging'); if ($value eq 'default') { $settings->{request_nagging}->reset_to_default; } diff --git a/extensions/RestrictComments/Extension.pm b/extensions/RestrictComments/Extension.pm --- a/extensions/RestrictComments/Extension.pm +++ b/extensions/RestrictComments/Extension.pm @@ -92,7 +92,7 @@ sub install_update_db { my $dbh = Bugzilla->dbh; - my $field = new Bugzilla::Field({name => 'restrict_comments'}); + my $field = Bugzilla::Field->new({name => 'restrict_comments'}); if (!$field) { Bugzilla::Field->create({ name => 'restrict_comments', diff --git a/extensions/SecureMail/Extension.pm b/extensions/SecureMail/Extension.pm --- a/extensions/SecureMail/Extension.pm +++ b/extensions/SecureMail/Extension.pm @@ -197,7 +197,7 @@ # Create a new user object so we don't mess with the main one, as we # don't know where it's been... - my $user = new Bugzilla::User(Bugzilla->user->id); + my $user = Bugzilla::User->new(Bugzilla->user->id); if ($save) { $user->set('public_key', $params->{'public_key'}); @@ -302,7 +302,7 @@ my $login = $email->header('To'); my $emailsuffix = Bugzilla->params->{'emailsuffix'}; $login =~ s/$emailsuffix$//; - my $user = new Bugzilla::User({name => $login}); + my $user = Bugzilla::User->new({name => $login}); # Default to secure. (Of course, this means if this extension has a # bug, lots of people are going to get bugmail falsely claiming their @@ -314,7 +314,7 @@ # This is also a bit of a hack, but there's no header with the # bug ID in. So we take the first number in the subject. my ($bug_id) = ($email->header('Subject') =~ /\[\D+(\d+)\]/); - my $bug = new Bugzilla::Bug($bug_id); + my $bug = Bugzilla::Bug->new($bug_id); if (!_should_secure_bug($bug)) { $make_secure = SECURE_NONE; } @@ -447,7 +447,7 @@ foreach my $id (@bugids) { $id = trim($id); next if !$id; - my $bug = new Bugzilla::Bug($id); + my $bug = Bugzilla::Bug->new($id); if ($bug && _should_secure_bug($bug)) { $should_secure = 1; last; @@ -563,7 +563,7 @@ # We can't replace the Email::MIME object, so we have to swap # out its component parts. - my $enc_obj = new Email::MIME($encrypted); + my $enc_obj = Email::MIME->new($encrypted); $email->header_obj_set($enc_obj->header_obj()); $email->parts_set([]); $email->body_set($enc_obj->body()); @@ -690,7 +690,7 @@ foreach my $link (@links) { my $href = $link->attr('href'); my ($bug_id) = $href =~ /\Qshow_bug.cgi?id=\E(\d+)/; - my $bug = new Bugzilla::Bug($bug_id); + my $bug = Bugzilla::Bug->new($bug_id); if ($bug && _should_secure_bug($bug)) { $link->attr('title', '(secure bug)'); $link->attr('class', 'bz_bug_link'); diff --git a/extensions/SiteMapIndex/lib/Util.pm b/extensions/SiteMapIndex/lib/Util.pm --- a/extensions/SiteMapIndex/lib/Util.pm +++ b/extensions/SiteMapIndex/lib/Util.pm @@ -66,7 +66,7 @@ my $index_mtime = (stat($index_file))[9]; my $index_hours = sprintf("%d", (time() - $index_mtime) / 60 / 60); # in hours if ($index_hours < SITEMAP_AGE) { - my $index_fh = new IO::File($index_file, 'r'); + my $index_fh = IO::File->new($index_file, 'r'); $index_fh || die "Could not open current sitemap index: $!"; my $index_xml; { local $/; $index_xml = <$index_fh> } @@ -161,7 +161,7 @@ my $index_file = bz_locations->{'datadir'} . "/$extension_name/sitemap_index.xml"; - my $index_fh = new IO::File($index_file, 'w'); + my $index_fh = IO::File->new($index_file, 'w'); $index_fh || die "Could not open new sitemap index: $!"; print $index_fh $index_xml; $index_fh->close() || die "Could not close new sitemap index: $!"; diff --git a/extensions/Splinter/Extension.pm b/extensions/Splinter/Extension.pm --- a/extensions/Splinter/Extension.pm +++ b/extensions/Splinter/Extension.pm @@ -96,7 +96,7 @@ $vars->{'attach_is_crlf'} = $vars->{'attach_data'} =~ /\012\015/ ? 1 : 0; } - my $field_object = new Bugzilla::Field({name => 'attachments.status'}); + my $field_object = Bugzilla::Field->new({name => 'attachments.status'}); my $statuses; if ($field_object) { $statuses = [map { $_->name } @{$field_object->legal_values}]; diff --git a/extensions/Splinter/lib/Util.pm b/extensions/Splinter/lib/Util.pm --- a/extensions/Splinter/lib/Util.pm +++ b/extensions/Splinter/lib/Util.pm @@ -58,7 +58,7 @@ # Make sure the attachment exists in the database. my $attachment - = new Bugzilla::Attachment({id => $attach_id, cache => 1}) || return 0; + = Bugzilla::Attachment->new({id => $attach_id, cache => 1}) || return 0; return $attachment if ($dont_validate_access || attachment_is_visible($attachment)); diff --git a/extensions/TypeSniffer/Extension.pm b/extensions/TypeSniffer/Extension.pm --- a/extensions/TypeSniffer/Extension.pm +++ b/extensions/TypeSniffer/Extension.pm @@ -74,7 +74,7 @@ my $fh = $attributes->{'data'}; if (!ref($fh)) { my $data = $attributes->{'data'}; - $fh = new IO::Scalar \$data; + $fh = IO::Scalar->new(\$data); } else { # CGI.pm sends us an Fh that isn't actually an IO::Handle, but diff --git a/extensions/Voting/Extension.pm b/extensions/Voting/Extension.pm --- a/extensions/Voting/Extension.pm +++ b/extensions/Voting/Extension.pm @@ -85,7 +85,7 @@ # so updates to the columns for old versions of Bugzilla happen in # Bugzilla::Install::DB, and can't safely be moved to this extension. - my $field = new Bugzilla::Field({name => 'votes'}); + my $field = Bugzilla::Field->new({name => 'votes'}); if (!$field) { Bugzilla::Field->create({ name => 'votes', @@ -866,7 +866,7 @@ 'votesnew' => $newvotes, }; - my $voter = new Bugzilla::User($userid); + my $voter = Bugzilla::User->new($userid); my $template = Bugzilla->template_inner($voter->setting('lang')); my $msg; @@ -890,7 +890,7 @@ # confirm a bug has been reduced, check if the bug is now confirmed. sub _confirm_if_vote_confirmed { my ($id, $product, $timestamp) = @_; - my $bug = ref $id ? $id : new Bugzilla::Bug({id => $id, cache => 1}); + my $bug = ref $id ? $id : Bugzilla::Bug->new({id => $id, cache => 1}); $product ||= $bug->product_obj; $timestamp ||= Bugzilla->dbh->selectrow_array('SELECT LOCALTIMESTAMP(0)'); diff --git a/importxml.pl b/importxml.pl --- a/importxml.pl +++ b/importxml.pl @@ -164,7 +164,7 @@ my $type = ($attachid) ? "attachment" : "bug"; my $err = ''; - my $setter = new Bugzilla::User({name => $setter_login}); + my $setter = Bugzilla::User->new({name => $setter_login}); my $requestee; my $requestee_id; @@ -180,7 +180,7 @@ } my $setter_id = $setter->id; if (defined($requestee_login)) { - $requestee = new Bugzilla::User({name => $requestee_login}); + $requestee = Bugzilla::User->new({name => $requestee_login}); if ($requestee) { if (!$requestee->can_see_bug($bugid)) { $err .= "Requestee is not a member of bug group\n"; @@ -208,7 +208,7 @@ }); } else { - my $bug = new Bugzilla::Bug($bugid); + my $bug = Bugzilla::Bug->new($bugid); $flag_types = $bug->flag_types; } unless ($flag_types) { @@ -416,7 +416,7 @@ my $root = $twig->root; my $maintainer = $root->{'att'}->{'maintainer'}; my $exporter_login = $root->{'att'}->{'exporter'}; - my $exporter = new Bugzilla::User({name => $exporter_login}); + my $exporter = Bugzilla::User->new({name => $exporter_login}); my $urlbase = $root->{'att'}->{'urlbase'}; # We will store output information in this variable. @@ -607,11 +607,11 @@ push(@query, "reporter_accessible"); push(@values, $bug_fields{'reporter_accessible'} ? 1 : 0); - my $product = new Bugzilla::Product({name => $bug_fields{'product'} || ''}); + my $product = Bugzilla::Product->new({name => $bug_fields{'product'} || ''}); if (!$product) { $err .= "Unknown Product " . $bug_fields{'product'} . "\n"; $err .= " Using default product set at the command line.\n"; - $product = new Bugzilla::Product({name => $default_product_name}) + $product = Bugzilla::Product->new({name => $default_product_name}) or Error( "an invalid default product was defined for the target" . " DB. " . $params->{"maintainer"} @@ -621,7 +621,7 @@ ); } my $component - = new Bugzilla::Component({ + = Bugzilla::Component->new({ product => $product, name => $bug_fields{'component'} || '' }); if (!$component) { @@ -629,8 +629,8 @@ $err .= " Using default product and component set "; $err .= "at the command line.\n"; - $product = new Bugzilla::Product({name => $default_product_name}); - $component = new Bugzilla::Component( + $product = Bugzilla::Product->new({name => $default_product_name}); + $component = Bugzilla::Component->new( {name => $default_component_name, product => $product}); if (!$component) { Error( @@ -654,7 +654,7 @@ # Since there is no default version for a product, we check that the one # coming over is valid. If not we will use the first one in @versions # and warn them. - my $version = new Bugzilla::Version( + my $version = Bugzilla::Version->new( {product => $product, name => $bug_fields{'version'}}); push(@query, "version"); @@ -678,7 +678,7 @@ && $bug_fields{'target_milestone'} ne "") { - $milestone = new Bugzilla::Milestone( + $milestone = Bugzilla::Milestone->new( {product => $product, name => $bug_fields{'target_milestone'}}); } if ($milestone) { @@ -1145,7 +1145,7 @@ ); foreach my $keyword (split(/[\s,]+/, $bug_fields{'keywords'})) { next unless $keyword; - my $keyword_obj = new Bugzilla::Keyword({name => $keyword}); + my $keyword_obj = Bugzilla::Keyword->new({name => $keyword}); if (!$keyword_obj) { $err .= "Skipping unknown keyword: $keyword.\n"; next; diff --git a/jsonrpc.cgi b/jsonrpc.cgi --- a/jsonrpc.cgi +++ b/jsonrpc.cgi @@ -27,5 +27,5 @@ Bugzilla->usage_mode(USAGE_MODE_JSON); local @INC = (bz_locations()->{extensionsdir}, @INC); -my $server = new Bugzilla::WebService::Server::JSONRPC; +my $server = Bugzilla::WebService::Server::JSONRPC->new(); $server->dispatch(WS_DISPATCH)->handle(); diff --git a/process_bug.cgi b/process_bug.cgi --- a/process_bug.cgi +++ b/process_bug.cgi @@ -209,7 +209,7 @@ # We create an object here so that $bug->send_changes can use it # when displaying the header. - $vars->{'bug'} = new Bugzilla::Bug($next_bug_id); + $vars->{'bug'} = Bugzilla::Bug->new($next_bug_id); } } } diff --git a/qa/config/generate_test_data.pl b/qa/config/generate_test_data.pl --- a/qa/config/generate_test_data.pl +++ b/qa/config/generate_test_data.pl @@ -124,7 +124,7 @@ # Create Users ########################################################################## # First of all, remove the default .* regexp for the editbugs group. -my $group = new Bugzilla::Group({name => 'editbugs'}); +my $group = Bugzilla::Group->new({name => 'editbugs'}); $group->set_user_regexp(''); $group->update(); @@ -312,7 +312,7 @@ foreach my $status (@statuses) { my $old_id; if ($status->{value}) { - my $from_status = new Bugzilla::Status({name => $status->{value}}); + my $from_status = Bugzilla::Status->new({name => $status->{value}}); $old_id = $from_status->{id}; } else { @@ -320,7 +320,7 @@ } foreach my $transition (@{$status->{transitions}}) { - my $to_status = new Bugzilla::Status({name => $transition->[0]}); + my $to_status = Bugzilla::Status->new({name => $transition->[0]}); $dbh->do( 'INSERT INTO status_workflow (old_status, new_status, require_comment) VALUES (?, ?, ?)', @@ -512,7 +512,7 @@ ) ); - $new_product = new Bugzilla::Product({name => $product->{product_name}}); + $new_product = Bugzilla::Product->new({name => $product->{product_name}}); $dbh->do('INSERT INTO milestones (product_id, value) VALUES (?, ?)', undef, ($new_product->id, $product->{defaultmilestone})); @@ -550,13 +550,13 @@ } foreach my $version (@{$product->{versions}}) { - if (!new Bugzilla::Version({name => $version, product => $new_product})) { + if (!Bugzilla::Version->new({name => $version, product => $new_product})) { Bugzilla::Version->create({value => $version, product => $new_product}); } } foreach my $milestone (@{$product->{milestones}}) { - if (!new Bugzilla::Milestone({name => $milestone, product => $new_product})) { + if (!Bugzilla::Milestone->new({name => $milestone, product => $new_product})) { # We don't use Bugzilla::Milestone->create because we want to # bypass security checks. @@ -632,8 +632,8 @@ print "adding users to groups...\n"; foreach my $user_group (@users_groups) { - my $group = new Bugzilla::Group({name => $user_group->{group}}); - my $user = new Bugzilla::User({name => $user_group->{user}}); + my $group = Bugzilla::Group->new({name => $user_group->{group}}); + my $user = Bugzilla::User->new({name => $user_group->{user}}); my $sth_add_mapping = $dbh->prepare( qq{INSERT INTO user_group_map (user_id, group_id, isbless, grant_type) @@ -648,10 +648,10 @@ # Associate Products with groups ########################################################################## # Associate the QA-Selenium-TEST group with the QA-Selenium-TEST. -my $created_group = new Bugzilla::Group({name => 'QA-Selenium-TEST'}); -my $secret_product = new Bugzilla::Product({name => 'QA-Selenium-TEST'}); -my $no_entry = new Bugzilla::Product({name => 'QA Entry Only'}); -my $no_search = new Bugzilla::Product({name => 'QA Search Only'}); +my $created_group = Bugzilla::Group->new({name => 'QA-Selenium-TEST'}); +my $secret_product = Bugzilla::Product->new({name => 'QA-Selenium-TEST'}); +my $no_entry = Bugzilla::Product->new({name => 'QA Entry Only'}); +my $no_search = Bugzilla::Product->new({name => 'QA Search Only'}); print "restricting products to groups...\n"; @@ -698,7 +698,7 @@ # to know if the existing flag type is the one we want or not. # As our Selenium scripts would be confused anyway if there is already such a flag name, # we simply skip it and assume the existing flag type is the one we want. - next if new Bugzilla::FlagType({name => $flag->{name}}); + next if Bugzilla::FlagType->new({name => $flag->{name}}); my $grant_group_id = $flag->{grant_group} @@ -835,7 +835,7 @@ # BMO FIXME: Users must be in 'editbugs' to set their own # content type other than text/plain or application/octet-stream -$group = new Bugzilla::Group({name => 'editbugs'}); +$group = Bugzilla::Group->new({name => 'editbugs'}); my $sth_add_mapping = $dbh->prepare( qq{INSERT INTO user_group_map (user_id, group_id, isbless, grant_type) VALUES (?, ?, ?, ?)} @@ -898,7 +898,7 @@ print "creating keywords...\n"; foreach my $kw (@keywords) { - next if new Bugzilla::Keyword({name => $kw->{name}}); + next if Bugzilla::Keyword->new({name => $kw->{name}}); Bugzilla::Keyword->create($kw); } diff --git a/qa/t/lib/QA/Util.pm b/qa/t/lib/QA/Util.pm --- a/qa/t/lib/QA/Util.pm +++ b/qa/t/lib/QA/Util.pm @@ -143,14 +143,14 @@ . "/xmlrpc.cgi"; require QA::RPC::XMLRPC; - my $rpc = new QA::RPC::XMLRPC(proxy => $xmlrpc_url); + my $rpc = QA::RPC::XMLRPC->new(proxy => $xmlrpc_url); return ($rpc, $config); } sub get_jsonrpc_client { my ($get_mode) = @_; require QA::RPC::JSONRPC; - my $rpc = new QA::RPC::JSONRPC(); + my $rpc = QA::RPC::JSONRPC->new(); # If we don't set a long timeout, then the Bug.add_comment test # where we add a too-large comment fails. diff --git a/qa/t/rest_triage_owners.t b/qa/t/rest_triage_owners.t --- a/qa/t/rest_triage_owners.t +++ b/qa/t/rest_triage_owners.t @@ -29,11 +29,6 @@ ->json_is('/Firefox/General/triage_owner', 'admin@mozilla.bugs') ->json_is('/Firefox/Installer/triage_owner', 'nobody@mozilla.org'); -my $data = $t->tx->res->json; -use Bugzilla::Logging; -use Mojo::Util qw(dumper); -DEBUG(dumper $data); - # Get the triage owner for Firefox for only General component $t->get_ok($url . 'rest/bmo/triage_owners?product=Firefox&component=General' => diff --git a/query.cgi b/query.cgi --- a/query.cgi +++ b/query.cgi @@ -67,7 +67,7 @@ sub PrefillForm { my ($buf) = @_; my $cgi = Bugzilla->cgi; - $buf = new Bugzilla::CGI($buf); + $buf = Bugzilla::CGI->new($buf); my $foundone = 0; my $custom_fields = {}; @@ -77,7 +77,7 @@ # properly. my $any_boolean_charts = grep {/^field-?\d+/} $buf->param(); if ($any_boolean_charts) { - my $search = new Bugzilla::Search(params => scalar $buf->Vars); + my $search = Bugzilla::Search->new(params => scalar $buf->Vars); $search->boolean_charts_to_custom_search($buf); } diff --git a/relogin.cgi b/relogin.cgi --- a/relogin.cgi +++ b/relogin.cgi @@ -152,7 +152,7 @@ delete_token($cgi->param('token')); # Get & verify the target user (the user who we will be impersonating) - my $target_user = new Bugzilla::User({name => $target_login}); + my $target_user = Bugzilla::User->new({name => $target_login}); unless (defined($target_user) && $target_user->id && $user->can_see_user($target_user)) diff --git a/report.cgi b/report.cgi --- a/report.cgi +++ b/report.cgi @@ -115,8 +115,8 @@ my @axis_fields = grep {$_} ($row_field, $col_field, $tbl_field); # Clone the params, so that Bugzilla::Search can modify them -my $params = new Bugzilla::CGI($cgi); -my $search = new Bugzilla::Search( +my $params = Bugzilla::CGI->new($cgi); +my $search = Bugzilla::Search->new( fields => \@axis_fields, params => scalar $params->Vars, allow_unlimited => 1, diff --git a/rest.cgi b/rest.cgi --- a/rest.cgi +++ b/rest.cgi @@ -26,6 +26,6 @@ Bugzilla->usage_mode(USAGE_MODE_REST); local @INC = (bz_locations()->{extensionsdir}, @INC); -my $server = new Bugzilla::WebService::Server::REST; +my $server = Bugzilla::WebService::Server::REST->new(); $server->version('1.1'); $server->handle(); diff --git a/sanitycheck.pl b/sanitycheck.pl --- a/sanitycheck.pl +++ b/sanitycheck.pl @@ -36,7 +36,7 @@ # Be sure a login name if given. $login || ThrowUserError('invalid_username'); -my $user = new Bugzilla::User({name => $login}) +my $user = Bugzilla::User->new({name => $login}) || ThrowUserError('invalid_username', {name => $login}); my $cgi = Bugzilla->cgi; diff --git a/scripts/1298978.pl b/scripts/1298978.pl --- a/scripts/1298978.pl +++ b/scripts/1298978.pl @@ -42,7 +42,7 @@ $auto_user->{bless_groups} = [Bugzilla::Group->get_all]; Bugzilla->set_user($auto_user); -my $search = new Bugzilla::Search(fields => ['bug_id'], params => QUERY); +my $search = Bugzilla::Search->new(fields => ['bug_id'], params => QUERY); my ($data) = $search->data; my $bug_count = @$data; diff --git a/scripts/generate_bmo_data.pl b/scripts/generate_bmo_data.pl --- a/scripts/generate_bmo_data.pl +++ b/scripts/generate_bmo_data.pl @@ -170,7 +170,7 @@ # Create Users ########################################################################## # First of all, remove the default .* regexp for the editbugs group. -my $group = new Bugzilla::Group({name => 'editbugs'}); +my $group = Bugzilla::Group->new({name => 'editbugs'}); $group->set_user_regexp(''); $group->update(); @@ -338,7 +338,7 @@ ) ); - $new_product = new Bugzilla::Product({name => $product->{product_name}}); + $new_product = Bugzilla::Product->new({name => $product->{product_name}}); $dbh->do('INSERT INTO milestones (product_id, value) VALUES (?, ?)', undef, ($new_product->id, $product->{defaultmilestone})); @@ -367,13 +367,13 @@ } foreach my $version (@{$product->{versions}}) { - if (!new Bugzilla::Version({name => $version, product => $new_product})) { + if (!Bugzilla::Version->new({name => $version, product => $new_product})) { Bugzilla::Version->create({value => $version, product => $new_product}); } } foreach my $milestone (@{$product->{milestones}}) { - if (!new Bugzilla::Milestone({name => $milestone, product => $new_product})) { + if (!Bugzilla::Milestone->new({name => $milestone, product => $new_product})) { $dbh->do('INSERT INTO milestones (product_id, value) VALUES (?,?)', undef, $new_product->id, $milestone); } @@ -634,7 +634,7 @@ print "creating flag types...\n"; foreach my $flag (@flagtypes) { - next if new Bugzilla::FlagType({name => $flag->{name}}); + next if Bugzilla::FlagType->new({name => $flag->{name}}); my $grant_group_id = $flag->{grant_group} ? Bugzilla::Group->new({name => $flag->{grant_group}})->id @@ -760,7 +760,7 @@ foreach my $status (@statuses) { my $old_id; if ($status->{value}) { - my $from_status = new Bugzilla::Status({name => $status->{value}}); + my $from_status = Bugzilla::Status->new({name => $status->{value}}); $old_id = $from_status->{id}; } else { @@ -768,7 +768,7 @@ } foreach my $transition (@{$status->{transitions}}) { - my $to_status = new Bugzilla::Status({name => $transition->[0]}); + my $to_status = Bugzilla::Status->new({name => $transition->[0]}); $dbh->do( 'INSERT INTO status_workflow (old_status, new_status, require_comment) VALUES (?, ?, ?)', @@ -831,7 +831,7 @@ print "creating keywords...\n"; foreach my $kw (@keywords) { - next if new Bugzilla::Keyword({name => $kw->{name}}); + next if Bugzilla::Keyword->new({name => $kw->{name}}); Bugzilla::Keyword->create($kw); } diff --git a/scripts/merge-users.pl b/scripts/merge-users.pl --- a/scripts/merge-users.pl +++ b/scripts/merge-users.pl @@ -257,7 +257,7 @@ # rederive regexp-based group memberships, because we merged all memberships # from all of the accounts, and since the email address isn't the same on # them, some of them may no longer match the regexps. -my $user = new Bugzilla::User($new_id); +my $user = Bugzilla::User->new($new_id); $user->derive_regexp_groups(); # BMO - post-work hook diff --git a/scripts/sanitizeme.pl b/scripts/sanitizeme.pl --- a/scripts/sanitizeme.pl +++ b/scripts/sanitizeme.pl @@ -155,7 +155,7 @@ my $bug_id = $row->[0]; $bugnum++; print "\r$bugnum/$numbugs" unless $from_cron; - my $bug = new Bugzilla::Bug($bug_id); + my $bug = Bugzilla::Bug->new($bug_id); $bug->remove_from_db(); } print "\rDone \n" unless $from_cron; diff --git a/show_bug.cgi b/show_bug.cgi --- a/show_bug.cgi +++ b/show_bug.cgi @@ -94,7 +94,7 @@ # Be kind enough and accept URLs of the form: id=1,2,3. my @ids = split(/,/, $id); foreach my $bug_id (@ids) { - my $bug = new Bugzilla::Bug({id => $bug_id, cache => 1}); + my $bug = Bugzilla::Bug->new({id => $bug_id, cache => 1}); # This is basically a backwards-compatibility hack from when # Bugzilla::Bug->new used to set 'NotPermitted' if you couldn't diff --git a/summarize_time.cgi b/summarize_time.cgi --- a/summarize_time.cgi +++ b/summarize_time.cgi @@ -355,7 +355,7 @@ } # Convert bug IDs to bug objects. - @bugs = map { new Bugzilla::Bug($_) } @bugs; + @bugs = map { Bugzilla::Bug->new($_) } @bugs; $vars->{'part_list'} = \@part_list; $vars->{'parts'} = \@parts; diff --git a/t/901-secure-mail-loop.t b/t/901-secure-mail-loop.t --- a/t/901-secure-mail-loop.t +++ b/t/901-secure-mail-loop.t @@ -12,8 +12,8 @@ use Crypt::OpenPGP; -my $pubring = new Crypt::OpenPGP::KeyRing(Data => PUBLIC_KEY()); -my $pgp = new Crypt::OpenPGP(PubRing => $pubring); +my $pubring = Crypt::OpenPGP::KeyRing->new(Data => PUBLIC_KEY()); +my $pgp = Crypt::OpenPGP->new(PubRing => $pubring); { local $SIG{ALRM} = sub { fail("stuck in a loop"); exit; }; alarm(120); diff --git a/testserver.pl b/testserver.pl --- a/testserver.pl +++ b/testserver.pl @@ -158,7 +158,7 @@ # Test GD eval { - my $image = new GD::Image(100, 100); + my $image = GD::Image->new(100, 100); my $black = $image->colorAllocate(0, 0, 0); my $white = $image->colorAllocate(255, 255, 255); my $red = $image->colorAllocate(255, 0, 0); diff --git a/token.cgi b/token.cgi --- a/token.cgi +++ b/token.cgi @@ -385,7 +385,7 @@ # email has changed, so rederive groups - my $user = new Bugzilla::User($userid); + my $user = Bugzilla::User->new($userid); $user->derive_regexp_groups; $vars->{'message'} = "email_change_canceled_reinstated"; diff --git a/userprefs.cgi b/userprefs.cgi --- a/userprefs.cgi +++ b/userprefs.cgi @@ -262,7 +262,7 @@ next if !($settings->{$name}->{'is_enabled'}); my $value = $cgi->param($name); next unless defined $value; - my $setting = new Bugzilla::User::Setting($name); + my $setting = Bugzilla::User::Setting->new($name); if ( $name eq 'api_key_only' @@ -349,7 +349,7 @@ my @watchers; foreach my $watcher_id (@$watcher_ids) { - my $watcher = new Bugzilla::User($watcher_id); + my $watcher = Bugzilla::User->new($watcher_id); push(@watchers, Bugzilla::User::identity($watcher)); } @@ -652,7 +652,7 @@ # have the ability to add link to our search to the footer of # direct group members automatically. if ($user->can_bless($group_id) && $cgi->param('force_' . $q->id)) { - my $group = new Bugzilla::Group($group_id); + my $group = Bugzilla::Group->new($group_id); my $members = $group->members_non_inherited; foreach my $member (@$members) { next if $member->id == $user->id; diff --git a/whine.pl b/whine.pl --- a/whine.pl +++ b/whine.pl @@ -439,8 +439,8 @@ # A new Bugzilla::CGI object needs to be created to allow # Bugzilla::Search to execute a saved query. It's exceedingly weird, # but that's how it works. - my $searchparams = new Bugzilla::CGI($savedquery); - my $search = new Bugzilla::Search( + my $searchparams = Bugzilla::CGI->new($savedquery); + my $search = Bugzilla::Search->new( 'fields' => \@searchfields, 'params' => scalar $searchparams->Vars, 'user' => $args->{'recipient'}, # the search runs as the recipient diff --git a/whineatnews.pl b/whineatnews.pl --- a/whineatnews.pl +++ b/whineatnews.pl @@ -61,7 +61,7 @@ foreach my $email (sort (keys %bugs)) { - my $user = new Bugzilla::User({name => $email}); + my $user = Bugzilla::User->new({name => $email}); next if $user->email_disabled; my $vars = {'email' => $email}; diff --git a/xmlrpc.cgi b/xmlrpc.cgi --- a/xmlrpc.cgi +++ b/xmlrpc.cgi @@ -38,7 +38,7 @@ $XMLRPC::Constants::FAULT_SERVER = ERROR_UNKNOWN_FATAL; local @INC = (bz_locations()->{extensionsdir}, @INC); - my $server = new Bugzilla::WebService::Server::XMLRPC; + my $server = Bugzilla::WebService::Server::XMLRPC->new(); # We use a sub for on_action because that gets us the info about what # class is being called. Note that this is a hack--this is technically diff --git a/xt/lib/Bugzilla/Test/Search.pm b/xt/lib/Bugzilla/Test/Search.pm --- a/xt/lib/Bugzilla/Test/Search.pm +++ b/xt/lib/Bugzilla/Test/Search.pm @@ -218,7 +218,7 @@ # We send back a fresh object every time, to make sure that group # memberships are always up-to-date. - return new Bugzilla::User($self->{admin_user}->id); + return Bugzilla::User->new($self->{admin_user}->id); } sub nobody { @@ -364,7 +364,7 @@ return if !$self->option('add-custom-fields'); while (my ($type, $name) = each %{CUSTOM_FIELDS()}) { - my $exists = new Bugzilla::Field({name => $name}); + my $exists = Bugzilla::Field->new({name => $name}); next if $exists; Bugzilla::Field->create({ name => $name, @@ -551,7 +551,7 @@ ); my $id = $dbh->bz_last_key('flagtypes', 'id'); $dbh->do('INSERT INTO flaginclusions (type_id) VALUES (?)', undef, $id); - my $flagtype = new Bugzilla::FlagType($id); + my $flagtype = Bugzilla::FlagType->new($id); $flagtypes{$target} = $flagtype; } return \%flagtypes; @@ -784,7 +784,7 @@ # It's not generally safe to do update() multiple times on # the same Bug object. - $bug = new Bugzilla::Bug($bug->id); + $bug = Bugzilla::Bug->new($bug->id); my $update_flags = $self->bug_update_value($number, 'set_flags')->{b}; $_->{status} = 'X' foreach @{$bug->flags}; $bug->set_flags($bug->flags, $update_flags); @@ -801,7 +801,7 @@ }); # Store for the changedfrom tests. - $extra_values->{attachments} = [new Bugzilla::Attachment($attachment->id)]; + $extra_values->{attachments} = [Bugzilla::Attachment->new($attachment->id)]; my $attach_update = $self->bug_update_value($number, 'attachment'); $attachment->set_all($attach_update); @@ -818,7 +818,7 @@ $extra_values->{creation_ts} = $bug->creation_ts; $extra_values->{delta_ts} = $bug->creation_ts; - return new Bugzilla::Bug($bug->id); + return Bugzilla::Bug->new($bug->id); } ################################### @@ -942,19 +942,19 @@ # this point that we have an admin with refreshed group memberships. Bugzilla->set_user($self->admin); foreach my $test (CUSTOM_SEARCH_TESTS) { - my $custom_test = new Bugzilla::Test::Search::CustomTest($test, $self); + my $custom_test = Bugzilla::Test::Search::CustomTest->new($test, $self); $custom_test->run(); } foreach my $test (SPECIAL_PARAM_TESTS) { my $operator_test - = new Bugzilla::Test::Search::OperatorTest($test->{operator}, $self); + = Bugzilla::Test::Search::OperatorTest->new($test->{operator}, $self); my $field = Bugzilla::Field->check($test->{field}); my $special_test - = new Bugzilla::Test::Search::FieldTestNormal($operator_test, $field, $test); + = Bugzilla::Test::Search::FieldTestNormal->new($operator_test, $field, $test); $special_test->run(); } foreach my $operator ($self->top_level_operators) { - my $operator_test = new Bugzilla::Test::Search::OperatorTest($operator, $self); + my $operator_test = Bugzilla::Test::Search::OperatorTest->new($operator, $self); $operator_test->run(); } @@ -1034,7 +1034,7 @@ # We pull it newly from the DB to be sure it's safe to call update() # on. - my $bug6 = new Bugzilla::Bug($self->bug(6)->id); + my $bug6 = Bugzilla::Bug->new($self->bug(6)->id); $bug6->add_group($nobody); $bug6->update($bug6->delta_ts); diff --git a/xt/lib/Bugzilla/Test/Search/CustomTest.pm b/xt/lib/Bugzilla/Test/Search/CustomTest.pm --- a/xt/lib/Bugzilla/Test/Search/CustomTest.pm +++ b/xt/lib/Bugzilla/Test/Search/CustomTest.pm @@ -101,10 +101,10 @@ my ($self, $row) = @_; my $as_test = {field => $row->{f}, operator => $row->{o}, value => $row->{v}}; my $operator_test - = new Bugzilla::Test::Search::OperatorTest($row->{o}, $self->search_test); + = Bugzilla::Test::Search::OperatorTest->new($row->{o}, $self->search_test); my $field = Bugzilla::Field->check($row->{f}); my $field_test - = new Bugzilla::Test::Search::FieldTest($operator_test, $field, $as_test); + = Bugzilla::Test::Search::FieldTest->new($operator_test, $field, $as_test); return $field_test->translated_value; } diff --git a/xt/lib/Bugzilla/Test/Search/FieldTest.pm b/xt/lib/Bugzilla/Test/Search/FieldTest.pm --- a/xt/lib/Bugzilla/Test/Search/FieldTest.pm +++ b/xt/lib/Bugzilla/Test/Search/FieldTest.pm @@ -601,7 +601,7 @@ my $name = $self->name; my @args = (fields => $self->search_columns, params => $self->search_params); my $search; - lives_ok { $search = new Bugzilla::Search(@args) } + lives_ok { $search = Bugzilla::Search->new(@args) } "$name: create search object"; return $search; } diff --git a/xt/lib/Bugzilla/Test/Search/OperatorTest.pm b/xt/lib/Bugzilla/Test/Search/OperatorTest.pm --- a/xt/lib/Bugzilla/Test/Search/OperatorTest.pm +++ b/xt/lib/Bugzilla/Test/Search/OperatorTest.pm @@ -65,11 +65,11 @@ foreach my $field ($self->test_fields) { foreach my $test ($self->tests) { - my $field_test = new Bugzilla::Test::Search::FieldTest($self, $field, $test); + my $field_test = Bugzilla::Test::Search::FieldTest->new($self, $field, $test); $field_test->run(); - my $normal_test = new Bugzilla::Test::Search::FieldTestNormal($field_test); + my $normal_test = Bugzilla::Test::Search::FieldTestNormal->new($field_test); $normal_test->run(); - my $not_test = new Bugzilla::Test::Search::NotTest($field_test); + my $not_test = Bugzilla::Test::Search::NotTest->new($field_test); $not_test->run(); next if !$self->search_test->option('long'); @@ -83,7 +83,7 @@ } foreach my $test (INJECTION_TESTS) { my $injection_test - = new Bugzilla::Test::Search::InjectionTest($self, $field, $test); + = Bugzilla::Test::Search::InjectionTest->new($self, $field, $test); $injection_test->run(); } } @@ -105,13 +105,13 @@ sub _run_one_join_test { my ($self, $field_test, $other_operator_test, $other_field, $other_test) = @_; my $other_field_test - = new Bugzilla::Test::Search::FieldTest($other_operator_test, $other_field, + = Bugzilla::Test::Search::FieldTest->new($other_operator_test, $other_field, $other_test); my $or_test - = new Bugzilla::Test::Search::OrTest($field_test, $other_field_test); + = Bugzilla::Test::Search::OrTest->new($field_test, $other_field_test); $or_test->run(); my $and_test - = new Bugzilla::Test::Search::AndTest($field_test, $other_field_test); + = Bugzilla::Test::Search::AndTest->new($field_test, $other_field_test); $and_test->run(); } diff --git a/xt/search.t b/xt/search.t --- a/xt/search.t +++ b/xt/search.t @@ -46,7 +46,7 @@ Bugzilla->usage_mode(USAGE_MODE_TEST); -my $test = new Bugzilla::Test::Search(\%switches); +my $test = Bugzilla::Test::Search->new(\%switches); plan tests => $test->num_tests; $test->run();