Changeset 1175


Ignore:
Timestamp:
2000-05-19T16:54:39+12:00 (24 years ago)
Author:
sjboddie
Message:

finished off on tidying up end-user collection building

Location:
trunk/gsdl/cgi-bin
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/cgi-bin/webpage_buildcol.pl

    r1145 r1175  
    3232#   an already running cgi program.
    3333
    34 #use Fcntl ':flock';
     34use Fcntl ':flock';
    3535use File::Basename;
    3636use GSDLHOME;
     
    6161    if (open(TMPOUT,">$full_tmpname"))
    6262    {
    63 #   if (flock(TMPOUT,LOCK_EX))
    64 #   {
     63    if (flock(TMPOUT,LOCK_EX))
     64    {
    6565        print TMPOUT $text;
    6666        close(TMPOUT);
    67 #       flock(TMPOUT,LOCK_UN);
    68 #   }
    69 #   else
    70 #   {
     67        flock(TMPOUT,LOCK_UN);
     68    }
     69    else
     70    {
    7171        # Problem locking file
    72 #       my $mess = "Unable to lock temporary communication file:";
    73 #       $mess .= " $full_tmpname";
    74 #       print STDERR "$mess\n";
    75 #       return;
    76 #   }
     72        my $mess = "Unable to lock temporary communication file:";
     73        $mess .= " $full_tmpname";
     74        print STDERR "$mess\n";
     75        return;
     76    }
    7777    }
    7878    else
     
    117117    if ($copy_dir =~ m/^yes$/i)
    118118    {
    119         my $download_cmd = "";
     119        my $download_cmd = "perl " . &util::filename_cat ($ENV{'GSDLHOME'}, "bin", "script");
    120120        my $file_or_url  = $building_cfg_text->{'building'}->{'fileorurl'};
    121121       
     
    123123        {
    124124        # run urlcopy.pl to download files
    125         $download_cmd = "urlcopy.pl ";
     125        $download_cmd = " urlcopy.pl ";
    126126        my @urls = split("\n",$input_dir);
    127127        my $u;
     
    138138        $input_dir =~ s/^\s+//;
    139139        $input_dir =~ s/\s+$//;
    140         $download_cmd = "filecopy.pl $input_dir";
     140        $download_cmd = " filecopy.pl $input_dir";
    141141        }
    142142       
     
    332332    = &util::filename_cat($full_dirname,"etc","collect.cfg");
    333333
    334     if (open(CFGIN,"<$cfg_filename"))
    335     {
    336 #   if (flock(CFGIN,LOCK_EX))
    337 #   {
    338         # do requested stages for building
    339         my $result = do_build($full_dirname,$dirname,$args);
    340         flock(CFGIN,LOCK_UN);
    341         close(CFGIN);
    342         return if ($result ne "success");
    343 #   }
    344 #   else
    345 #   {
    346         # Problem locking file
    347 #       my $mess = "Unable to lock configuration file: $cfg_filename";
    348 #       print STDERR "$mess\n";
    349 #       return;
    350 #   }
    351     }
    352 
    353 #    my $mess_url = "$args->{'httpbuild'}&bca=mess&bc1dirname=$dirname";
    354 #    print "Location: $mess_url&head=_headdone_&mess=_messdonebuildcol_\n\n";
    355 #    print "done\n"; # in tmp file
     334    # do requested stages for building
     335    my $result = do_build($full_dirname,$dirname,$args);
     336    return if ($result ne "success");
     337
     338    my $mess_url = "$args->{'httpbuild'}&bca=mess&bc1dirname=$dirname";
     339    print "Location: $mess_url&head=_headdone_&mess=_messdonebuildcol_\n\n";
     340    print "done\n"; # in tmp file
    356341}
    357342
  • trunk/gsdl/cgi-bin/webpage_buildstatus.pl

    r1145 r1175  
    3131use CGI;
    3232use GSDLHOME;
    33 use Fcntl ':flock';
    3433
    3534require util;
     
    8685    $bc1finished = 1 if ($mess eq "Done");
    8786    $bc1finished = -1 if ($mess =~ m/^Error:/);
     87    # escape backslashes so they don't vanish from printed filenames
     88    $mess =~ s/\\/\\\\/g;
    8889    &webpageutil::status_location($args,$mess,$tmpname,$bc1finished);
    8990
     
    101102
    102103&main();
    103 
    104 
    105 
    106 
    107 
  • trunk/gsdl/cgi-bin/webpage_delcol.pl

    r1145 r1175  
    3030use CGI;
    3131use GSDLHOME;
    32 use Fcntl ':flock';
    3332
    3433require util;
     
    7372    &util::rm_r($col_dir);
    7473
    75     # delete from collections.txt
    76     my $collist_filename
    77         = &util::filename_cat($ENV{'GSDLHOME'},"etc","collections.txt");
    78     if (open(CLIN,"<$collist_filename"))
    79     {
    80         if (flock(CLIN,LOCK_EX))
    81         {
    82         my @keep_dirnames = ();
    83         while (defined($line=<CLIN>))
    84         {
    85             chop $line;
    86             push(@keep_dirnames,$line) if ($line ne $dirname);
    87         }
    88         close(CLIN);
    89 
    90         if (open(CLIN,">$collist_filename"))
    91         {
    92             print CLIN join("\n",@keep_dirnames), "\n";
    93         }
    94 
    95         flock(CLIN,LOCK_UN);
    96         close(CLIN);
    97         }
    98         else
    99         {
    100         # problem locking file
    101         my $mess = "Unable to lock collection list configuration";
    102         $mess .= " file: $collist_filename";
    103         &webpageutil::error_location($args,$mess);
    104         return;
    105         }
    106     }
    107     else
    108     {
    109         # problem opening file for reading in
    110 
    111         my $mess = "Unable to open for input the collection list";
    112         $mess .= " configuration file: $collist_filename";
    113         &webpageutil::error_location($args,$mess);
    114         return;
    115     }
    11674    }
    11775    elsif ($delete_area eq "import")
  • trunk/gsdl/cgi-bin/webpage_mkcol.pl

    r1171 r1175  
    3030use CGI;
    3131use GSDLHOME;
    32 #use Fcntl ':flock';
     32use Fcntl ':flock';
    3333
    3434require util;
     
    179179        if (open(CFGAPP,">>$cfg_filename"))
    180180        {
    181 #       if (flock(CFGAPP,LOCK_EX))
    182 #       {
     181        if (flock(CFGAPP,LOCK_EX))
     182        {
    183183            print CFGAPP "\n";
    184184
     
    191191            print CFGAPP "building\tcopydir\t\t$copy_dir\n";
    192192            print CFGAPP "building\tingsdlarea\t$in_gsdl_area\n";
    193 #           flock(CFGAPP,LOCK_UN);
     193            flock(CFGAPP,LOCK_UN);
    194194            close(CFGAPP);
    195 #       }
    196 #       else
    197 #       {
     195        }
     196        else
     197        {
    198198            # problem locking file
    199 #           my $mess = "Unable to lock collection";
    200 #           $mess .= " configuration file: $cfg_filename";
    201 #           &webpageutil::error_location($args,$mess);
    202 #           close(CFGAPP);
    203 #           return;
    204 #       }
     199            my $mess = "Unable to lock collection";
     200            $mess .= " configuration file: $cfg_filename";
     201            &webpageutil::error_location($args,$mess);
     202            close(CFGAPP);
     203            return;
     204        }
    205205        }
    206206        else
     
    212212        return;
    213213        }
    214 
    215 
    216         # append dirname to end of collection config file
    217         my $collist_filename
    218         = &util::filename_cat($ENV{'GSDLHOME'},"etc","collections.txt");
    219         if (open(CLAPP,">>$collist_filename"))
    220         {
    221 #       if (flock(CLAPP,LOCK_EX))
    222 #       {
    223             print CLAPP "$unique_dirname\n";
    224 #           flock(CLAPP,LOCK_UN);
    225             close(CLAPP);
    226 #       }
    227 #       else
    228 #       {
    229             # problem locking file
    230 #           my $mess = "Unable to lock collection list";
    231 #           $mess .= " configuration file: $collist_filename";
    232 #           &webpageutil::error_location($args,$mess);
    233 #           close(CLAPP);
    234 #           return;
    235 #       }
    236         }
    237         else
    238         {
    239         # problem
    240         my $mess = "Unable to append to collection list";
    241         $mess .= " configuration file: $collist_filename";
    242         &webpageutil::error_location($args,$mess);
    243         return;
    244         }
    245        
    246214    }
    247215    else
Note: See TracChangeset for help on using the changeset viewer.