Ignore:
Timestamp:
2012-12-10T16:37:21+13:00 (11 years ago)
Author:
ak19
Message:

When a GS2 collection contains both collect.cfg and collectionConfig.xml (as advanced beatles does) the old code used to end up reading in the GS3 collectionConfig.xml instead of the GS2 collect.cfg and set the GS_mode to GS3. Now colcfg::get_collect_cfg_name takes the gs_mode (instead of determining this and returning it) and works out the collectcfg file name for the gs_mode. That means that the calling functions now need to work out the gs_mode. They do so by setting the gs_mode to gs3 if the site flag is present in the commandline, if not then it defaults to gs2. So from now on, the site flag must be specified for GS3 collections.

File:
1 edited

Legend:

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

    r25677 r26567  
    261261
    262262# method to check for filename of collect.cfg, and gs mode.
    263 sub get_collect_cfg_name {
     263sub get_collect_cfg_name_old {
    264264    my ($out) = @_;
    265265
     
    288288    (&gsprintf($out, "{common.cannot_find_cfg_file}\n", $configfilename) && die);
    289289}
     290
     291# method to check for filename of collect.cfg
     292# needs to be given gs_version, since we can have a GS2 collection ported into
     293# GS3 which could potentially have collect.cfg AND collectionConfig.xml
     294# in which case the older version of this subroutine (get_collect_cfg_name_old)
     295# will return the wrong answer for the gs version we're using.
     296sub get_collect_cfg_name {
     297    my ($out, $gs_version) = @_;
     298
     299    # First check if there's a
     300    # gsdl/collect/COLLECTION/custom/COLLECTION/etc/custom.cfg file. This
     301    # customization was added for DLC by Stefan, 30/6/2007.
     302    my $configfilename;
     303
     304    if($gs_version eq "gs2") {
     305    $configfilename = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "custom", $ENV{'GSDLCOLLECTION'}, "etc", "custom.cfg");
     306   
     307    if (-e $configfilename) {
     308        return $configfilename;
     309    }
     310    }
     311
     312    # Check if there is a collectionConfig.xml file if it's gs3
     313    if($gs_version eq "gs3") {
     314    $configfilename = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "etc", "collectionConfig.xml");   
     315    if (-e $configfilename) {
     316        return $configfilename;
     317    }
     318    }
     319
     320    # Check if there is a collect.cfg file in the usual place for gs2.
     321    if($gs_version eq "gs2") {
     322    $configfilename = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "etc", "collect.cfg");
     323    if (-e $configfilename) {
     324        return $configfilename;
     325    }
     326    }
     327
     328    # Error. No collection configuration file.
     329    (&gsprintf($out, "{common.cannot_find_cfg_file}\n", $configfilename) && die);
     330}
     331
    290332
    291333
Note: See TracChangeset for help on using the changeset viewer.