Ignore:
Timestamp:
2017-03-14T20:10:07+13:00 (7 years ago)
Author:
ak19
Message:

Found servercontrol::get_library_url() largely duplicated in util.pm as get_fullgreenstone_url_prefix(). Merging the two functions. Tested that solr-jdbm-demo collection still rebuilds (with and without tomcat running, and with and without port change between sessions).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/util.pm

    r31517 r31518  
    12271227sub get_full_greenstone_url_prefix
    12281228{   
     1229    my ($gs_mode, $lib_name) = @_;
     1230   
    12291231    # if already set on a previous occasion, just return that
    12301232    # (Don't want to keep repeating this: cost of re-opening and scanning files.)
    12311233    return $ENV{'FULL_GREENSTONE_URL_PREFIX'} if($ENV{'FULL_GREENSTONE_URL_PREFIX'});
    12321234
    1233     my $gs_mode = ($ENV{'GSDL3SRCHOME'}) ? "gs3" : "gs2";
     1235    # set gs_mode if it was not passed in (servercontrol.pm would pass it in, any other callers won't)
     1236    $gs_mode = ($ENV{'GSDL3SRCHOME'}) ? "gs3" : "gs2" unless defined $gs_mode;
    12341237   
    12351238    my $url = undef;   
     
    13281331        }
    13291332        close(PIN);
     1333       
     1334        if (defined $lib_name) { # url won't be undef now
     1335            # replace the servlet_name portion of the url found, with the given library_name
     1336            $url =~ s@/[^/]*$@/$lib_name@;
     1337        }
    13301338    } else {
    13311339        print STDERR "util::get_full_greenstone_url_prefix() failed to run $perl_command to work out library URL for $gs_mode\n";
Note: See TracChangeset for help on using the changeset viewer.