Changeset 6023


Ignore:
Timestamp:
2003-11-28T16:45:31+13:00 (20 years ago)
Author:
sjboddie
Message:

The "restart library" button in the local library now reinitialises
greenstone properly, reloading macro files, re-reading configuration files,
etc.

Location:
trunk/gsdl/src/w32server
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/w32server/cgiwrapper.cpp

    r4291 r6023  
    175175  return 0;
    176176}
    177 
    178 receptionist recpt;
    179 nullproto nproto;
    180 textstreambuf textstream;
    181 logstreambuf logstream;
    182 DWORD lastlibaccesstime;
    183 DWORD baseavailvirtual;
    184 text_t current_gsdlhome;
    185 colinfo_tmap translated_collectinfo;
    186177
    187178static void page_errormaincfg (const text_t &gsdlhome, const text_t &collection) {
     
    333324
    334325
    335 // returns 1 if successful, 0 if unsuccessful
    336 int gsdl_init () {
     326receptionist recpt;
     327nullproto nproto;
     328collectset *cservers = NULL;
     329
     330textstreambuf textstream;
     331logstreambuf logstream;
     332DWORD lastlibaccesstime;
     333DWORD baseavailvirtual;
     334text_t current_gsdlhome;
     335colinfo_tmap translated_collectinfo;
     336 
     337statusaction *astatusaction = NULL;
     338pageaction *apageaction = NULL;
     339pingaction *apingaction = NULL;
     340tipaction *atipaction = NULL;
     341queryaction *aqueryaction = NULL;
     342documentaction *adocumentaction = NULL;
     343usersaction *ausersaction = NULL;
     344extlinkaction *anextlinkaction = NULL;
     345collectoraction *acollectoraction = NULL;
     346authenaction *aauthenaction = NULL;
     347phindaction *aphindaction = NULL;
     348configaction *aconfigaction = NULL;
     349vlistbrowserclass *avlistbrowserclass = NULL;
     350hlistbrowserclass *ahlistbrowserclass = NULL;
     351datelistbrowserclass *adatelistbrowserclass = NULL;
     352invbrowserclass *ainvbrowserclass = NULL;
     353pagedbrowserclass *apagedbrowserclass = NULL;
     354htmlbrowserclass *ahtmlbrowserclass = NULL;
     355phindbrowserclass *aphindbrowserclass = NULL;
     356
     357// returns 1 if successful, 0 if unsuccessful (note that as well as being
     358// called when the server first starts up this function is called when the
     359// "restart library" button is pressed)
     360int gsdl_init (bool atStartup) {
     361
     362  if (atStartup) {
    337363#if defined (GSDL_USE_IOS_H)
    338   cerr = &logstream;
    339   cout = &textstream;
     364    cerr = &logstream;
     365    cout = &textstream;
    340366#else
    341   cerr.rdbuf(&logstream);
    342   cout.rdbuf(&textstream);
     367    cerr.rdbuf(&logstream);
     368    cout.rdbuf(&textstream);
    343369#endif
     370  }
    344371
    345372  // collection should be set to "" unless in collection specific mode -
     
    350377  text_tset collections;
    351378
    352   // note the current time
    353   lastlibaccesstime = GetTickCount();
    354 
    355   // before we do the init we should make sure
    356   // that we can find the relevant directories
    357   if (!checkdir (gsdl_gsdlhome + "\\")) return 0;
    358   if (!checkdir (gsdl_gsdlhome + "\\macros\\")) return 0;
    359 
    360   collectset *cservers = new collectset();
     379  if (atStartup) {
     380    // note the current time
     381    lastlibaccesstime = GetTickCount();
     382   
     383    // before we do the init we should make sure
     384    // that we can find the relevant directories
     385    if (!checkdir (gsdl_gsdlhome + "\\")) return 0;
     386    if (!checkdir (gsdl_gsdlhome + "\\macros\\")) return 0;
     387  }   
     388
     389  // deleting cservers clears all the collection servers
     390  if (cservers != NULL) delete cservers;
     391
     392  cservers = new collectset();
    361393
    362394  // get all collections from each gsdlhome (this relies
    363395  // on there not being more than one collection with the same
    364396  // name)
    365 
    366397  if (!collection.empty()) {
    367398    // collection specific receptionist - one collection, one gsdlhome
     
    459490 
    460491  // add the protocol to the receptionist
    461   recpt.add_protocol (&nproto);
     492  if (atStartup) recpt.add_protocol (&nproto);
    462493 
    463494  // the list of actions.
    464   statusaction *astatusaction = new statusaction();
    465   astatusaction->set_receptionist (&recpt);
    466   recpt.add_action (astatusaction);
    467  
    468   pageaction *apageaction = new pageaction();
    469   apageaction->set_receptionist (&recpt);
    470   recpt.add_action (apageaction);
    471  
    472   pingaction *apingaction = new pingaction();
    473   recpt.add_action (apingaction);
    474  
    475   tipaction *atipaction = new tipaction();
    476   recpt.add_action (atipaction);
    477  
    478   queryaction *aqueryaction = new queryaction();
    479   aqueryaction->set_receptionist (&recpt);
    480   recpt.add_action (aqueryaction);
    481  
    482   documentaction *adocumentaction = new documentaction();
    483   adocumentaction->set_receptionist (&recpt);
    484   recpt.add_action (adocumentaction);
    485  
    486   usersaction *ausersaction = new usersaction();
    487   recpt.add_action (ausersaction);
    488 
    489   extlinkaction *anextlinkaction = new extlinkaction();
    490   recpt.add_action (anextlinkaction);
    491 
    492   collectoraction *acollectoraction = new collectoraction();
    493   acollectoraction->set_receptionist (&recpt);
    494   recpt.add_action (acollectoraction);
    495  
    496   authenaction *aauthenaction = new authenaction();
    497   aauthenaction->set_receptionist(&recpt);
    498   recpt.add_action (aauthenaction);
    499 
    500   phindaction *aphindaction = new phindaction();
    501   recpt.add_action (aphindaction);
    502  
    503   configaction *aconfigaction = new configaction();
    504   aconfigaction->set_receptionist(&recpt);
    505   recpt.add_action (aconfigaction);
     495  if (astatusaction == NULL) {
     496    astatusaction = new statusaction();
     497    astatusaction->set_receptionist (&recpt);
     498    recpt.add_action (astatusaction);
     499  }
     500 
     501  if (apageaction == NULL) {
     502    apageaction = new pageaction();
     503    apageaction->set_receptionist (&recpt);
     504    recpt.add_action (apageaction);
     505  }
     506 
     507  if (apingaction == NULL) {
     508    apingaction = new pingaction();
     509    recpt.add_action (apingaction);
     510  }
     511 
     512  if (atipaction == NULL) {
     513    atipaction = new tipaction();
     514    recpt.add_action (atipaction);
     515  }
     516 
     517  if (aqueryaction == NULL) {
     518    aqueryaction = new queryaction();
     519    aqueryaction->set_receptionist (&recpt);
     520    recpt.add_action (aqueryaction);
     521  }
     522 
     523  if (adocumentaction == NULL) {
     524    adocumentaction = new documentaction();
     525    adocumentaction->set_receptionist (&recpt);
     526    recpt.add_action (adocumentaction);
     527  }
     528 
     529  if (ausersaction == NULL) {
     530    ausersaction = new usersaction();
     531    recpt.add_action (ausersaction);
     532  }
     533
     534  if (anextlinkaction == NULL) {
     535    anextlinkaction = new extlinkaction();
     536    recpt.add_action (anextlinkaction);
     537  }
     538
     539  if (acollectoraction == NULL) {
     540    acollectoraction = new collectoraction();
     541    acollectoraction->set_receptionist (&recpt);
     542    recpt.add_action (acollectoraction);
     543  }
     544 
     545  if (aauthenaction == NULL) {
     546    aauthenaction = new authenaction();
     547    aauthenaction->set_receptionist(&recpt);
     548    recpt.add_action (aauthenaction);
     549  }
     550
     551  if (aphindaction == NULL) {
     552    aphindaction = new phindaction();
     553    recpt.add_action (aphindaction);
     554  }
     555 
     556  if (aconfigaction == NULL) {
     557    aconfigaction = new configaction();
     558    aconfigaction->set_receptionist(&recpt);
     559    recpt.add_action (aconfigaction);
     560  }
    506561
    507562
    508563  // list of browsers
    509   vlistbrowserclass *avlistbrowserclass = new vlistbrowserclass();
    510   recpt.add_browser (avlistbrowserclass);
    511   recpt.setdefaultbrowser ("VList");
    512 
    513   hlistbrowserclass *ahlistbrowserclass = new hlistbrowserclass();
    514   recpt.add_browser (ahlistbrowserclass);
    515 
    516   datelistbrowserclass *adatelistbrowserclass = new datelistbrowserclass();
    517   recpt.add_browser (adatelistbrowserclass);
    518 
    519   invbrowserclass *ainvbrowserclass = new invbrowserclass();
    520   recpt.add_browser (ainvbrowserclass);
    521 
    522   pagedbrowserclass *apagedbrowserclass = new pagedbrowserclass();
    523   recpt.add_browser (apagedbrowserclass);
    524 
    525   htmlbrowserclass *ahtmlbrowserclass = new htmlbrowserclass();
    526   recpt.add_browser (ahtmlbrowserclass);
    527 
    528   phindbrowserclass *aphindbrowserclass = new phindbrowserclass();;
    529   recpt.add_browser (aphindbrowserclass);
     564  if (avlistbrowserclass == NULL) {
     565    avlistbrowserclass = new vlistbrowserclass();
     566    recpt.add_browser (avlistbrowserclass);
     567    recpt.setdefaultbrowser ("VList");
     568  }
     569
     570  if (ahlistbrowserclass == NULL) {
     571    ahlistbrowserclass = new hlistbrowserclass();
     572    recpt.add_browser (ahlistbrowserclass);
     573  }
     574
     575  if (adatelistbrowserclass == NULL) {
     576    adatelistbrowserclass = new datelistbrowserclass();
     577    recpt.add_browser (adatelistbrowserclass);
     578  }
     579
     580  if (ainvbrowserclass == NULL) {
     581    ainvbrowserclass = new invbrowserclass();
     582    recpt.add_browser (ainvbrowserclass);
     583  }
     584
     585  if (apagedbrowserclass == NULL) {
     586    apagedbrowserclass = new pagedbrowserclass();
     587    recpt.add_browser (apagedbrowserclass);
     588  }
     589
     590  if (ahtmlbrowserclass == NULL) {
     591    ahtmlbrowserclass = new htmlbrowserclass();
     592    recpt.add_browser (ahtmlbrowserclass);
     593  }
     594
     595  if (aphindbrowserclass == NULL) {
     596    aphindbrowserclass = new phindbrowserclass();;
     597    recpt.add_browser (aphindbrowserclass);
     598  }
    530599 
    531600  // set defaults
  • trunk/gsdl/src/w32server/cgiwrapper.h

    r2280 r6023  
    4040// sets up the library
    4141// returns 1 if successful, 0 if unsuccessful
    42 int gsdl_init ();
     42int gsdl_init (bool atStartup = true);
    4343
    4444// returns 0 if the directories cant be found
  • trunk/gsdl/src/w32server/fnord.cpp

    r5889 r6023  
    322322  int res;
    323323 
     324  if (infostring == strrestartlib) {
     325
     326    // the "restart library" button was pressed so we want to reinitialize
     327    // greenstone, read in all the macrofiles again, etc.
     328    gsdl_init(false);
     329  }
     330
    324331  // get the url and attempt to start a browser
    325332  char *localname = GetLocalName(NULL);
Note: See TracChangeset for help on using the changeset viewer.