Ignore:
Timestamp:
2000-11-03T10:21:01+13:00 (24 years ago)
Author:
sjboddie
Message:

Tidied up collectoraction some more and created an add_collection
function in nullproto that does all the work of setting up a
local collection server

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/recpt/collectoraction.cpp

    r1507 r1649  
    3535#include "cfgread.h"
    3636#include "gsdltools.h"
     37#include "nullproto.h"
    3738
    3839#if !defined (__WIN32__)
     
    359360    char c = fbld_in.get();
    360361    fbld_in.close();
    361     if (c == '0') current_page = "bilddone";
     362    if (c == '0') {
     363      // success - we need to create and configure a collection server for the
     364      // newly built collection (for fastcgi and local library where
     365      // initialization isn't going to be redone when the user clicks the
     366      // "view your new collection" button
     367      create_colserver (args["bc1dirname"], logout);
     368      current_page = "bilddone";
     369    }
    362370    else if (c == '4' || c == '5') message = "installfail";
    363371    else current_page = "bildfail";
     
    772780  }
    773781
    774   disp.setmacro ("statusline", "collector", statusline);
     782  disp.setmacro ("statusline", "collector", dm_safe(statusline));
    775783
    776784}
     
    11631171  options += " -collectdir \"" + tmpdir + "\" ";
    11641172  text_t optionfile = filename_cat (tmpdir, "mkcol.opt");
    1165   char *optionfilet = optionfile.getcstr();
    1166   ofstream ofile_out (optionfilet);
    1167   delete optionfilet;
     1173  char *optionfilec = optionfile.getcstr();
     1174  ofstream ofile_out (optionfilec);
     1175  delete optionfilec;
    11681176  if (!ofile_out) {
    11691177    message = "tmpfail";
     
    13361344  return false;
    13371345}
     1346
     1347// create and initialize a new collection server and
     1348// add it to the null protocol.
     1349void collectoraction::create_colserver (const text_t &collection, ostream &logout) {
     1350
     1351  recptprotolistclass *protos = recpt->get_recptprotolist_ptr();
     1352  recptprotolistclass::iterator rprotolist_here = protos->begin();
     1353  recptprotolistclass::iterator rprotolist_end = protos->end();
     1354  while (rprotolist_here != rprotolist_end) {
     1355    if ((*rprotolist_here).p != NULL) {
     1356      if ((*rprotolist_here).p->get_protocol_name () == "nullproto") {
     1357    // create collection server and add it to nullproto
     1358    (*rprotolist_here).p->add_collection (collection, recpt, gsdlhome, gsdlhome);
     1359    // make sure gsdlhome is configured
     1360    text_tarray tmp;
     1361    tmp.push_back (gsdlhome);
     1362    (*rprotolist_here).p->configure ("gsdlhome", tmp);
     1363    // re-initialize the null protocol
     1364    if (!(*rprotolist_here).p->init (logout)) {
     1365      logout << "collectoraction::create_colserver: nullproto init failed\n";
     1366    }
     1367    return;
     1368      }
     1369    }
     1370    rprotolist_here ++;
     1371  }
     1372
     1373  logout << "collectoraction::create_colserver: no valid nullproto found\n";
     1374}
Note: See TracChangeset for help on using the changeset viewer.