From c41117346f48774e5c6731303702b5ce98db517b Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Wed, 21 Jun 2006 07:44:46 +0000 Subject: Bug 282121: Remove globals.pl from scripts that no longer use it - 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 --- contrib/BugzillaEmail.pm | 3 +- contrib/bug_email.pl | 17 ++++---- contrib/bugzilla_email_append.pl | 85 ++++++++++++++++++++-------------------- contrib/gnats2bz.pl | 2 - contrib/sendbugmail.pl | 5 ++- contrib/sendunsentbugmail.pl | 1 - contrib/syncLDAP.pl | 12 +++--- 7 files changed, 61 insertions(+), 64 deletions(-) (limited to 'contrib') 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 +# Contributor(s): Andreas Höfler # 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; -- cgit v1.2.3-24-g4f1b