Changeset 16310 for gsdl/trunk/src/lib/gsdlsitecfg.cpp
- Timestamp:
- 2008-07-09T13:12:15+12:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/src/lib/gsdlsitecfg.cpp
r15402 r16310 24 24 *********************************************************************/ 25 25 26 26 #include "fileutil.h" 27 27 #include "gsdlsitecfg.h" 28 28 … … 42 42 private: 43 43 text_t *gsdlhome; 44 text_t *collecthome; 44 45 text_t *httpdomain; 45 46 text_t *httpprefix; … … 49 50 int *maxrequests; 50 51 public: 51 __site_configuration (text_t *_gsdlhome, int *_maxrequests) {52 __site_configuration (text_t *_gsdlhome, text_t* _collecthome, int *_maxrequests) { 52 53 gsdlhome = _gsdlhome; 54 collecthome = _collecthome; 53 55 httpdomain = NULL; 54 56 httpprefix = NULL; … … 59 61 } 60 62 61 __site_configuration (text_t *_gsdlhome, text_t *_httpdomain,62 63 __site_configuration (text_t *_gsdlhome, text_t* _collecthome, 64 text_t *_httpdomain, text_t *_httpprefix) { 63 65 gsdlhome = _gsdlhome; 66 collecthome = _collecthome; 64 67 httpdomain = _httpdomain; 65 68 httpprefix = _httpprefix; … … 70 73 } 71 74 72 __site_configuration (text_t *_gsdlhome, text_t *_httpdomain, 75 __site_configuration (text_t *_gsdlhome, text_t* _collecthome, 76 text_t *_httpdomain, 73 77 text_t *_httpprefix, text_t *_collection) { 74 78 gsdlhome = _gsdlhome; 79 collecthome = _collecthome; 75 80 httpdomain = _httpdomain; 76 81 httpprefix = _httpprefix; … … 83 88 __site_configuration (text_t *_httpprefix, text_tset *_actions, text_tset *_browsers) { 84 89 gsdlhome = NULL; 90 collecthome = NULL; 85 91 httpdomain = NULL; 86 92 httpprefix = _httpprefix; … … 94 100 if (gsdlhome != NULL && key == "gsdlhome") { 95 101 *gsdlhome = cfgline[0]; 102 103 if ((collecthome != NULL) && (collecthome->empty())) { 104 // defaults to <gsdlhome>/collect 105 *collecthome = filename_cat(*gsdlhome,"collect"); 106 } 107 } 108 109 if (collecthome != NULL && key == "collecthome") { 110 if (!collecthome->empty()) { 111 // if it has been previously set to default, free and then reassign 112 collecthome->clear(); 113 } 114 *collecthome = cfgline[0]; 96 115 } 97 116 … … 141 160 // also sets gsdlhome and maxrequests 142 161 // gsdlsite.cfg should be in same directory as library executable 143 bool site_cfg_read (configurator gsdlconfigurator, text_t &gsdlhome, int &maxrequests) 162 bool site_cfg_read (configurator gsdlconfigurator, text_t &gsdlhome, 163 text_t& collecthome, int &maxrequests) 144 164 { 145 __site_configuration sitecfg(&gsdlhome, & maxrequests);165 __site_configuration sitecfg(&gsdlhome, &collecthome, &maxrequests); 146 166 gsdlconfigurator.add_configurable(&sitecfg); 147 167 148 // blank the gsdl 168 // blank the gsdlhome and collecthome text 149 169 gsdlhome.clear(); 170 collecthome.clear(); 150 171 151 172 if (gsdlconfigurator.configure("gsdlsite.cfg")) … … 158 179 159 180 160 // this version grabs gsdlhome, httpdomain and httpprefix,181 // this version grabs gsdlhome, collecthome, httpdomain and httpprefix, 161 182 // returns false if it can't find all of them 162 bool site_cfg_read (text_t &gsdlhome, text_t &httpdomain,183 bool site_cfg_read (text_t &gsdlhome, text_t& collecthome, text_t &httpdomain, 163 184 text_t &httpprefix) 164 185 { 165 186 // get gsdlhome etc 166 __site_configuration sitecfg(&gsdlhome, & httpdomain, &httpprefix);187 __site_configuration sitecfg(&gsdlhome, &collecthome, &httpdomain, &httpprefix); 167 188 configurator gsdlconfigurator(&sitecfg); 168 189 169 190 gsdlhome.clear(); 191 collecthome.clear(); 170 192 httpdomain.clear(); 171 193 httpprefix.clear(); … … 180 202 181 203 182 // this version grabs gsdlhome, httpdomain, httpprefix, collection,204 // this version grabs gsdlhome, collecthome, httpdomain, httpprefix, collection, 183 205 // returns false if it can't find gsdlhome, httpdomain and httpprefix 184 bool site_cfg_read (text_t &gsdlhome, text_t &httpdomain,206 bool site_cfg_read (text_t &gsdlhome, text_t& collecthome, text_t &httpdomain, 185 207 text_t &httpprefix, text_t &collection) 186 208 { 187 209 // get gsdlhome etc 188 __site_configuration sitecfg(&gsdlhome, & httpdomain, &httpprefix, &collection);210 __site_configuration sitecfg(&gsdlhome, &collecthome, &httpdomain, &httpprefix, &collection); 189 211 configurator gsdlconfigurator(&sitecfg); 190 212 191 213 gsdlhome.clear(); 214 collecthome.clear(); 192 215 httpdomain.clear(); 193 216 httpprefix.clear(); … … 195 218 196 219 if (gsdlconfigurator.configure("gsdlsite.cfg") && 197 !gsdlhome.empty() && !httpdomain.empty() && !httpprefix.empty()) 220 !gsdlhome.empty() && !collecthome.empty() 221 && !httpdomain.empty() && !httpprefix.empty()) 198 222 { 199 223 return true;
Note:
See TracChangeset
for help on using the changeset viewer.