Changeset 22822


Ignore:
Timestamp:
08/31/10 20:55:28 (11 years ago)
Author:
ak19
Message:

Further changes for ticket 152 (movable collectdir), to get server.exe to load all the collections in a non-standard collectdirectory. Previously the code read in collections in any collecthome property listed in a section OTHER THAN the default [gsdl] section of gli/llssite.cfg. Adjusted the code to handle a non-standard collecthome value specified in the [gsdl] section itself.

Location:
main/trunk/greenstone2/runtime-src/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/runtime-src/src/recpt/configaction.cpp

    r22677 r22822  
    9393    textout << "configured release-collection\n";
    9494
    95   } else if ((args["cmd"] == "restart")) {
    96     if(!args["c"].empty()) {
    97         remove_colservr(args["c"], logout);
    98         textout << "configured release-collection for reconfigure-restart\n";
    99     }
    100     textout << "reconfigure-restart\n";
     95  } else if ((args["cmd"] == "restart")) { 
     96    textout << "configured for restart\n";
    10197#ifdef GSDL_LOCAL_LIBRARY
    10298    HWND gw = FindWindow("Greenstone Digital Library Software",
  • main/trunk/greenstone2/runtime-src/src/w32server/cgiwrapper.cpp

    r22588 r22822  
    368368keydbclass *kdb = NULL;
    369369
     370
     371// When (1) the "collecthome" collect dir is not the standard greenstone collect dir,
     372// or when (2) this collecthome is specified in a section other than [gsdl] in the (lls/gli)site.cfg file,
     373// this method gets called to load in that collect dir's collections into the server during gsdl_init
     374static void load_collections_from_collectdir(
     375    colinfo_tmap &translated_colinfo,
     376    text_tset::const_iterator &colhere,
     377    text_tset::const_iterator &colend,
     378    text_tset &these_collections,
     379    text_tset &dbhomes,
     380    text_tset &clhomes,
     381    text_tset &collections,
     382    const text_t &my_gsdl_home,
     383    const text_t &my_gsdl_collecthome,
     384    const text_t &my_gsdl_dbhome)
     385{   
     386    these_collections.erase (these_collections.begin(), these_collections.end());
     387    read_dir (my_gsdl_collecthome, these_collections);
     388    colhere = these_collections.begin();
     389    colend = these_collections.end();
     390    while (colhere != colend) {     
     391      if ((collections.find (*colhere)) == collections.end()) {
     392        // make sure the build.cfg file is at gsdlhome (as it's possible that
     393        // the collection appears at this gsdlhome only because it's gdbm
     394        // 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)) {
     400          collections.insert (*colhere);
     401
     402          // since gsdl_collectinfo keys will be stuff like collection#1
     403          // for a multiple volume collection we want to translate it
     404          // so that the keys are the actual collection names
     405          collectioninfo_t tmp;
     406          tmp.gsdl_gsdlhome = my_gsdl_home;
     407          tmp.gsdl_collecthome = my_gsdl_collecthome;
     408          tmp.gsdl_dbhome = my_gsdl_dbhome;         
     409          translated_colinfo[*colhere] = tmp;
     410        }
     411      }
     412      ++colhere;
     413    }
     414    dbhomes.insert (gsdl_dbhome);
     415    clhomes.insert (gsdl_collecthome);
     416}
     417
     418
    370419// returns 1 if successful, 0 if unsuccessful (note that as well as being
    371420// called when the server first starts up this function is called when the
    372421// "restart library" button is pressed)
    373 int gsdl_init (bool atStartup) {
    374 
     422int gsdl_init (bool atStartup) {         
    375423  if (atStartup) {
    376424#if defined (GSDL_USE_IOS_H)
     
    410458  // on there not being more than one collection with the same
    411459  // name)
    412   if (!collection.empty()) {
     460  if (!collection.empty()) { 
    413461    // collection specific receptionist - one collection, one gsdlhome
    414462    collections.insert (collection);
     
    422470
    423471  } else {
    424 
    425     text_tset::const_iterator colhere;
     472    text_tset::const_iterator colhere;
    426473    text_tset::const_iterator colend;
    427474    text_tset these_collections;
    428 
    429     // first volume gsdlhome's
     475 
     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
     487    // read in all the collections from sections other than [gsdl] in the site config file (llssite/glisite)
    430488    colinfo_tmap::const_iterator this_info = gsdl_collectinfo.begin();
    431489    colinfo_tmap::const_iterator end_info = gsdl_collectinfo.end();
    432490    while (this_info != end_info) {
     491   
    433492      if (dbhomes.find ((*this_info).second.gsdl_dbhome) == dbhomes.end()) {
    434     these_collections.erase (these_collections.begin(), these_collections.end());
    435     read_dir ((*this_info).second.gsdl_collecthome, these_collections);
    436     colhere = these_collections.begin();
    437     colend = these_collections.end();
    438     while (colhere != colend) {
    439       if ((collections.find (*colhere)) == collections.end()) {
    440         // make sure the build.cfg file is at gsdlhome (as it's possible that
    441         // the collection appears at this gsdlhome only because it's gdbm
    442         // file is installed here -- it's real gdbm will therefore be
    443         // somewhere else).
    444         text_t build_cfg = filename_cat ((*this_info).second.gsdl_collecthome,
    445                          *colhere, "index", "build.cfg");
    446         if (file_exists (build_cfg)) {
    447           collections.insert (*colhere);
    448 
    449           // since gsdl_collectinfo keys will be stuff like collection#1
    450           // for a multiple volume collection we want to translate it
    451           // so that the keys are the actual collection names
    452           translated_collectinfo[*colhere] = (*this_info).second;
    453         }
    454       }
    455       ++colhere;
    456     }
    457     dbhomes.insert ((*this_info).second.gsdl_dbhome);
    458     clhomes.insert ((*this_info).second.gsdl_collecthome);
     493            load_collections_from_collectdir(translated_collectinfo,
     494                    colhere, colend, these_collections,
     495                    dbhomes, clhomes, collections,
     496                    (*this_info).second.gsdl_gsdlhome,
     497                    (*this_info).second.gsdl_collecthome,
     498                    (*this_info).second.gsdl_dbhome);   
    459499      }
    460500      ++this_info;
     
    464504    // gsdl.ini is a little screwed up and no volume dbhomes occurred)
    465505    if (dbhomes.find (gsdl_dbhome) == dbhomes.end()) {
     506         
    466507      these_collections.erase (these_collections.begin(), these_collections.end());
    467508      read_dir (filename_cat (gsdl_dbhome, "collect"), these_collections);
     
    469510      colend = these_collections.end();
    470511      while (colhere != colend) {
    471    
     512         
    472513    //text_t build_cfg = filename_cat (gsdl_dbhome,"collect",
    473514    //           *colhere, "index", "build.cfg");
Note: See TracChangeset for help on using the changeset viewer.