diff options
62 files changed, 205 insertions, 262 deletions
diff --git a/Bugzilla/Attachment.pm b/Bugzilla/Attachment.pm index 40231aa6c..a7961d764 100644 --- a/Bugzilla/Attachment.pm +++ b/Bugzilla/Attachment.pm @@ -47,9 +47,6 @@ that users upload to the Bugzilla server. =cut -# This module requires that its caller have said "require globals.pl" -# to import relevant functions from that script. - use Bugzilla::Error; use Bugzilla::Flag; use Bugzilla::Config qw(:locations Param); diff --git a/Bugzilla/Config.pm b/Bugzilla/Config.pm index 3f5b788c2..cb20fad24 100644 --- a/Bugzilla/Config.pm +++ b/Bugzilla/Config.pm @@ -79,19 +79,16 @@ our @parampanels = (); # Don't export localvars by default - people should have to explicitly # ask for it, as a (probably futile) attempt to stop code using it # when it shouldn't -# ChmodDataFile is here until that stuff all moves out of globals.pl -# into this file -@Bugzilla::Config::EXPORT_OK = qw(ChmodDataFile); - %Bugzilla::Config::EXPORT_TAGS = ( admin => [qw(UpdateParams SetParam WriteParams)], db => [qw($db_driver $db_host $db_port $db_name $db_user $db_pass $db_sock)], + localconfig => [qw($cvsbin $interdiffbin $diffpath $webservergroup)], locations => [qw($libpath $localconfig $attachdir $datadir $templatedir $webdotdir $project $extensionsdir)], params => [qw(@parampanels)], ); -Exporter::export_ok_tags('admin', 'db', 'locations', 'params'); +Exporter::export_ok_tags('admin', 'db', 'localconfig', 'locations', 'params'); # Bugzilla version $Bugzilla::Config::VERSION = "2.23.1+"; diff --git a/Bugzilla/Token.pm b/Bugzilla/Token.pm index 3cb4d6ffc..40eef4f1b 100644 --- a/Bugzilla/Token.pm +++ b/Bugzilla/Token.pm @@ -37,9 +37,6 @@ use Bugzilla::Util; use Date::Format; use Date::Parse; -# This module requires that its caller have said "require globals.pl" to import -# relevant functions from that script. - ################################################################################ # Constants ################################################################################ diff --git a/attachment.cgi b/attachment.cgi index c79ebf2cb..7acc6e326 100755 --- a/attachment.cgi +++ b/attachment.cgi @@ -37,12 +37,10 @@ use strict; use lib qw(.); -# Include the Bugzilla CGI and general utility library. -require "globals.pl"; - use Bugzilla; -use Bugzilla::Config qw(:locations); +use Bugzilla::Config qw(:DEFAULT :localconfig); use Bugzilla::Constants; +use Bugzilla::Error; use Bugzilla::Flag; use Bugzilla::FlagType; use Bugzilla::User; @@ -371,7 +369,7 @@ sub view { my $hash = ($attach_id % 100) + 100; $hash =~ s/.*(\d\d)$/group.$1/; - if (open(AH, "$attachdir/$hash/attachment.$attach_id")) { + if (open(AH, bz_locations()->{'attachdir'} . "/$hash/attachment.$attach_id")) { binmode AH; $filesize = (stat(AH))[7]; } @@ -424,8 +422,8 @@ sub interdiff # # Must hack path so that interdiff will work. # - $ENV{'PATH'} = $::diffpath; - open my $interdiff_fh, "$::interdiffbin $old_filename $new_filename|"; + $ENV{'PATH'} = $diffpath; + open my $interdiff_fh, "$interdiffbin $old_filename $new_filename|"; binmode $interdiff_fh; my ($reader, $last_reader) = setup_patch_readers("", $context); if ($format eq 'raw') @@ -558,7 +556,7 @@ sub setup_patch_readers { $last_reader = $last_reader->sends_data_to; } # Add in cvs context if we have the necessary info to do it - if ($context ne "patch" && $::cvsbin && Param('cvsroot_get')) + if ($context ne "patch" && $cvsbin && Param('cvsroot_get')) { require PatchReader::AddCVSContext; $last_reader->sends_data_to( @@ -583,7 +581,7 @@ sub setup_template_patch_reader } $vars->{collapsed} = $cgi->param('collapsed'); $vars->{context} = $context; - $vars->{do_context} = $::cvsbin && Param('cvsroot_get') && !$vars->{'newid'}; + $vars->{do_context} = $cvsbin && Param('cvsroot_get') && !$vars->{'newid'}; # Print everything out print $cgi->header(-type => 'text/html', @@ -634,7 +632,7 @@ sub diff else { $vars->{other_patches} = []; - if ($::interdiffbin && $::diffpath) { + if ($interdiffbin && $diffpath) { # Get list of attachments on this bug. # Ignore the current patch, but select the one right before it # chronologically. diff --git a/buglist.cgi b/buglist.cgi index 5d56c2255..cb9dba663 100755 --- a/buglist.cgi +++ b/buglist.cgi @@ -35,9 +35,12 @@ use strict; use lib qw(.); use Bugzilla; +use Bugzilla::Constants; +use Bugzilla::Error; +use Bugzilla::Util; +use Bugzilla::Config qw(:DEFAULT); use Bugzilla::Search; use Bugzilla::Search::Quicksearch; -use Bugzilla::Constants; use Bugzilla::User; use Bugzilla::Bug; use Bugzilla::Product; @@ -46,9 +49,6 @@ use Bugzilla::Field; use Date::Parse; -# Include the Bugzilla CGI and general utility library. -require "globals.pl"; - my $cgi = Bugzilla->cgi; my $dbh = Bugzilla->dbh; my $template = Bugzilla->template; @@ -894,7 +894,7 @@ if ($serverpush) { # query performance. $dbh = Bugzilla->switch_to_shadow_db(); -# Normally, we ignore SIGTERM and SIGPIPE (see globals.pl) but we need to +# Normally, we ignore SIGTERM and SIGPIPE, but we need to # respond to them here to prevent someone DOSing us by reloading a query # a large number of times. $::SIG{TERM} = 'DEFAULT'; @@ -45,9 +45,11 @@ use strict; use lib qw(.); -require "globals.pl"; use Bugzilla; use Bugzilla::Constants; +use Bugzilla::Config qw(:DEFAULT); +use Bugzilla::Error; +use Bugzilla::Util; use Bugzilla::Chart; use Bugzilla::Series; use Bugzilla::User; diff --git a/checksetup.pl b/checksetup.pl index ff51aacf9..f77f0dba6 100755 --- a/checksetup.pl +++ b/checksetup.pl @@ -1048,11 +1048,6 @@ while (my ($table, $values) = each %$enum_values) { # Create initial --DATA-- directory and make the initial empty files there: # -# The |require "globals.pl"| above ends up creating a template object with -# a COMPILE_DIR of "$datadir". This means that TT creates the directory for us, -# so this code wouldn't run if we just checked for the existence of the -# directory. Instead, check for the existence of '$datadir/nomail', which is -# created in this block unless (-d $datadir && -e "$datadir/nomail") { print "Creating data directory ($datadir) ...\n"; # permissions for non-webservergroup are fixed later on @@ -1596,8 +1591,7 @@ if ($^O !~ /MSWin32/i) { fixPerms('css', $<, $webservergid, 027, 1); fixPerms('skins', $<, $webservergid, 027, 1); fixPerms('js', $<, $webservergid, 027, 1); - chmod 0644, 'globals.pl'; - + # Don't use fixPerms here, because it won't change perms # on the directory unless it's using recursion chown $<, $webservergid, $datadir; diff --git a/colchange.cgi b/colchange.cgi index cf9e14977..857b85063 100755 --- a/colchange.cgi +++ b/colchange.cgi @@ -27,9 +27,10 @@ use lib qw(.); use Bugzilla; use Bugzilla::Constants; +use Bugzilla::Config qw(:DEFAULT); +use Bugzilla::Error; use Bugzilla::User; use Bugzilla::Keyword; -require "globals.pl"; Bugzilla->login(); diff --git a/collectstats.pl b/collectstats.pl index ca37c0b3c..2f76e544f 100755 --- a/collectstats.pl +++ b/collectstats.pl @@ -34,9 +34,11 @@ use strict; use IO::Handle; use lib "."; -require "globals.pl"; + use Bugzilla; -use Bugzilla::Config qw(:DEFAULT $datadir); +use Bugzilla::Constants; +use Bugzilla::Config qw(:DEFAULT); +use Bugzilla::Util; use Bugzilla::Search; use Bugzilla::User; use Bugzilla::Product; @@ -63,6 +65,8 @@ if ($#ARGV >= 0 && $ARGV[0] eq "--regenerate") { $regenerate = 1; } +my $datadir = bz_locations()->{'datadir'}; + my @myproducts = map {$_->name} Bugzilla::Product::get_all_products(); unshift(@myproducts, "-All-"); @@ -71,7 +75,7 @@ foreach (@myproducts) { my $dir = "$datadir/mining"; &check_data_dir ($dir); - + if ($regenerate) { ®enerate_stats($dir, $_); } else { @@ -206,6 +210,8 @@ sub calculate_dupes { # Save % count here in a date-named file # so we can read it back in to do changed counters # First, delete it if it exists, so we don't add to the contents of an old file + my $datadir = bz_locations()->{'datadir'}; + if (my @files = <$datadir/duplicates/dupes$today*>) { map { trick_taint($_) } @files; unlink @files; diff --git a/config.cgi b/config.cgi index 6ed57bd85..a50f3aaf6 100755 --- a/config.cgi +++ b/config.cgi @@ -28,11 +28,12 @@ # Make it harder for us to do dangerous things in Perl. use strict; -# Include the Bugzilla CGI and general utility library. use lib qw(.); -require "globals.pl"; + use Bugzilla; use Bugzilla::Constants; +use Bugzilla::Config qw(:DEFAULT); +use Bugzilla::Error; use Bugzilla::Keyword; use Bugzilla::Bug; use Bugzilla::Field; diff --git a/contrib/BugzillaEmail.pm b/contrib/BugzillaEmail.pm index be51489a5..c6b569c9d 100644 --- a/contrib/BugzillaEmail.pm +++ b/contrib/BugzillaEmail.pm @@ -28,10 +28,9 @@ push @INC, "../."; # this script now lives in contrib -require "globals.pl"; - use strict; +use Bugzilla; my $EMAIL_TRANSFORM_NONE = "email_transform_none"; my $EMAIL_TRANSFORM_BASE_DOMAIN = "email_transform_base_domain"; diff --git a/contrib/bug_email.pl b/contrib/bug_email.pl index 546c08dc5..5f95e9272 100755 --- a/contrib/bug_email.pl +++ b/contrib/bug_email.pl @@ -38,7 +38,7 @@ # # You need to work with bug_email.pl the MIME::Parser installed. # -# $Id: bug_email.pl,v 1.41 2006/06/19 17:30:24 lpsolit%gmail.com Exp $ +# $Id: bug_email.pl,v 1.42 2006/06/21 00:44:48 lpsolit%gmail.com Exp $ ############################################################### # 02/12/2000 (SML) @@ -73,7 +73,7 @@ # - querying a bug over email # - appending a bug over email # - keywords over email -# - use the globals.pl parameters functionality to edit and save this script's parameters +# - use the Bugzilla parameters functionality to edit and save this script's parameters # - integrate some setup in the checksetup.pl script # - gpg signatures for security @@ -86,14 +86,14 @@ BEGIN { push @INC, "."; } -require "globals.pl"; -use Bugzilla; -use BugzillaEmail; -use Bugzilla::Config qw(:DEFAULT $datadir); - use lib "."; use lib "../"; + +use Bugzilla; +use BugzillaEmail; +use Bugzilla::Config qw(:DEFAULT); use Bugzilla::Constants; +use Bugzilla::Util; use Bugzilla::BugMail; use Bugzilla::User; use Bugzilla::Product; @@ -228,7 +228,7 @@ sub Reply( $$$$ ) { die "Cannot find sender-email-address" unless defined( $Sender ); if( $test ) { - open( MAIL, '>>', "$datadir/bug_email_test.log" ); + open( MAIL, '>>', bz_locations()->{'datadir'} . "/bug_email_test.log" ); } else { open( MAIL, "| /usr/sbin/sendmail -t" ); @@ -669,6 +669,7 @@ my $parser = new MIME::Parser; # Create and set the output directory: # FIXME: There should be a $BUGZILLA_HOME variable (SML) +my $datadir = bz_locations()->{'datadir'}; (-d "$datadir/mimedump-tmp") or mkdir "$datadir/mimedump-tmp",0755 or die "mkdir: $!"; (-w "$datadir/mimedump-tmp") or die "can't write to directory"; diff --git a/contrib/bugzilla_email_append.pl b/contrib/bugzilla_email_append.pl index cf144642d..fef46f01b 100755 --- a/contrib/bugzilla_email_append.pl +++ b/contrib/bugzilla_email_append.pl @@ -37,10 +37,10 @@ BEGIN { push @INC, "."; # this script lives in contrib } -require "globals.pl"; use Bugzilla; +use Bugzilla::Constants; use BugzillaEmail; -use Bugzilla::Config qw(:DEFAULT $datadir); +use Bugzilla::Config qw(:DEFAULT); use Bugzilla::BugMail; my $dbh = Bugzilla->dbh; @@ -52,6 +52,7 @@ my $Comment = ""; # Create and set the output directory: # FIXME: There should be a $BUGZILLA_HOME variable (SML) +my $datadir = bz_locations()->{'datadir'}; (-d "$datadir/mimedump-tmp") or mkdir "$datadir/mimedump-tmp",0755 or die "mkdir: $!"; (-w "$datadir/mimedump-tmp") or die "can't write to directory"; @@ -153,45 +154,45 @@ sub dump_entity { # Output the body: my @parts = $entity->parts; if (@parts) { # multipart... - my $i; - foreach $i (0 .. $#parts) { # dump each part... - dump_entity($parts[$i], ("$name, part ".(1+$i))); - } - } else { # single part... - - # Get MIME type, and display accordingly... - my $msg_part = $entity->head->get( 'Content-Disposition' ); - - $msg_part ||= ""; - - my ($type, $subtype) = split('/', $entity->head->mime_type); - my $body = $entity->bodyhandle; - my ($data, $on_disk ); - - if( $msg_part =~ /^attachment/ ) { - # Attached File - my $des = $entity->head->get('Content-Description'); - $des ||= ""; - - if( defined( $body->path )) { # Data is on disk - $on_disk = 1; - $data = $body->path; - - } else { # Data is in core - $on_disk = 0; - $data = $body->as_string; - } -# push ( @attachments, [ $data, $entity->head->mime_type, $on_disk, $des ] ); - } else { - # Real Message - if ($type =~ /^(text|message)$/) { # text: display it... - if ($IO = $body->open("r")) { - $Comment .= $_ while (defined($_ = $IO->getline)); - $IO->close; - } else { # d'oh! - print "$0: couldn't find/open '$name': $!"; - } - } else { print "Oooops - no Body !\n"; } - } + my $i; + foreach $i (0 .. $#parts) { # dump each part... + dump_entity($parts[$i], ("$name, part ".(1+$i))); + } + } else { # single part... + + # Get MIME type, and display accordingly... + my $msg_part = $entity->head->get( 'Content-Disposition' ); + + $msg_part ||= ""; + + my ($type, $subtype) = split('/', $entity->head->mime_type); + my $body = $entity->bodyhandle; + my ($data, $on_disk ); + + if( $msg_part =~ /^attachment/ ) { + # Attached File + my $des = $entity->head->get('Content-Description'); + $des ||= ""; + + if( defined( $body->path )) { # Data is on disk + $on_disk = 1; + $data = $body->path; + + } else { # Data is in core + $on_disk = 0; + $data = $body->as_string; + } +# push ( @attachments, [ $data, $entity->head->mime_type, $on_disk, $des ] ); + } else { + # Real Message + if ($type =~ /^(text|message)$/) { # text: display it... + if ($IO = $body->open("r")) { + $Comment .= $_ while (defined($_ = $IO->getline)); + $IO->close; + } else { # d'oh! + print "$0: couldn't find/open '$name': $!"; + } + } else { print "Oooops - no Body !\n"; } + } } } diff --git a/contrib/gnats2bz.pl b/contrib/gnats2bz.pl index c343f5750..7a509682e 100644 --- a/contrib/gnats2bz.pl +++ b/contrib/gnats2bz.pl @@ -861,8 +861,6 @@ sub map_username_to_realname() { return(""); } -# This routine was copied from globals.pl which was largely copied -# from Mysql.pm. sub detaint_string { my ($str) = @_; $str =~ m/^(.*)$/s; diff --git a/contrib/sendbugmail.pl b/contrib/sendbugmail.pl index 5e7cda696..bcc01666c 100644 --- a/contrib/sendbugmail.pl +++ b/contrib/sendbugmail.pl @@ -4,7 +4,7 @@ # # Nick Barnes, Ravenbrook Limited, 2004-04-01. # -# $Id: sendbugmail.pl,v 1.4 2006/05/15 16:06:59 lpsolit%gmail.com Exp $ +# $Id: sendbugmail.pl,v 1.5 2006/06/21 00:44:48 lpsolit%gmail.com Exp $ # # Bugzilla email script for Bugzilla 2.17.4 and later. Invoke this to send # bugmail for a bug which has been changed directly in the database. @@ -16,8 +16,9 @@ use lib qw(.); -require "globals.pl"; use Bugzilla; +use Bugzilla::Config qw(:DEFAULT); +use Bugzilla::Util; use Bugzilla::BugMail; use Bugzilla::User; diff --git a/contrib/sendunsentbugmail.pl b/contrib/sendunsentbugmail.pl index 1fad9c891..5ed49b22e 100644 --- a/contrib/sendunsentbugmail.pl +++ b/contrib/sendunsentbugmail.pl @@ -25,7 +25,6 @@ use strict; use lib qw(.); -require "globals.pl"; use Bugzilla; use Bugzilla::Constants; use Bugzilla::BugMail; diff --git a/contrib/syncLDAP.pl b/contrib/syncLDAP.pl index 0622f8ab4..b3ca80705 100755 --- a/contrib/syncLDAP.pl +++ b/contrib/syncLDAP.pl @@ -13,22 +13,20 @@ # # The Original Code is the LDAP to Bugzilla User Sync Tool. # -# The Initial Developer of the Original Code is Andreas Höfler. -# Portions created by Andreas Höfler are Copyright (C) 2003 -# Andreas Höfler. All -# Rights Reserved. +# The Initial Developer of the Original Code is Andreas Höfler. +# Portions created by Andreas Höfler are Copyright (C) 2003 +# Andreas Höfler. All Rights Reserved. # -# Contributor(s): Andreas Höfler <andreas.hoefler@bearingpoint.com> +# Contributor(s): Andreas Höfler <andreas.hoefler@bearingpoint.com> # use strict; -require "globals.pl"; - use lib qw(.); use Net::LDAP; use Bugzilla; +use Bugzilla::Config qw(:DEFAULT); use Bugzilla::User; my $cgi = Bugzilla->cgi; diff --git a/createaccount.cgi b/createaccount.cgi index b50f9d87a..980b5986a 100755 --- a/createaccount.cgi +++ b/createaccount.cgi @@ -28,10 +28,10 @@ use strict; use lib qw(.); -require "globals.pl"; - use Bugzilla; use Bugzilla::Constants; +use Bugzilla::Config qw(:DEFAULT); +use Bugzilla::Error; use Bugzilla::User; use Bugzilla::BugMail; use Bugzilla::Util; diff --git a/customfield.pl b/customfield.pl index 101bac880..2821425c7 100755 --- a/customfield.pl +++ b/customfield.pl @@ -27,7 +27,6 @@ use strict; use lib "."; -require "globals.pl"; use Bugzilla; use Bugzilla::Field; diff --git a/describecomponents.cgi b/describecomponents.cgi index 87a1eed32..d42979d0b 100755 --- a/describecomponents.cgi +++ b/describecomponents.cgi @@ -27,7 +27,8 @@ use lib qw(.); use Bugzilla; use Bugzilla::Constants; -require "globals.pl"; +use Bugzilla::Util; +use Bugzilla::Error; use Bugzilla::Product; my $user = Bugzilla->login(); diff --git a/describekeywords.cgi b/describekeywords.cgi index 2b21e712c..e06350d2e 100755 --- a/describekeywords.cgi +++ b/describekeywords.cgi @@ -25,10 +25,9 @@ use strict; use lib "."; use Bugzilla; +use Bugzilla::Error; use Bugzilla::User; -require "globals.pl"; - Bugzilla->login(); my $cgi = Bugzilla->cgi; diff --git a/duplicates.cgi b/duplicates.cgi index 5264e1e14..6b839165b 100755 --- a/duplicates.cgi +++ b/duplicates.cgi @@ -29,12 +29,12 @@ use AnyDBM_File; use lib qw(.); -require "globals.pl"; - use Bugzilla; -use Bugzilla::Search; -use Bugzilla::Config qw(:DEFAULT $datadir); use Bugzilla::Constants; +use Bugzilla::Config qw(:DEFAULT); +use Bugzilla::Util; +use Bugzilla::Error; +use Bugzilla::Search; use Bugzilla::Product; my $cgi = Bugzilla->cgi; @@ -106,6 +106,8 @@ my $yesterday = days_ago(1); use Errno; use Fcntl; +my $datadir = bz_locations()->{'datadir'}; + if (!tie(%dbmcount, 'AnyDBM_File', "$datadir/duplicates/dupes$today", O_RDONLY, 0644)) { if ($!{ENOENT}) { diff --git a/editclassifications.cgi b/editclassifications.cgi index ce82ccb97..e23f32b7e 100755 --- a/editclassifications.cgi +++ b/editclassifications.cgi @@ -27,11 +27,9 @@ use Bugzilla; use Bugzilla::Constants; use Bugzilla::Util; use Bugzilla::Error; -use Bugzilla::Config qw($datadir); +use Bugzilla::Config qw(:DEFAULT); use Bugzilla::Classification; -require "globals.pl"; - my $cgi = Bugzilla->cgi; my $dbh = Bugzilla->dbh; my $template = Bugzilla->template; diff --git a/editcomponents.cgi b/editcomponents.cgi index e063c1b10..225e7ae91 100755 --- a/editcomponents.cgi +++ b/editcomponents.cgi @@ -29,13 +29,12 @@ use strict; use lib "."; -require "globals.pl"; - use Bugzilla; use Bugzilla::Constants; -use Bugzilla::Config qw(:DEFAULT $datadir); +use Bugzilla::Config qw(:DEFAULT); use Bugzilla::Series; use Bugzilla::Util; +use Bugzilla::Error; use Bugzilla::User; use Bugzilla::Product; use Bugzilla::Component; diff --git a/editflagtypes.cgi b/editflagtypes.cgi index 0386fca06..825fa1eb5 100755 --- a/editflagtypes.cgi +++ b/editflagtypes.cgi @@ -29,9 +29,6 @@ use strict; use lib "."; -# Include the Bugzilla CGI and general utility library. -require "globals.pl"; - # Use Bugzilla's flag modules for handling flag types. use Bugzilla; use Bugzilla::Constants; @@ -39,6 +36,7 @@ use Bugzilla::Flag; use Bugzilla::FlagType; use Bugzilla::Group; use Bugzilla::Util; +use Bugzilla::Error; use Bugzilla::Product; use Bugzilla::Component; use Bugzilla::Bug; diff --git a/editgroups.cgi b/editgroups.cgi index 2b4671b14..7bc712b68 100755 --- a/editgroups.cgi +++ b/editgroups.cgi @@ -24,18 +24,17 @@ # Vlad Dascalu <jocuri@softhome.net> # Frédéric Buclin <LpSolit@gmail.com> -# Code derived from editowners.cgi and editusers.cgi - use strict; use lib "."; use Bugzilla; use Bugzilla::Constants; use Bugzilla::Config qw(:DEFAULT :admin); +use Bugzilla::Util; +use Bugzilla::Error; use Bugzilla::Group; use Bugzilla::Product; use Bugzilla::User; -require "globals.pl"; my $cgi = Bugzilla->cgi; my $dbh = Bugzilla->dbh; diff --git a/editkeywords.cgi b/editkeywords.cgi index b53aebb3e..9696480bd 100755 --- a/editkeywords.cgi +++ b/editkeywords.cgi @@ -23,11 +23,10 @@ use strict; use lib "."; -require "globals.pl"; - use Bugzilla; use Bugzilla::Constants; -use Bugzilla::Config qw(:DEFAULT $datadir); +use Bugzilla::Util; +use Bugzilla::Error; my $cgi = Bugzilla->cgi; my $dbh = Bugzilla->dbh; diff --git a/editmilestones.cgi b/editmilestones.cgi index 8e2a6e3f4..261b81920 100755 --- a/editmilestones.cgi +++ b/editmilestones.cgi @@ -12,18 +12,17 @@ # Matt Masson <matthew@zeroknowledge.com> # # Contributors : Gavin Shelley <bugzilla@chimpychompy.org> -# Frédéric Buclin <LpSolit@gmail.com> +# Frédéric Buclin <LpSolit@gmail.com> # use strict; use lib "."; -require "globals.pl"; - use Bugzilla; use Bugzilla::Constants; -use Bugzilla::Config qw(:DEFAULT $datadir); +use Bugzilla::Util; +use Bugzilla::Error; use Bugzilla::Product; use Bugzilla::Milestone; use Bugzilla::Bug; diff --git a/editparams.cgi b/editparams.cgi index bb8fa591b..61fc03811 100755 --- a/editparams.cgi +++ b/editparams.cgi @@ -27,10 +27,11 @@ use lib "."; use Bugzilla; use Bugzilla::Constants; -use Bugzilla::Config qw(:DEFAULT :admin :params $datadir); +use Bugzilla::Config qw(:DEFAULT :admin :params); use Bugzilla::Config::Common; +use Bugzilla::Util; +use Bugzilla::Error; -require "globals.pl"; use vars qw(@parampanels); my $user = Bugzilla->login(LOGIN_REQUIRED); diff --git a/editproducts.cgi b/editproducts.cgi index 46b3a0145..a3c5221b5 100755 --- a/editproducts.cgi +++ b/editproducts.cgi @@ -33,12 +33,14 @@ use strict; use lib "."; + use Bugzilla; use Bugzilla::Constants; -require "globals.pl"; +use Bugzilla::Config qw(:DEFAULT); +use Bugzilla::Util; +use Bugzilla::Error; use Bugzilla::Bug; use Bugzilla::Series; -use Bugzilla::Config qw(:DEFAULT $datadir); use Bugzilla::Mailer; use Bugzilla::Product; use Bugzilla::Classification; diff --git a/editsettings.cgi b/editsettings.cgi index 231c1aea8..85332a39a 100755 --- a/editsettings.cgi +++ b/editsettings.cgi @@ -21,10 +21,10 @@ use lib qw(.); use Bugzilla; use Bugzilla::Constants; +use Bugzilla::Util; +use Bugzilla::Error; use Bugzilla::User::Setting; -require "globals.pl"; - my $template = Bugzilla->template; my $vars = {}; diff --git a/editusers.cgi b/editusers.cgi index 6da000a1b..6912032f6 100755 --- a/editusers.cgi +++ b/editusers.cgi @@ -23,15 +23,14 @@ use strict; use lib "."; -require "globals.pl"; - use Bugzilla; +use Bugzilla::Constants; +use Bugzilla::Config qw(:DEFAULT); +use Bugzilla::Util; +use Bugzilla::Error; use Bugzilla::User; use Bugzilla::Bug; use Bugzilla::Flag; -use Bugzilla::Config; -use Bugzilla::Constants; -use Bugzilla::Util; use Bugzilla::Field; use Bugzilla::Group; diff --git a/editvalues.cgi b/editvalues.cgi index 2da48eed2..68cd6917a 100755 --- a/editvalues.cgi +++ b/editvalues.cgi @@ -21,12 +21,11 @@ use strict; use lib "."; -require "globals.pl"; use Bugzilla; use Bugzilla::Util; use Bugzilla::Error; use Bugzilla::Constants; -use Bugzilla::Config qw(:DEFAULT :admin :locations); +use Bugzilla::Config qw(:DEFAULT :admin); # List of different tables that contain the changeable field values # (the old "enums.") Keep them in alphabetical order by their diff --git a/editversions.cgi b/editversions.cgi index dec675b5b..e8f7f4c35 100755 --- a/editversions.cgi +++ b/editversions.cgi @@ -21,7 +21,7 @@ # Contributor(s): Holger Schurig <holgerschurig@nikocity.de> # Terry Weissman <terry@mozilla.org> # Gavin Shelley <bugzilla@chimpychompy.org> -# Frédéric Buclin <LpSolit@gmail.com> +# Frédéric Buclin <LpSolit@gmail.com> # # # Direct any questions on this source code to @@ -31,11 +31,10 @@ use strict; use lib "."; -require "globals.pl"; - use Bugzilla; use Bugzilla::Constants; -use Bugzilla::Config qw(:DEFAULT $datadir); +use Bugzilla::Util; +use Bugzilla::Error; use Bugzilla::Product; use Bugzilla::Version; diff --git a/editwhines.cgi b/editwhines.cgi index 0db643552..c4a1cae51 100755 --- a/editwhines.cgi +++ b/editwhines.cgi @@ -28,12 +28,15 @@ use strict; use lib "."; -require "globals.pl"; use Bugzilla; use Bugzilla::Constants; +use Bugzilla::Config qw(:DEFAULT); +use Bugzilla::Util; +use Bugzilla::Error; use Bugzilla::User; use Bugzilla::Group; + # require the user to have logged in my $user = Bugzilla->login(LOGIN_REQUIRED); diff --git a/enter_bug.cgi b/enter_bug.cgi index 54b3f818b..43b413431 100755 --- a/enter_bug.cgi +++ b/enter_bug.cgi @@ -39,6 +39,9 @@ use lib qw(.); use Bugzilla; use Bugzilla::Constants; +use Bugzilla::Config qw(:DEFAULT); +use Bugzilla::Util; +use Bugzilla::Error; use Bugzilla::Bug; use Bugzilla::User; use Bugzilla::Hook; @@ -47,7 +50,6 @@ use Bugzilla::Classification; use Bugzilla::Keyword; use Bugzilla::Token; use Bugzilla::Field; -require "globals.pl"; my $user = Bugzilla->login(LOGIN_REQUIRED); diff --git a/globals.pl b/globals.pl deleted file mode 100644 index 146b51550..000000000 --- a/globals.pl +++ /dev/null @@ -1,45 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Bugzilla Bug Tracking System. -# -# The Initial Developer of the Original Code is Netscape Communications -# Corporation. Portions created by Netscape are -# Copyright (C) 1998 Netscape Communications Corporation. All -# Rights Reserved. -# -# Contributor(s): Terry Weissman <terry@mozilla.org> -# Dan Mosedale <dmose@mozilla.org> -# Jacob Steenhagen <jake@bugzilla.org> -# Bradley Baetz <bbaetz@student.usyd.edu.au> -# Christopher Aillon <christopher@aillon.com> -# Joel Peshkin <bugreport@peshkin.net> -# Dave Lawrence <dkl@redhat.com> -# Max Kanat-Alexander <mkanat@bugzilla.org> -# Lance Larsh <lance.larsh@oracle.com> - -# Contains some global variables and routines used throughout bugzilla. - -use strict; - -use Bugzilla::Constants; -use Bugzilla::Util; -# Bring ChmodDataFile in until this is all moved to the module -use Bugzilla::Config qw(:DEFAULT ChmodDataFile $localconfig $datadir); -use Bugzilla::User; -use Bugzilla::Error; - -# XXX - Move this to Bugzilla::Config once code which uses these has moved out -# of globals.pl -do $localconfig; - -1; diff --git a/importxml.pl b/importxml.pl index 6faa172e3..995238be1 100755 --- a/importxml.pl +++ b/importxml.pl @@ -79,7 +79,7 @@ use Bugzilla::Version; use Bugzilla::Component; use Bugzilla::Milestone; use Bugzilla::FlagType; -use Bugzilla::Config qw(:DEFAULT $datadir); +use Bugzilla::Config qw(:DEFAULT); use Bugzilla::BugMail; use Bugzilla::Mailer; use Bugzilla::User; @@ -95,8 +95,6 @@ use Getopt::Long; use Pod::Usage; use XML::Twig; -require "globals.pl"; - # We want to capture errors and handle them here rather than have the Template # code barf all over the place. Bugzilla->batch(1); @@ -30,10 +30,11 @@ use strict; # Include the Bugzilla CGI and general utility library. use lib "."; -require "globals.pl"; use Bugzilla; use Bugzilla::Constants; +use Bugzilla::Config qw(:DEFAULT); +use Bugzilla::Error; use Bugzilla::Update; # Check whether or not the user is logged in @@ -33,8 +33,7 @@ use strict; use lib "."; use Bugzilla; - -require "globals.pl"; +use Bugzilla::Error; Bugzilla->login(); diff --git a/post_bug.cgi b/post_bug.cgi index 4cc00ce6b..92c17b058 100755 --- a/post_bug.cgi +++ b/post_bug.cgi @@ -27,11 +27,12 @@ use strict; use lib qw(.); -require "globals.pl"; use Bugzilla; use Bugzilla::Attachment; use Bugzilla::Constants; +use Bugzilla::Config qw(:DEFAULT); use Bugzilla::Util; +use Bugzilla::Error; use Bugzilla::Bug; use Bugzilla::User; use Bugzilla::Field; diff --git a/process_bug.cgi b/process_bug.cgi index 88377c78e..ee263bfbf 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -48,13 +48,14 @@ my $lastbugid = 0; use lib qw(.); -require "globals.pl"; use Bugzilla; use Bugzilla::Constants; +use Bugzilla::Config qw(:DEFAULT); use Bugzilla::Bug; use Bugzilla::Mailer; use Bugzilla::User; use Bugzilla::Util; +use Bugzilla::Error; use Bugzilla::Field; use Bugzilla::Product; use Bugzilla::Component; @@ -28,14 +28,14 @@ use strict; use lib "."; -require "globals.pl"; - use Bugzilla; use Bugzilla::Bug; use Bugzilla::Constants; +use Bugzilla::Config qw(:DEFAULT); use Bugzilla::Search; use Bugzilla::User; use Bugzilla::Util; +use Bugzilla::Error; use Bugzilla::Product; use Bugzilla::Keyword; use Bugzilla::Field; @@ -27,10 +27,12 @@ use strict; use lib qw(.); -require "globals.pl"; - use Bugzilla; use Bugzilla::Constants; +use Bugzilla::Config qw(:DEFAULT); +use Bugzilla::Util; +use Bugzilla::Error; +use Bugzilla::User; my $user = Bugzilla->login(LOGIN_REQUIRED); diff --git a/relogin.cgi b/relogin.cgi index 418ed3555..566a1df37 100755 --- a/relogin.cgi +++ b/relogin.cgi @@ -25,8 +25,6 @@ use strict; use lib qw(.); -require "globals.pl"; - use Bugzilla; use Bugzilla::Mailer; use Bugzilla::Constants; diff --git a/report.cgi b/report.cgi index c46361f1d..10c532163 100755 --- a/report.cgi +++ b/report.cgi @@ -24,10 +24,10 @@ use strict; use lib "."; -require "globals.pl"; - use Bugzilla; use Bugzilla::Constants; +use Bugzilla::Util; +use Bugzilla::Error; use Bugzilla::Field; my $cgi = Bugzilla->cgi; diff --git a/reports.cgi b/reports.cgi index 5b043c934..09b8dc30e 100755 --- a/reports.cgi +++ b/reports.cgi @@ -37,20 +37,20 @@ use strict; use lib qw(.); -use Bugzilla::Config qw(:DEFAULT $datadir); - -require "globals.pl"; +use Bugzilla; +use Bugzilla::Constants; +use Bugzilla::Config qw(:DEFAULT); +use Bugzilla::Util; +use Bugzilla::Error; eval "use GD"; $@ && ThrowCodeError("gd_not_installed"); eval "use Chart::Lines"; $@ && ThrowCodeError("chart_lines_not_installed"); -my $dir = "$datadir/mining"; +my $dir = bz_locations()->{'datadir'} . "/mining"; my $graph_dir = "graphs"; -use Bugzilla; - # If we're using bug groups for products, we should apply those restrictions # to viewing reports, as well. Time to check the login in that case. my $user = Bugzilla->login(); diff --git a/request.cgi b/request.cgi index 5f90b87cb..c0fb950c9 100755 --- a/request.cgi +++ b/request.cgi @@ -29,8 +29,11 @@ use strict; use lib qw(.); -require "globals.pl"; + use Bugzilla; +use Bugzilla::Config qw(:DEFAULT); +use Bugzilla::Util; +use Bugzilla::Error; use Bugzilla::Flag; use Bugzilla::FlagType; use Bugzilla::User; diff --git a/sanitycheck.cgi b/sanitycheck.cgi index 7a74bfc07..500c6a863 100755 --- a/sanitycheck.cgi +++ b/sanitycheck.cgi @@ -27,11 +27,10 @@ use strict; use lib qw(.); -require "globals.pl"; - use Bugzilla; use Bugzilla::Constants; use Bugzilla::Util; +use Bugzilla::Error; use Bugzilla::User; ########################################################################### diff --git a/show_activity.cgi b/show_activity.cgi index e44bc7054..1eff56f3f 100755 --- a/show_activity.cgi +++ b/show_activity.cgi @@ -26,9 +26,8 @@ use strict; use lib qw(.); -require "globals.pl"; - use Bugzilla; +use Bugzilla::Error; use Bugzilla::Bug; my $cgi = Bugzilla->cgi; diff --git a/show_bug.cgi b/show_bug.cgi index 0efdad09e..2787c5252 100755 --- a/show_bug.cgi +++ b/show_bug.cgi @@ -26,11 +26,10 @@ use lib qw(.); use Bugzilla; use Bugzilla::Constants; +use Bugzilla::Config qw(:DEFAULT); +use Bugzilla::Error; use Bugzilla::User; use Bugzilla::Keyword; - -require "globals.pl"; - use Bugzilla::Bug; my $cgi = Bugzilla->cgi; diff --git a/showdependencygraph.cgi b/showdependencygraph.cgi index ed87b6d90..e11c73ba3 100755 --- a/showdependencygraph.cgi +++ b/showdependencygraph.cgi @@ -26,13 +26,14 @@ use strict; use lib qw(.); use File::Temp; + use Bugzilla; -use Bugzilla::Config qw(:DEFAULT $webdotdir); +use Bugzilla::Constants; +use Bugzilla::Config qw(:DEFAULT); use Bugzilla::Util; +use Bugzilla::Error; use Bugzilla::Bug; -require "globals.pl"; - Bugzilla->login(); my $cgi = Bugzilla->cgi; @@ -100,6 +101,7 @@ sub AddLink { } my $rankdir = $cgi->param('rankdir') || "LR"; +my $webdotdir = bz_locations()->{'webdotdir'}; if (!defined $cgi->param('id') && !defined $cgi->param('doall')) { ThrowCodeError("missing_bug_id"); diff --git a/showdependencytree.cgi b/showdependencytree.cgi index b2cf29a57..220b24926 100755 --- a/showdependencytree.cgi +++ b/showdependencytree.cgi @@ -27,8 +27,9 @@ use strict; use lib qw(.); -require "globals.pl"; + use Bugzilla; +use Bugzilla::Error; use Bugzilla::Bug; my $user = Bugzilla->login(); diff --git a/sidebar.cgi b/sidebar.cgi index 671e44c7d..5619d6b40 100755 --- a/sidebar.cgi +++ b/sidebar.cgi @@ -18,9 +18,9 @@ use strict; use lib "."; -require "globals.pl"; use Bugzilla; +use Bugzilla::Error; Bugzilla->login(); my $cgi = Bugzilla->cgi; diff --git a/summarize_time.cgi b/summarize_time.cgi index 388c82dba..d2b939c82 100755 --- a/summarize_time.cgi +++ b/summarize_time.cgi @@ -24,11 +24,12 @@ use Date::Parse; # strptime use Date::Format; # strftime use Bugzilla; +use Bugzilla::Constants; # LOGIN_* +use Bugzilla::Config qw(:DEFAULT); use Bugzilla::Bug; # EmitDependList use Bugzilla::Util; # trim -use Bugzilla::Constants; # LOGIN_* +use Bugzilla::Error; use Bugzilla::User; # UserInGroup -require "globals.pl"; my $template = Bugzilla->template; my $vars = {}; @@ -360,7 +361,7 @@ sub get_inactive_bugs { WHERE longdescs.bug_id IN ($buglist) $date_bits } . $dbh->sql_group_by('longdescs.bug_id', - 'bugs.short_desc, bugs.bug_status,
+ 'bugs.short_desc, bugs.bug_status, longdescs.bug_when') . qq{ ORDER BY longdescs.bug_when}; $sth = $dbh->prepare($q); diff --git a/t/004template.t b/t/004template.t index 9cbfadf6e..034031c0b 100644 --- a/t/004template.t +++ b/t/004template.t @@ -86,7 +86,7 @@ foreach my $include_path (@include_paths) { INCLUDE_PATH => $include_path , # Need to define filters used in the codebase, they don't # actually have to function in this test, just be defined. - # See globals.pl for the actual codebase definitions. + # See Template.pm for the actual codebase definitions. # Initialize templates (f.e. by loading plugins like Hook). PRE_PROCESS => "global/initialize.none.tmpl", diff --git a/testserver.pl b/testserver.pl index 2211f8bfe..766a2c410 100755 --- a/testserver.pl +++ b/testserver.pl @@ -19,6 +19,7 @@ # issues as possible. use strict; +use lib "."; BEGIN { my $envpath = $ENV{'PATH'}; @@ -26,12 +27,13 @@ BEGIN { $ENV{'PATH'} = $envpath; } -use lib "."; +use Bugzilla::Constants; +use Bugzilla::Config qw(:localconfig); use Socket; -use Bugzilla::Config qw($datadir); -require "globals.pl"; +my $datadir = bz_locations()->{'datadir'}; + eval "require LWP; require LWP::UserAgent;"; my $lwp = $@ ? 0 : 1; @@ -60,15 +62,15 @@ if ($^O !~ /MSWin32/i) { # Determine the numeric GID of $webservergroup my $webgroupnum = 0; -if ($::webservergroup =~ /^(\d+)$/) { +if ($webservergroup =~ /^(\d+)$/) { $webgroupnum = $1; } else { - eval { $webgroupnum = (getgrnam $::webservergroup) || 0; }; + eval { $webgroupnum = (getgrnam $webservergroup) || 0; }; } # Check $webservergroup against the server's GID if ($sgid > 0) { - if ($::webservergroup eq "") { + if ($webservergroup eq "") { print "WARNING \$webservergroup is set to an empty string. That is a very insecure practice. Please refer to the @@ -116,8 +118,9 @@ Check the AddHandler statement in your httpd.conf file.\n"; } # Make sure that webserver is honoring .htaccess files -$::localconfig =~ s~^\./~~; -$url = $ARGV[0] . "/$::localconfig"; +my $localconfig = bz_locations()->{'localconfig'}; +$localconfig =~ s~^\./~~; +$url = $ARGV[0] . "/$localconfig"; $response = fetch($url); if ($response) { print @@ -32,23 +32,17 @@ use lib qw(.); use Bugzilla; use Bugzilla::Constants; use Bugzilla::Util; +use Bugzilla::Error; +use Bugzilla::Token; +use Bugzilla::User; my $cgi = Bugzilla->cgi; my $dbh = Bugzilla->dbh; my $template = Bugzilla->template; my $vars = {}; -# Include the Bugzilla CGI and general utility library. -require "globals.pl"; - Bugzilla->login(LOGIN_OPTIONAL); -# Use the "Bugzilla::Token" module that contains functions for doing various -# token-related tasks. -use Bugzilla::Token; - -use Bugzilla::User; - ################################################################################ # Data Validation / Security Authorization ################################################################################ diff --git a/userprefs.cgi b/userprefs.cgi index 26c4d585f..3288efe65 100755 --- a/userprefs.cgi +++ b/userprefs.cgi @@ -28,12 +28,12 @@ use lib qw(.); use Bugzilla; use Bugzilla::Constants; +use Bugzilla::Config qw(:DEFAULT); use Bugzilla::Search; use Bugzilla::Util; +use Bugzilla::Error; use Bugzilla::User; -require "globals.pl"; - my $template = Bugzilla->template; my $vars = {}; @@ -29,12 +29,13 @@ use lib "."; use Bugzilla; use Bugzilla::Constants; +use Bugzilla::Config qw(:DEFAULT); +use Bugzilla::Util; +use Bugzilla::Error; use Bugzilla::Bug; use Bugzilla::User; use Bugzilla::Product; -require "globals.pl"; - my $cgi = Bugzilla->cgi; my $template = Bugzilla->template; my $vars = {}; @@ -27,10 +27,9 @@ use strict; use lib "."; -require "globals.pl"; use Bugzilla; -use Bugzilla::Config qw(:DEFAULT $datadir); +use Bugzilla::Config qw(:DEFAULT); use Bugzilla::Constants; use Bugzilla::Search; use Bugzilla::User; @@ -106,7 +105,7 @@ if ($fromaddress !~ Param('emailregexp')) { # Check the nomail file for users who should not receive mail my %nomail; -if (open(NOMAIL, '<', "$datadir/nomail")) { +if (open(NOMAIL, '<', bz_locations()->{'datadir'} . "/nomail")) { while (<NOMAIL>) { $nomail{trim($_)} = 1; } diff --git a/whineatnews.pl b/whineatnews.pl index b05c19da0..1fcd67911 100755 --- a/whineatnews.pl +++ b/whineatnews.pl @@ -30,9 +30,8 @@ use strict; use lib '.'; -require "globals.pl"; - use Bugzilla; +use Bugzilla::Config qw(:DEFAULT); use Bugzilla::Mailer; use Bugzilla::Util; |