Ignore:
Timestamp:
09/01/10 19:38:21 (11 years ago)
Author:
ak19
Message:

Code for loading collections from the default Greenstone collect directory is already duplicated in new method load_collections_from_collectdir, so it's now being called. There were some minor changes to make the references to collecthome consistent for the default GS collectdir case. Also fixed the new method load_collections_from_collectdir method so that it works with collect groups (just as the code for the standard collect dir has been working for collectgroups), by not checking for the existence of build_cfg, since colgroups don't have this but ought to be loaded on the home page nevertheless.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/runtime-src/src/w32server/cgiwrapper.cpp

    r22822 r22833  
    393393        // the collection appears at this gsdlhome only because it's gdbm
    394394        // file is installed here -- it's real gdbm will therefore be
    395         // somewhere else).
    396         text_t build_cfg = filename_cat (my_gsdl_collecthome,
    397                          *colhere, "index", "build.cfg");
    398                          
    399         if (file_exists (build_cfg)) {
     395        // somewhere else).     
     396       
     397        // commenting out the following build_cfg test since the server won't know to load
     398        // collection groups otherwise, as these don't have build_cfg files but ought to be loaded along
     399        // with collections (the real test for whether something ought to be loaded--whether an item read
     400        // in by read_dir is a collection or collection group--happens at a later time in the GS runtime code).
     401       
     402        //text_t build_cfg = filename_cat (my_gsdl_collecthome,*colhere, "index", "build.cfg");                     
     403        //if (file_exists (build_cfg)) {
    400404          collections.insert (*colhere);
    401405
     
    408412          tmp.gsdl_dbhome = my_gsdl_dbhome;         
    409413          translated_colinfo[*colhere] = tmp;
    410         }
     414        //}
    411415      }
    412416      ++colhere;
     
    474478    text_tset these_collections;
    475479 
    476     // First volume gsdlhome's - part 1
    477     // if non-standard collecthome under [gsdl] section of site config file (llssite or glisite),
    478     // then need to read in all the collections from this collecthome
    479     if(gsdl_collecthome != filename_cat(gsdl_gsdlhome,"collect")) {         
    480         load_collections_from_collectdir(translated_collectinfo,
    481                 colhere, colend, these_collections,
    482                 dbhomes, clhomes, collections,
    483                 gsdl_gsdlhome, gsdl_collecthome, gsdl_dbhome);     
    484     }
    485    
    486     // first volume gsdlhome's - part 2
     480    // First volume gsdlhome's
    487481    // read in all the collections from sections other than [gsdl] in the site config file (llssite/glisite)
    488482    colinfo_tmap::const_iterator this_info = gsdl_collectinfo.begin();
    489483    colinfo_tmap::const_iterator end_info = gsdl_collectinfo.end();
    490484    while (this_info != end_info) {
    491    
    492485      if (dbhomes.find ((*this_info).second.gsdl_dbhome) == dbhomes.end()) {
    493486            load_collections_from_collectdir(translated_collectinfo,
     
    500493      ++this_info;
    501494    }
     495   
     496    // if non-standard collecthome under [gsdl] section of site config file (llssite or glisite),
     497    // then need to read in all the collections from this collecthome
     498    if(gsdl_collecthome != filename_cat(gsdl_gsdlhome,"collect")) {
     499        load_collections_from_collectdir(translated_collectinfo,
     500                colhere, colend, these_collections,
     501                dbhomes, clhomes, collections,
     502                gsdl_gsdlhome, gsdl_collecthome, gsdl_dbhome);     
     503    }   
     504 
     505  // But when the default greenstone collect dir (gsdlhome\collect) is used, the following is used to load the collections:
    502506 
    503507    // then if necessary the main dbhome (this should only happen if the
    504508    // gsdl.ini is a little screwed up and no volume dbhomes occurred)
    505509    if (dbhomes.find (gsdl_dbhome) == dbhomes.end()) {
    506          
    507       these_collections.erase (these_collections.begin(), these_collections.end());
    508       read_dir (filename_cat (gsdl_dbhome, "collect"), these_collections);
    509       colhere = these_collections.begin();
    510       colend = these_collections.end();
    511       while (colhere != colend) {
    512          
    513     //text_t build_cfg = filename_cat (gsdl_dbhome,"collect",
    514     //           *colhere, "index", "build.cfg");
    515       //if (file_exists (build_cfg)) {
    516       collections.insert (*colhere);
    517      
    518       collectioninfo_t tmp;
    519       tmp.gsdl_gsdlhome = gsdl_gsdlhome;
    520       tmp.gsdl_collecthome = gsdl_collecthome;
    521       tmp.gsdl_dbhome = gsdl_dbhome;
    522       translated_collectinfo[*colhere] = tmp;
    523       //}
    524     ++colhere;
    525       }
    526       dbhomes.insert (gsdl_dbhome);
    527       clhomes.insert (gsdl_collecthome);
    528     }
     510      load_collections_from_collectdir(translated_collectinfo,
     511                colhere, colend, these_collections,
     512                dbhomes, clhomes, collections,
     513                gsdl_gsdlhome, filename_cat (gsdl_dbhome, "collect"), gsdl_dbhome);
     514    }   
    529515  }
    530516
Note: See TracChangeset for help on using the changeset viewer.