Changeset 9941


Ignore:
Timestamp:
2005-05-24T16:37:52+12:00 (19 years ago)
Author:
davidb
Message:

Additional support added to gsdlCGI.pm. For example, hunts for java in
a few locations; gsdlhome is checked to see if it ends in a trailing slash,
and this is removed if it is. Some later stages of the code do not perform
correctly if the trailing slash is left there.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/cgi-bin/gsdlCGI.pm

    r7956 r9941  
    6262    # ensure only alpha-numeric plus a few other special chars remain
    6363
    64     $val =~ s/[^[:alnum:]@\.\/\- :]//g if (defined $val);
     64    $val =~ s/[^[:alnum:]@\.\/\- :_]//g if (defined $val);
    6565
    6666    return $val;
     
    145145}
    146146
     147sub get_gsdl_home {
     148    my $self = shift @_;
     149
     150    my $gsdlhome = $self->get_config_info("gsdlhome");
     151
     152    # Unix specific
     153    $gsdlhome =~ s/\/$//; # remove trailing slash
     154
     155    return $gsdlhome;
     156}
    147157
    148158
     
    166176}
    167177
     178sub mkdir
     179{
     180    my $self = shift @_;
     181    my ($dir) = @_;
     182
     183
     184    # Currently, Unix specific, need to generalise to Windows etc.
     185    # => hook in with util.pm ?
     186
     187    my $cmd = "mkdir $dir 2>&1"; # Unix specific
     188
     189    my $output = `$cmd`;
     190
     191    if ($?>0) {
     192    $self->generate_error("Failed to create directory: $dir\n\n$output");
     193    }
     194}
     195
     196sub check_for_java()
     197{
     198    my $self = shift @_;
     199
     200    my $java = "java";
     201
     202    if (defined $ENV{'JAVA_HOME'}) {
     203    my $java_home = $ENV{'JAVA_HOME'};
     204    # Unix specific
     205    $java_home =~ s/\/$//; # remove trailing slash if present
     206    $java = "$java_home/bin/java"; # Unix specific
     207    }
     208    else {
     209    $self->generate_error("Unable to file java");
     210    }
     211
     212
     213    return $java;
     214}
     215
    168216sub unix_cmd
    169217{
Note: See TracChangeset for help on using the changeset viewer.