Changeset 10252 for trunk/gsdl


Ignore:
Timestamp:
2005-07-19T10:50:57+12:00 (19 years ago)
Author:
mdewsnip
Message:

Unzip.java now takes the zip file path and the directory to unzip into as arguments. This more general functionality is necessary for the West Yorkshire stuff.

The upload script has been changed accordingly, and tidied up a bit.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/cgi-bin/upload

    r10226 r10252  
    4141    $dir = "" if (($dir eq ".") || ($dir =~ m/^\.\./));
    4242
    43     my $zip_content = $gsdl_cgi->clean_param("zip");
    44     my $zip_fname = "$col.zip";
    45 
    46     if ($col =~ m/^\//) {
     43    if ($col =~ m/^\//) {
    4744    # leading / at start denotes special "cols" such as "/tmp"
    4845    $gsdl_cgi->checked_chdir("$gsdlhome");
     
    7471    }
    7572
    76     if (open(ZOUT,"> $zip_fname")) {
     73    my $zip_file_name = $col . ".zip";
     74    my $zip_file_path = &util::filename_cat($full_col_dir, $zip_file_name);
     75    if (open(ZOUT, ">$zip_file_path")) {
    7776    binmode(ZOUT);
    7877
     
    9695                        "SignedGatherer.jar");
    9796
    98     my $java_cmd = "$java -classpath \"$classpath\" org.greenstone.gatherer.util.Unzip \"$gsdlhome\" \"$zip_fname\"";
     97    my $java_cmd = "$java -classpath \"$classpath\" org.greenstone.gatherer.util.Unzip \"$zip_file_path\" \"$full_col_dir\"";
     98    $gsdl_cgi->generate_ok_message("Command: $java_cmd\n");
    9999
    100100    my $java_output = `$java_cmd`;
    101101   
    102102    my $status = $?;
    103     unlink "$zip_fname";
     103    unlink "$zip_file_path";
    104104
    105     if ($status>0) {
     105    if ($status > 0) {
    106106        $status = $status/256;
    107107        my $exit_status = "Exit status: $status\n";
     
    113113    }
    114114    else {
    115     $gsdl_cgi->generate_error("unable to open $zip_fname");
     115    $gsdl_cgi->generate_error("unable to open $zip_file_path");
    116116    }
    117117}
Note: See TracChangeset for help on using the changeset viewer.