Commit c4111734 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 282121: Remove globals.pl from scripts that no longer use it - Patch by…

Bug 282121: Remove globals.pl from scripts that no longer use it - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=myk
parent e6f88531
......@@ -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);
......
......@@ -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+";
......
......@@ -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
################################################################################
......
......@@ -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.
......
......@@ -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;
......
......@@ -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;
......
......@@ -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();
......
......@@ -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) {
&regenerate_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;
......
......@@ -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;
......
......@@ -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";
......
......@@ -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";
......
......@@ -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"; }
}
}
}
......@@ -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;
......
......@@ -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;
......
......@@ -25,7 +25,6 @@ use strict;
use lib qw(.);
require "globals.pl";
use Bugzilla;
use Bugzilla::Constants;
use Bugzilla::BugMail;
......
......@@ -13,22 +13,20 @@
#
# The Original Code is the LDAP to Bugzilla User Sync Tool.
#
# The Initial Developer of the Original Code is Andreas Hfler.
# Portions created by Andreas Hfler are Copyright (C) 2003
# Andreas Hfler. 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 Hfler <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;
......
......@@ -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;
......
......@@ -27,7 +27,6 @@
use strict;
use lib ".";
require "globals.pl";
use Bugzilla;
use Bugzilla::Field;
......
......@@ -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();
......
......@@ -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;
......
......@@ -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}) {
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -12,18 +12,17 @@
# Matt Masson <matthew@zeroknowledge.com>
#
# Contributors : Gavin Shelley <bugzilla@chimpychompy.org>
# Frdric 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;
......
......@@ -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);
......
......@@ -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;
......
......@@ -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 = {};
......
......@@ -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;
......
......@@ -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
......
......@@ -21,7 +21,7 @@
# Contributor(s): Holger Schurig <holgerschurig@nikocity.de>
# Terry Weissman <terry@mozilla.org>
# Gavin Shelley <bugzilla@chimpychompy.org>
# Frdric 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;
......
......@@ -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);
......
......@@ -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);
......
# -*- 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;
......@@ -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();
......
......@@ -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;
......
......@@ -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);
......
......@@ -25,8 +25,6 @@
use strict;
use lib qw(.);
require "globals.pl";
use Bugzilla;
use Bugzilla::Mailer;
use Bugzilla::Constants;
......
......@@ -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;
......
......@@ -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();
......
......@@ -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;
......
......@@ -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;
###########################################################################
......
......@@ -26,9 +26,8 @@ use strict;
use lib qw(.);
require "globals.pl";
use Bugzilla;
use Bugzilla::Error;
use Bugzilla::Bug;
my $cgi = Bugzilla->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;
......
......@@ -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");
......
......@@ -27,8 +27,9 @@
use strict;
use lib qw(.);
require "globals.pl";
use Bugzilla;
use Bugzilla::Error;
use Bugzilla::Bug;
my $user = Bugzilla->login();
......
......@@ -18,9 +18,9 @@
use strict;
use lib ".";
require "globals.pl";
use Bugzilla;
use Bugzilla::Error;
Bugzilla->login();
my $cgi = Bugzilla->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);
......
......@@ -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",
......
......@@ -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
################################################################################
......
......@@ -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;
}
......
......@@ -30,9 +30,8 @@
use strict;
use lib '.';
require "globals.pl";
use Bugzilla;
use Bugzilla::Config qw(:DEFAULT);
use Bugzilla::Mailer;
use Bugzilla::Util;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment