From da857afa089e79ad16fb833dd1ffe397055fd892 Mon Sep 17 00:00:00 2001 From: "bbaetz%acm.org" <> Date: Sat, 22 Nov 2003 11:50:36 +0000 Subject: Bug 208604 - Make data/template dir locations configurable --- contrib/bug_email.pl | 25 ++++++++++++++----------- contrib/bugzilla_email_append.pl | 18 +++++++++++------- 2 files changed, 25 insertions(+), 18 deletions(-) (limited to 'contrib') diff --git a/contrib/bug_email.pl b/contrib/bug_email.pl index a1e537cfe..e26b9a68c 100755 --- a/contrib/bug_email.pl +++ b/contrib/bug_email.pl @@ -37,7 +37,7 @@ # # You need to work with bug_email.pl the MIME::Parser installed. # -# $Id: bug_email.pl,v 1.16 2003/08/22 14:59:13 justdave%syndicomm.com Exp $ +# $Id: bug_email.pl,v 1.17 2003/11/22 03:50:41 bbaetz%acm.org Exp $ ############################################################### # 02/12/2000 (SML) @@ -69,12 +69,15 @@ use strict; use MIME::Parser; -chdir '..'; # this script lives in contrib -push @INC, "contrib/."; -push @INC, "."; +BEGIN { + chdir '..'; # this script lives in contrib + push @INC, "contrib/."; + push @INC, "."; +} require "globals.pl"; -require "BugzillaEmail.pm"; +use BugzillaEmail; +use Bugzilla::Config qw(:DEFAULT $datadir); use lib "."; use lib "../"; @@ -137,8 +140,8 @@ sub storeAttachments( $$ ) print "Error while reading attachment $decoded_file!\n"; next; } - # print "unlinking data/mimedump-tmp/$decoded_file"; - # unlink "data/mimedump-tmp/$decoded_file"; + # print "unlinking $datadir/mimedump-tmp/$decoded_file"; + # unlink "$datadir/mimedump-tmp/$decoded_file"; } else { # data is in the scalar $data = $decoded_file; @@ -248,7 +251,7 @@ sub Reply( $$$$ ) { die "Cannot find sender-email-address" unless defined( $Sender ); if( $test ) { - open( MAIL, ">>data/bug_email_test.log" ); + open( MAIL, '>>', "$datadir/bug_email_test.log" ); } else { open( MAIL, "| /usr/sbin/sendmail -t" ); @@ -697,10 +700,10 @@ my $parser = new MIME::Parser; # Create and set the output directory: # FIXME: There should be a $BUGZILLA_HOME variable (SML) -(-d "data/mimedump-tmp") or mkdir "data/mimedump-tmp",0755 or die "mkdir: $!"; -(-w "data/mimedump-tmp") or die "can't write to directory"; +(-d "$datadir/mimedump-tmp") or mkdir "$datadir/mimedump-tmp",0755 or die "mkdir: $!"; +(-w "$datadir/mimedump-tmp") or die "can't write to directory"; -$parser->output_dir("data/mimedump-tmp"); +$parser->output_dir("$datadir/mimedump-tmp"); # Read the MIME message: my $entity = $parser->read(\*STDIN) or die "couldn't parse MIME stream"; diff --git a/contrib/bugzilla_email_append.pl b/contrib/bugzilla_email_append.pl index 2ed39c482..da098e66c 100755 --- a/contrib/bugzilla_email_append.pl +++ b/contrib/bugzilla_email_append.pl @@ -31,11 +31,15 @@ use strict; use MIME::Parser; -chdir ".."; # this script lives in contrib, change to main -push @INC, "contrib"; -push @INC, "."; # this script lives in contrib +BEGIN { + chdir ".."; # this script lives in contrib, change to main + push @INC, "contrib"; + push @INC, "."; # this script lives in contrib +} + require "globals.pl"; -require "BugzillaEmail.pm"; +use BugzillaEmail; +use Bugzilla::Config qw(:DEFAULT $datadir); # Create a new MIME parser: my $parser = new MIME::Parser; @@ -44,10 +48,10 @@ my $Comment = ""; # Create and set the output directory: # FIXME: There should be a $BUGZILLA_HOME variable (SML) -(-d "data/mimedump-tmp") or mkdir "data/mimedump-tmp",0755 or die "mkdir: $!"; -(-w "data/mimedump-tmp") or die "can't write to directory"; +(-d "$datadir/mimedump-tmp") or mkdir "$datadir/mimedump-tmp",0755 or die "mkdir: $!"; +(-w "$datadir/mimedump-tmp") or die "can't write to directory"; -$parser->output_dir("data/mimedump-tmp"); +$parser->output_dir("$datadir/mimedump-tmp"); # Read the MIME message: my $entity = $parser->read(\*STDIN) or die "couldn't parse MIME stream"; -- cgit v1.2.3-24-g4f1b