[Bio] / Clearinghouse / pkg_upload.pl Repository:
ViewVC logotype

View of /Clearinghouse/pkg_upload.pl

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1.6 - (download) (as text) (annotate)
Wed Apr 27 17:46:11 2005 UTC (14 years, 5 months ago) by olson
Branch: MAIN
CVS Tags: myrast_33, HEAD
Changes since 1.5: +3 -2 lines
Pull the db stuff out into Clearinghouse::ch_database. This module exports db_init(). It also initializes the
contents of CH_Config to have the database stuff from FIG_Config if it's not already set. This gives us
a good default behavior while allowing modification. For instance, on my laptop which has a mysql
database for the normal SEED, the CH_Config looks like this:

package CH_Config;

$dbms = "Pg";
$db = "clearinghouse";
$dbuser = "olson";
$dbpass = "";
$dbport = "10101";
$service_url = "http://localhost/FIG/clearinghouse_services.cgi";
$dir = "/Users/olson/chdir";

Do some misc cleanup on the services.

Add gen_seed_tables, which generates a postgres input file (suitable for loading with
'psql -f load_seed.sql') for the genomes in the current seed.

use strict;
use Data::Dumper;
use FIG;
use CH_Config;
use FIG_Config;
use CGI;
use Clearinghouse::ch_database;

use File::Temp qw/ :mktemp /;

my $c = new CGI();

my $id = $c->param('file_id');
my $size = $c->param('file_size');
my $file = $c->param('file');

my $path = mktemp("$CH_Config::dir/clgXXXX");
open(LOCAL, ">$path") or die $!;
while(<$file>) {
    print LOCAL $_;


#test for successful upload
if (! -f $path) {
	print $c->header(-status => '500 upload failed');

if ($size != -s $path) {
	print $c->header(-status => '500 upload incomplete');

#now update name into the db

my $db = db_init();

my $res = $db->SQL(q{UPDATE package_location SET pathname = ? where id = ?}, undef, $path, $id);

if (!$res) {
	print $c->header("500 DB Update error".$db->{_dbh}->errstr);

print $c->header();
print "Successful upload\n"

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3