Ignore:
Timestamp:
2009-04-08T10:47:40+12:00 (15 years ago)
Author:
kjdon
Message:

check the existence of collect.cfg to see if a collection name is valid or not, then don't advertise it if not.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/runtime-src/src/oaiservr/oaiconfig.cpp

    r18892 r18903  
    4747  // parameter, read in all the collection's individual configurations
    4848  if (gsdlcollect == "") {
    49     text_tarray::iterator here = this->collectList.begin();
    50     text_tarray::iterator end  = this->collectList.end();
    51     while (here != end) {       
    52       this->configureCollection(gsdlhome, *here);
    53       ++here;
    54     }
     49    text_tarray::iterator start = this->collectList.begin();
     50    text_tarray::iterator here  = this->collectList.end()-1;
     51    while (here != start) {     
     52      if (!this->configureCollection(gsdlhome, *here)) {
     53    this->collectList.erase(here);
     54      }
     55      --here;
     56    }
     57    // and do the first one
     58    if (!this->configureCollection(gsdlhome, *here)) {
     59      this->collectList.erase(here);
     60    }
     61   
    5562  }
    5663  else {
     64    // what do we do if this fails?
    5765    this->configureCollection(gsdlhome, gsdlcollect);
    5866  }
     
    8189}
    8290
    83 void oaiconfig::configureCollection(const text_t &gsdlhome, const text_t &gsdlcollect)
     91bool oaiconfig::configureCollection(const text_t &gsdlhome, const text_t &gsdlcollect)
    8492{
    8593  text_t cnfgfile = filename_cat(gsdlhome, "collect", gsdlcollect, "etc", "collect.cfg");
     94  if (!file_exists(cnfgfile)) {
     95    return false;
     96  }
    8697  this->collection = gsdlcollect;
    8798  this->read_configfile(cnfgfile);
    88 }
    89 
     99
     100  return true;
     101}
    90102void oaiconfig::configure (const text_t &key, const text_tarray &cfgline)
    91103{
Note: See TracChangeset for help on using the changeset viewer.