Roxen.git / server / base_server / mainconfig.pike

version» Context lines:

Roxen.git/server/base_server/mainconfig.pike:1:   inherit "config/builders"; - string cvs_version = "$Id: mainconfig.pike,v 1.29 1996/12/13 00:41:16 per Exp $"; + string cvs_version = "$Id: mainconfig.pike,v 1.30 1997/01/29 04:59:34 per Exp $";   inherit "roxenlib";   inherit "config/draw_things";      #include <confignode.h>   #include <module.h>      #define dR "00"   #define dG "06"   #define dB "30"   
Roxen.git/server/base_server/mainconfig.pike:21:   #define PUSH(X) do{res+=({(X)});}while(0)      int bar=time(1);      class Node {    inherit "struct/node";       mixed original;    int changed, moredocs;    -  int bar=previous_object()->bar; +  int bar=time();    function saver = lambda(object o) { if(o->changed) o->change(-o->changed); };       string|array error;       void change(int i)    {    changed += i;    if(up) up->change(i);    }   
Roxen.git/server/base_server/mainconfig.pike:150:    return ("<head><title>"+h+"</title></head>\n"+ BODY+"\n");   }      object find_node(string l)   {    array tmp = l/"/"-({""});    object o;    if(!sizeof(tmp)) return root;    for(o=root; sizeof(tmp) && (o=o->descend(tmp[0],1)); tmp=tmp[1..1000]);    if(!o) return 0; -  roxen->current_configuration = o->config(); +     return o;   }      mapping file_image(string img)   {    object o;    o=open("roxen-images/"+img, "r");    if (!o) return 0;    return ([ "file":o, "type":"image/" + ((img[-1]=='f')?"gif":"jpeg"), ]);   }      #define CONFIG_URL roxen->config_url()      mapping save_it(object id, object o)   {    id->referer = ({ CONFIG_URL + o->path(1) });    root->save(); -  if(roxen->do_fork_it()) -  { +     roxen->update_supports_from_roxen_com();    roxen->initiate_configuration_port( 0 );   } -  else -  throw(-1); - } +       mapping stores( string s )   {    return    ([    "data":replace(s, "$docurl", roxen->docurl),    "type":"text/html",    "extra_heads":    ([    "Title":"Roxen Challenger maintenance",   // "Expires":http_date(time(1)+2),   // "Pragma":"no-cache",    "Last-Modified":http_date(time(1)),    ])    ]);   }    - object find_module(string name) + object find_module(string name, object in)   {    mapping mod;    object o;    string s;    int i;    name = lower_case(name);    if(!sscanf(name, "%s#%d", name, i))    {   #ifdef MODULE_DEBUG   #if defined(DEBUG) && (DEBUG > 1000)    perror("Modulename not in short form: "+name+"\n");   #endif   #endif -  foreach(values(roxen->current_configuration->modules), mod) +  foreach(values(in->modules), mod)    {    if(mod->copies)    {    foreach(values(mod->copies), o)    if(lower_case(s=name_of_module(o)) == name)    return o;    } else    if(mod->enabled && (lower_case(s=name_of_module(mod->enabled))==name))    return mod->enabled;    }    } else {    mapping modules;   #ifdef MODULE_DEBUG   #if defined(DEBUG) && (DEBUG > 1000)    perror("Modulename in short form: "+name+"#"+i+"\n");   #endif   #endif -  modules = roxen->current_configuration->modules; +  modules = in->modules;    if(modules[name])    {    if(modules[name]->copies)    return modules[name]->copies[i];    else    if(modules[name]->enabled)    return modules[name]->enabled;    }    }    return 0;   }      mixed decode_form_result(string var, int type, object node, mapping allvars)   {    switch(type)    {    case TYPE_MODULE_LIST:    return map_array(var/"\000", find_module);       case TYPE_MODULE: -  return find_module(var); +  return find_module(var, node->config());       case TYPE_PORTS:    /*    Encoded like this:       new_port --> Add a new port    ok[_<ID>] --> Save the value for all or one port    delete_<ID> --> Delete a port       ---- { A port is defined by:
Roxen.git/server/base_server/mainconfig.pike:454:    node=node->up;       case NODE_MODULE_MASTER_COPY:    case NODE_MODULE:    node=node->up;       case NODE_CONFIGURATION:    }       if(module) if(module->copies) while(module->copies[i]) i++; -  roxen->enable_module(name+"#"+i); -  module = node->config()->modules[name]; +  orig = node->config()->enable_module(name+"#"+i);    -  if(!module) return http_string_answer("This module could not be enabled.\n"); +  if(!orig) return http_string_answer("This module could not be enabled.\n");    -  +  module = node->config()->modules[name];    node = node->descend(module->name);    // Now it is the (probably unbuilt) module main node...       node->data = module;    node->describer = describe_module;    node->type = NODE_MODULE;    build_module(node);       // We want to see the new module..    node->folded=0;
Roxen.git/server/base_server/mainconfig.pike:486:    {    node->folded = 0;    // Mark the node and all its parents as modified.    node->change(1);    }    return std_redirect(root, id);   }      mixed new_module_copy_copy(object node, object id)   { -  roxen->current_configuration = node->config(); +     return new_module_copy(node, node->data->sname, id);   }      string new_module_form(object id, object node)   {    int i;    mixed a,b;    string q;    array mods;    array (string) res;       if(!roxen->allmodules || sizeof(id->pragma))    {    perror("CONFIG: Rescanning modules.\n"); -  +  roxen->current_configuration = node->config();    roxen->rescan_modules(); -  +  roxen->current_configuration = 0;    perror("CONFIG: Done.\n");    }       a=roxen->allmodules;    mods=sort_array(indices(a), lambda(string a, string b, mapping m) {    return m[a][0] > m[b][0];    }, a);       res = ({default_head("Add a module")+"\n\n"+    "<h2>Select a module to add from the list below</h2>" });
Roxen.git/server/base_server/mainconfig.pike:582:    case "Global variables":    return 0;    break;       default:    object o, confnode;       switch(lower_case((type/" ")[0]))    {    default: /* Minimal configuration */ -  roxen->enable_configuration(name); +  o=roxen->enable_configuration(name);    break;       case "standard": -  roxen->enable_configuration(name); -  roxen->enable_module("cgi#0"); -  roxen->enable_module("contenttypes#0"); -  roxen->enable_module("ismap#0"); -  roxen->enable_module("pikescript#0"); -  roxen->enable_module("htmlparse#0"); -  roxen->enable_module("directories#0"); -  roxen->enable_module("userdb#0"); -  roxen->enable_module("userfs#0"); // I _think_ we want this. -  roxen->enable_module("filesystem#0"); +  o = roxen->enable_configuration(name); +  o->enable_module("cgi#0"); +  o->enable_module("contenttypes#0"); +  o->enable_module("ismap#0"); +  o->enable_module("pikescript#0"); +  o->enable_module("htmlparse#0"); +  o->enable_module("directories#0"); +  o->enable_module("userdb#0"); +  o->enable_module("userfs#0"); // I _think_ we want this. +  o->enable_module("filesystem#0");    break;       case "ipp": -  roxen->enable_configuration(name); -  roxen->enable_module("contenttypes#0"); -  roxen->enable_module("ismap#0"); -  roxen->enable_module("htmlparse#0"); -  roxen->enable_module("directories#0"); -  roxen->enable_module("filesystem#0"); +  o=roxen->enable_configuration(name); +  o->enable_module("contenttypes#0"); +  o->enable_module("ismap#0"); +  o->enable_module("htmlparse#0"); +  o->enable_module("directories#0"); +  o->enable_module("filesystem#0");    break;       case "proxy": -  roxen->enable_configuration(name); -  roxen->enable_module("proxy#0"); -  roxen->enable_module("gopher#0"); -  roxen->enable_module("ftpgateway#0"); -  roxen->enable_module("contenttypes#0"); -  roxen->enable_module("wais#0"); +  o=roxen->enable_configuration(name); +  o->enable_module("proxy#0"); +  o->enable_module("gopher#0"); +  o->enable_module("ftpgateway#0"); +  o->enable_module("contenttypes#0"); +  o->enable_module("wais#0");    break;       case "copy":    string from;    mapping tmp;    sscanf(type, "%*s'%s'", from);    tmp = roxen->copy_configuration(from, name);    if(!tmp) error("No configuration to copy from!\n");    tmp["spider#0"]->LogFile = "../logs/"    +roxen->short_name(name)+"/Log";
Roxen.git/server/base_server/mainconfig.pike:1066:    // caches and stuff has to be unvalidated..    case "refresh":    case "reload":    object mod;    string name, modname;    mapping cmod;       mod = module_of(o);    if(!mod || mod==roxen)    error("This module cannot be updated.\n"); -  name = module_short_name(mod); +  name = module_short_name(mod, o->config());    if(!name)    error("This module cannot be updated");    sscanf(name, "%s#%*s", modname); -  roxen->current_configuration = o->config(); +     if(!(cmod = o->config()->modules[ modname ]))    error("This module cannot be updated");       o->save();    cache_remove("modules", modname);    _master->set_inhibit_compile_errors(1);    -  if(!roxen->load_module(modname)) +  if(!o->config()->load_module(modname))    {    mapping rep;    rep = http_string_answer("The reload of this module failed.\n"    "This is (probably) the reason:\n<pre>"    + _master->errors + "</pre>" );    _master->set_inhibit_compile_errors(0);    return rep;    }    object mod; -  if(!roxen->disable_module(name)) error("Failed to disable module.\n"); -  if(!(mod=roxen->enable_module(name)))error("Failed to enable module.\n"); +  if(!o->config()->disable_module(name))error("Failed to disable module.\n"); +  if(!(mod=o->config()->enable_module(name)))error("Failed to enable module.\n");       o->clear(); -  roxen->fork_it(); + // roxen->fork_it();       if(mappingp(o->data))    {    o->data = o->config()->modules[modname];    build_module(o);    } else {    object n = o->up;    n->clear();    n->data = n->config()->modules[modname];    build_module(n);
Roxen.git/server/base_server/mainconfig.pike:1210:       case NODE_MODULE_COPY_VARIABLE:    case NODE_MODULE_COPY_VARIABLES:    // Ehum? Lets zap the module instead of it's variables...    o=o->up;       case NODE_MODULE_COPY:    string name;    object n;    -  name = module_short_name(o->data); -  roxen->disable_module(name); +  name = module_short_name(o->data, o->config()); +  o->conf()->disable_module(name);    // Remove the suitable part of the configuration file. -  roxen->remove(name); +  roxen->remove(name, o->conf());    o->change(-o->changed);    n=o->up;    o->dest();       if(!objectp(n))    {    o=root;    // Error, really, no parent module for this module class.    } else {    if(!sizeof(n->data->copies))
Roxen.git/server/base_server/mainconfig.pike:1260:    if(sizeof(o->data->copies))    {    int i;    array a,b;    a=indices(o->data->copies);    b=values(o->data->copies);    name=o->config()->otomod[b[0]];    i=sizeof(a);    while(i--)    { -  roxen->disable_module(name+"#"+a[i]); -  roxen->remove(name+"#"+a[i]); +  o->config()->disable_module(name+"#"+a[i]); +  roxen->remove(name+"#"+a[i], o->config());    }    } else if(o->data->master) {    name=o->config()->otomod[o->data->enabled];    }    } else if(o->data->enabled) {    name=o->config()->otomod[o->data->enabled]; -  roxen->disable_module(name+"#0"); -  roxen->remove(name+"#0"); +  o->config()->disable_module(name+"#0"); +  roxen->remove(name+"#0", o->config());    }    o->change(-o->changed);    o->dest();    break;    }    break;          // Create a new configuration. All the work is done in another    // function.. This _should_ be the case with some of the other