Changeset 1739 for trunk/gsdl/src/w32server/cgiwrapper.cpp
- Timestamp:
- 2000-12-05T13:08:17+13:00 (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/w32server/cgiwrapper.cpp
r1679 r1739 187 187 DWORD lastlibaccesstime; 188 188 DWORD baseavailvirtual; 189 text_t current_gsdlhome; 190 colinfo_tmap translated_collectinfo; 189 191 190 192 static void page_errormaincfg (const text_t &gsdlhome, const text_t &collection) { … … 351 353 text_t collection = ""; 352 354 text_tset gsdlhomes; 353 text_tarray collections; 354 colinfo_tmap::const_iterator this_info = gsdl_collectinfo.begin(); 355 colinfo_tmap::const_iterator end_info = gsdl_collectinfo.end(); 355 text_tset collections; 356 356 357 357 // note the current time … … 363 363 if (!checkdir (gsdl_gsdlhome + "\\macros\\")) return 0; 364 364 365 if (collection.empty()) { 366 367 // get all collections from each gsdlhome (this relies 368 // on there not being more than one collection with the same 369 // name) 370 read_dir (filename_cat (gsdl_gsdlhome, "collect"), collections); 365 // get all collections from each gsdlhome (this relies 366 // on there not being more than one collection with the same 367 // name) 368 369 if (!collection.empty()) { 370 // collection specific receptionist - one collection, one gsdlhome 371 collections.insert (collection); 371 372 gsdlhomes.insert (gsdl_gsdlhome); 373 collectioninfo_t tmp; 374 tmp.gsdl_gsdlhome = gsdl_gsdlhome; 375 tmp.gsdl_gdbmhome = gsdl_gdbmhome; 376 translated_collectinfo[collection] = tmp; 377 378 } else { 379 380 text_tset::const_iterator colhere; 381 text_tset::const_iterator colend; 382 text_tset these_collections; 383 384 // first volume gsdlhome's 385 colinfo_tmap::const_iterator this_info = gsdl_collectinfo.begin(); 386 colinfo_tmap::const_iterator end_info = gsdl_collectinfo.end(); 372 387 while (this_info != end_info) { 373 388 if (gsdlhomes.find ((*this_info).second.gsdl_gsdlhome) == gsdlhomes.end()) { 374 read_dir (filename_cat ((*this_info).second.gsdl_gsdlhome, "collect"), collections); 389 these_collections.erase (these_collections.begin(), these_collections.end()); 390 read_dir (filename_cat ((*this_info).second.gsdl_gsdlhome, "collect"), these_collections); 391 colhere = these_collections.begin(); 392 colend = these_collections.end(); 393 while (colhere != colend) { 394 if ((collections.find (*colhere)) == collections.end()) { 395 // make sure the build.cfg file is at gsdlhome (as it's possible that 396 // the collection appears at this gsdlhome only because it's gdbm 397 // file is installed here -- it's real gdbm will therefore be 398 // somewhere else). 399 text_t build_cfg = filename_cat ((*this_info).second.gsdl_gsdlhome, "collect", 400 *colhere, "index", "build.cfg"); 401 if (file_exists (build_cfg)) { 402 collections.insert (*colhere); 403 404 // since gsdl_collectinfo keys will be stuff like collection#1 405 // for a multiple volume collection we want to translate it 406 // so that the keys are the actual collection names 407 translated_collectinfo[*colhere] = (*this_info).second; 408 } 409 } 410 colhere ++; 411 } 375 412 gsdlhomes.insert ((*this_info).second.gsdl_gsdlhome); 376 413 } 377 414 this_info ++; 378 415 } 379 } else { 380 collections.push_back (collection); 381 gsdlhomes.insert (gsdl_gsdlhome); 382 } 383 384 text_tarray::const_iterator thiscol = collections.begin(); 385 text_tarray::const_iterator endcol = collections.end(); 416 417 // then if necessary the main gsdlhome (this should only happen if the 418 // gsdl.ini is a little screwed up and no volume gsdlhomes occurred 419 if (gsdlhomes.find (gsdl_gsdlhome) == gsdlhomes.end()) { 420 these_collections.erase (these_collections.begin(), these_collections.end()); 421 read_dir (filename_cat (gsdl_gsdlhome, "collect"), these_collections); 422 colhere = these_collections.begin(); 423 colend = these_collections.end(); 424 while (colhere != colend) { 425 collections.insert (*colhere); 426 collectioninfo_t tmp; 427 tmp.gsdl_gsdlhome = gsdl_gsdlhome; 428 tmp.gsdl_gdbmhome = gsdl_gdbmhome; 429 translated_collectinfo[*colhere] = tmp; 430 colhere ++; 431 } 432 gsdlhomes.insert (gsdl_gsdlhome); 433 } 434 } 435 436 text_tset::const_iterator thiscol = collections.begin(); 437 text_tset::const_iterator endcol = collections.end(); 386 438 387 439 while (thiscol != endcol) { … … 394 446 395 447 // create collection server and add to null protocol 396 nproto.add_collection (*thiscol, &recpt, gsdl_gsdlhome, gsdl_gsdlhome); 448 text_t this_gsdlhome = gsdl_gsdlhome; 449 text_t this_gdbmhome = gsdl_gdbmhome; 450 colinfo_tmap::const_iterator it = translated_collectinfo.find (*thiscol); 451 assert (it != translated_collectinfo.end()); 452 this_gsdlhome = (*it).second.gsdl_gsdlhome; 453 this_gdbmhome = (*it).second.gsdl_gdbmhome; 454 455 nproto.add_collection (*thiscol, &recpt, this_gsdlhome, this_gdbmhome); 397 456 398 457 thiscol ++; … … 479 538 480 539 int maxrequests = 1; 481 text_tset seenhomes; 482 this_info = gsdl_collectinfo.begin(); 483 484 // configure any collections with gsdlhome (or gdbmhome) 540 541 // configure collections (and receptionist) with collectinfo stuff 485 542 // different from the default 543 colinfo_tmap::const_iterator this_info = translated_collectinfo.begin(); 544 colinfo_tmap::const_iterator end_info = translated_collectinfo.end(); 545 486 546 while (this_info != end_info) { 487 if (((*this_info).second.gsdl_gsdlhome != gsdl_gsdlhome) || 488 ((*this_info).second.gsdl_gdbmhome != gsdl_gdbmhome) && 489 (seenhomes.find ((*this_info).second.gsdl_gsdlhome + 490 (*this_info).second.gsdl_gdbmhome) == seenhomes.end())) { 491 text_tarray tmpconf; 492 tmpconf.push_back ((*this_info).first); 493 tmpconf.push_back ((*this_info).second.gsdl_gsdlhome); 494 tmpconf.push_back ((*this_info).second.gsdl_gdbmhome); 495 recpt.configure ("collectinfo", tmpconf); 496 seenhomes.insert ((*this_info).second.gsdl_gsdlhome + 497 (*this_info).second.gsdl_gdbmhome); 498 } 547 text_tarray tmpconf; 548 tmpconf.push_back ((*this_info).first); 549 tmpconf.push_back ((*this_info).second.gsdl_gsdlhome); 550 tmpconf.push_back ((*this_info).second.gsdl_gdbmhome); 551 recpt.configure ("collectinfo", tmpconf); 499 552 this_info ++; 500 553 } … … 563 616 564 617 // set up file name 565 text_t filenamet = text_t(gsdl_gsdlhome) + filename; 566 text_t::iterator here = filenamet.begin(); 567 text_t::iterator end = filenamet.end(); 568 while (here != end) { 569 if (*here == '/') *here = '\\'; 570 here ++; 571 } 572 618 text_t filenamet = filename_cat (current_gsdlhome, filename); 573 619 filename = filenamet.getcstr(); 574 620 … … 613 659 return; 614 660 } 615 661 662 colinfo_tmap::const_iterator it = translated_collectinfo.find (args["c"]); 663 if (it != translated_collectinfo.end()) { 664 current_gsdlhome = (*it).second.gsdl_gsdlhome; 665 } else { 666 current_gsdlhome = gsdl_gsdlhome; 667 } 668 616 669 // produce cgi header 617 670 response_t response;
Note:
See TracChangeset
for help on using the changeset viewer.