Skip to Content.
Sympa Menu

devel - [sympa-dev] Added "Upload File" to add_request(Multi Add), having trouble

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: <address@concealed>
  • To: address@concealed
  • Subject: [sympa-dev] Added "Upload File" to add_request(Multi Add), having trouble
  • Date: Thu, 20 Dec 2007 23:22:52 +0100

Hello,

The code I wrote below works on small files but I get server errors when I
test
it with large files.

I tried to upload about 65,000 emails and the web page gets directed to a
"server error" page. Eventually all the emails get added to the list but I
don't know if there is a way to keep that error page from displaying?

Is there a way to kick off my system command (cat /tmp/my_import_file |
/usr/lib/sympa/bin/sympa.pl --address@concealed) and have the script
return to a page that says the upload is in progress?

Thanks for your time,
Jason Holland

Here is the code I added to wwsympa.pl in sub do_add {}
##########################
if ($in{'multi_upload_file'}) {
###\\\ START Upload Logic ///###

my $fname = $query->param('multi_upload_file');

# name of the file, without path
if ($fname =~ /([^\/\\]+)$/) {
$fname = $1;
}

$fname = $fname . '_' . time;

my $tempdir = "/tmp";

my $fh = $query->upload('multi_upload_file');
unless (open FILE, ">$tempdir/$fname") {
&report::reject_report_web('intern','cannot_upload',{'path' =>
"$tempdir/$fname"},$param->{'action'},$list,$param->{'user'}{'email'},$robot);
&wwslog('err',"do_add: Cannot open file $tempdir/$fname : $!");
return undef;
}
while (<$fh>) {
print FILE;
}
close FILE;

chmod 0777, "$tempdir/$fname";

# import data into the database

my $list_name = $param->{'list'} . '@' . $list->{'admin'}{'host'};

# This is how the import command line should look:
#cat /tmp/my_import_file | /usr/lib/sympa/bin/sympa.pl
--address@concealed
my $importcmd = "cat $tempdir/$fname | /usr/lib/sympa/bin/sympa.pl
--import=$list_name";

#&wwslog('info', "do_add: import command > $importcmd");

system $importcmd;

&report::notice_report_web('add_performed',{},'');
return $in{'previous_action'} || 'review';

###\\\ END Upload Logic ///###
}elsif ($in{'dump'}) {
##########################



Archive powered by MHonArc 2.6.19+.

Top of Page