From 7f446ae898dc9f9fe8d97fdd01f0e39ba7676867 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Tue, 20 Jun 2006 14:55:39 +0000 Subject: Bug 313531: Move 'use Bugzilla;' out of globals.pl - Patch by Frédéric Buclin r=mkanat a=myk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bugzilla/Chart.pm | 9 +++++---- buglist.cgi | 2 ++ customfield.pl | 1 + editparams.cgi | 1 + editversions.cgi | 1 + editwhines.cgi | 1 + globals.pl | 12 ------------ index.cgi | 1 + query.cgi | 1 + quips.cgi | 1 + sanitycheck.cgi | 2 ++ sidebar.cgi | 3 ++- testserver.pl | 16 +++++++++++----- whine.pl | 1 + 14 files changed, 30 insertions(+), 22 deletions(-) diff --git a/Bugzilla/Chart.pm b/Bugzilla/Chart.pm index a0853d508..c878186bc 100644 --- a/Bugzilla/Chart.pm +++ b/Bugzilla/Chart.pm @@ -36,6 +36,7 @@ use Bugzilla::Util; use Bugzilla::Series; use Date::Format; +use Date::Parse; sub new { my $invocant = shift; @@ -99,7 +100,7 @@ sub init { # Make sure the dates are ones we are able to interpret foreach my $date ('datefrom', 'dateto') { if ($self->{$date}) { - $self->{$date} = &::str2time($self->{$date}) + $self->{$date} = str2time($self->{$date}) || &::ThrowUserError("illegal_date", { date => $self->{$date}}); } } @@ -223,7 +224,7 @@ sub readData { my $datefrom = $dbh->selectrow_array("SELECT MIN(series_date) " . "FROM series_data " . "WHERE series_id IN ($series_ids)"); - $datefrom = &::str2time($datefrom); + $datefrom = str2time($datefrom); if ($self->{'datefrom'} && $self->{'datefrom'} > $datefrom) { $datefrom = $self->{'datefrom'}; @@ -232,7 +233,7 @@ sub readData { my $dateto = $dbh->selectrow_array("SELECT MAX(series_date) " . "FROM series_data " . "WHERE series_id IN ($series_ids)"); - $dateto = &::str2time($dateto); + $dateto = str2time($dateto); if ($self->{'dateto'} && $self->{'dateto'} < $dateto) { $dateto = $self->{'dateto'}; @@ -420,7 +421,7 @@ sub generateDateProgression { $dateto += (2 * $oneday) / 3; while ($datefrom < $dateto) { - push (@progression, &::time2str("%Y-%m-%d", $datefrom)); + push (@progression, time2str("%Y-%m-%d", $datefrom)); $datefrom += $oneday; } diff --git a/buglist.cgi b/buglist.cgi index 8465cae32..5d56c2255 100755 --- a/buglist.cgi +++ b/buglist.cgi @@ -44,6 +44,8 @@ use Bugzilla::Product; use Bugzilla::Keyword; use Bugzilla::Field; +use Date::Parse; + # Include the Bugzilla CGI and general utility library. require "globals.pl"; diff --git a/customfield.pl b/customfield.pl index 106c60582..101bac880 100755 --- a/customfield.pl +++ b/customfield.pl @@ -29,6 +29,7 @@ use strict; use lib "."; require "globals.pl"; +use Bugzilla; use Bugzilla::Field; use Getopt::Long; diff --git a/editparams.cgi b/editparams.cgi index 487208b47..bb8fa591b 100755 --- a/editparams.cgi +++ b/editparams.cgi @@ -25,6 +25,7 @@ use strict; use lib "."; +use Bugzilla; use Bugzilla::Constants; use Bugzilla::Config qw(:DEFAULT :admin :params $datadir); use Bugzilla::Config::Common; diff --git a/editversions.cgi b/editversions.cgi index c060657d2..dec675b5b 100755 --- a/editversions.cgi +++ b/editversions.cgi @@ -33,6 +33,7 @@ use lib "."; require "globals.pl"; +use Bugzilla; use Bugzilla::Constants; use Bugzilla::Config qw(:DEFAULT $datadir); use Bugzilla::Product; diff --git a/editwhines.cgi b/editwhines.cgi index 8086862d2..0db643552 100755 --- a/editwhines.cgi +++ b/editwhines.cgi @@ -30,6 +30,7 @@ use strict; use lib "."; require "globals.pl"; +use Bugzilla; use Bugzilla::Constants; use Bugzilla::User; use Bugzilla::Group; diff --git a/globals.pl b/globals.pl index 2654c4a1f..146b51550 100644 --- a/globals.pl +++ b/globals.pl @@ -42,16 +42,4 @@ use Bugzilla::Error; # of globals.pl do $localconfig; -use DBI; - -use Date::Format; # For time2str(). -use Date::Parse; # For str2time(). - -# Use standard Perl libraries for cross-platform file/directory manipulation. -use File::Spec; - -############# Live code below here (that is, not subroutine defs) ############# - -use Bugzilla; - 1; diff --git a/index.cgi b/index.cgi index 27f26083d..a409fe951 100755 --- a/index.cgi +++ b/index.cgi @@ -32,6 +32,7 @@ use strict; use lib "."; require "globals.pl"; +use Bugzilla; use Bugzilla::Constants; use Bugzilla::Update; diff --git a/query.cgi b/query.cgi index 1ab53a9b8..67fc96362 100755 --- a/query.cgi +++ b/query.cgi @@ -30,6 +30,7 @@ use lib "."; require "globals.pl"; +use Bugzilla; use Bugzilla::Bug; use Bugzilla::Constants; use Bugzilla::Search; diff --git a/quips.cgi b/quips.cgi index b2fd482bc..fa421c534 100755 --- a/quips.cgi +++ b/quips.cgi @@ -29,6 +29,7 @@ use lib qw(.); require "globals.pl"; +use Bugzilla; use Bugzilla::Constants; my $user = Bugzilla->login(LOGIN_REQUIRED); diff --git a/sanitycheck.cgi b/sanitycheck.cgi index b887deeff..7a74bfc07 100755 --- a/sanitycheck.cgi +++ b/sanitycheck.cgi @@ -28,6 +28,8 @@ use strict; use lib qw(.); require "globals.pl"; + +use Bugzilla; use Bugzilla::Constants; use Bugzilla::Util; use Bugzilla::User; diff --git a/sidebar.cgi b/sidebar.cgi index 2f7743ebb..671e44c7d 100755 --- a/sidebar.cgi +++ b/sidebar.cgi @@ -20,8 +20,9 @@ use strict; use lib "."; require "globals.pl"; -Bugzilla->login(); +use Bugzilla; +Bugzilla->login(); my $cgi = Bugzilla->cgi; my $template = Bugzilla->template; diff --git a/testserver.pl b/testserver.pl index 0d1d08ba5..2211f8bfe 100755 --- a/testserver.pl +++ b/testserver.pl @@ -18,17 +18,23 @@ # as its only argument. It attempts to troubleshoot as many installation # issues as possible. +use strict; + +BEGIN { + my $envpath = $ENV{'PATH'}; + require Bugzilla; + $ENV{'PATH'} = $envpath; +} + +use lib "."; + use Socket; use Bugzilla::Config qw($datadir); -my $envpath = $ENV{'PATH'}; -use lib "."; -use strict; + require "globals.pl"; eval "require LWP; require LWP::UserAgent;"; my $lwp = $@ ? 0 : 1; -$ENV{'PATH'}= $envpath; - if ((@ARGV != 1) || ($ARGV[0] !~ /^https?:/)) { print "Usage: $0 \n"; diff --git a/whine.pl b/whine.pl index 9f5a9acfe..551defe49 100755 --- a/whine.pl +++ b/whine.pl @@ -29,6 +29,7 @@ use strict; use lib "."; require "globals.pl"; +use Bugzilla; use Bugzilla::Config qw(:DEFAULT $datadir); use Bugzilla::Constants; use Bugzilla::Search; -- cgit v1.2.3-24-g4f1b