Branch: Tag:

2000-11-02

2000-11-02 08:48:45 by Per Hedbor <ph@opera.com>

Fixed [Bug 512 (#512)], changing extensions (or priority) immediately takes effect.

Rev: server/base_server/configuration.pike:1.388
Rev: server/base_server/module.pike:1.100

1:   // A vitual server's main configuration   // Copyright © 1996 - 2000, Roxen IS. - constant cvs_version = "$Id: configuration.pike,v 1.387 2000/11/02 08:30:38 per Exp $"; + constant cvs_version = "$Id: configuration.pike,v 1.388 2000/11/02 08:48:45 per Exp $";   #include <module.h>   #include <module_constants.h>   #include <roxen.h>
2473:    }   }    - int disable_module( string modname, int|void nodest ) + void module_changed( ModuleInfo moduleinfo, +  RoxenModule me )   { -  MODULE_LOCK; -  RoxenModule me; -  int id, pr; -  sscanf(modname, "%s#%d", modname, id ); -  -  if( datacache ) datacache->flush(); -  -  ModuleInfo moduleinfo = roxen.find_module( modname ); -  mapping module = modules[ modname ]; -  string descr = moduleinfo->get_name() + (id ? " copy " + (id + 1) : ""); -  -  if(!module) -  { -  report_error("disable_module(): " + -  LOC_M(42, "Failed to disable module:\n" -  "No module by that name: \"%s\".\n"), modname); -  return 0; +  clean_up_for_module( moduleinfo, me ); +  call_low_start_callbacks( me, +  moduleinfo, +  modules[ moduleinfo->sname ] );   }    -  me = module[id]; -  m_delete(module->copies, id); -  -  if(!sizeof(module->copies)) -  m_delete( modules, modname ); -  -  invalidate_cache(); -  -  if(!me) + void clean_up_for_module( ModuleInfo moduleinfo, +  RoxenModule me )   { -  report_error("disable_module(): " + -  LOC_M(43, "Failed to disable module \"%s\".\n"), -  descr); -  return 0; -  } -  -  if(me->stop) -  if (mixed err = catch (me->stop())) { -  string bt=describe_backtrace(err); -  report_error("disable_module(): " + -  LOC_M(44, "Error while disabling module %s%s"), -  descr, (bt ? ":\n"+bt : "\n")); -  } -  - #ifdef MODULE_DEBUG -  report_debug("Disabling "+descr+"\n"); - #endif -  +  int pr;    if(moduleinfo->type & MODULE_FILE_EXTENSION)    {    string foo;
2553:    if( moduleinfo->type & MODULE_DIRECTORIES )    dir_module = 0;    -  +     if( moduleinfo->type & MODULE_LOCATION )    for(pr=0; pr<10; pr++)    pri[pr]->location_modules -= ({ me });
2578:    if( moduleinfo->type & MODULE_LOGGER )    for(pr=0; pr<10; pr++)    pri[pr]->logger_modules -= ({ me }); + }    -  + int disable_module( string modname, int|void nodest ) + { +  MODULE_LOCK; +  RoxenModule me; +  int id, pr; +  sscanf(modname, "%s#%d", modname, id );    -  +  if( datacache ) datacache->flush(); +  +  ModuleInfo moduleinfo = roxen.find_module( modname ); +  mapping module = modules[ modname ]; +  string descr = moduleinfo->get_name() + (id ? " copy " + (id + 1) : ""); +  +  if(!module) +  { +  report_error("disable_module(): " + +  LOC_M(42, "Failed to disable module:\n" +  "No module by that name: \"%s\".\n"), modname); +  return 0; +  } +  +  me = module[id]; +  m_delete(module->copies, id); +  +  if(!sizeof(module->copies)) +  m_delete( modules, modname ); +  +  invalidate_cache(); +  +  if(!me) +  { +  report_error("disable_module(): " + +  LOC_M(43, "Failed to disable module \"%s\".\n"), +  descr); +  return 0; +  } +  +  if(me->stop) +  if (mixed err = catch (me->stop())) { +  string bt=describe_backtrace(err); +  report_error("disable_module(): " + +  LOC_M(44, "Error while disabling module %s%s"), +  descr, (bt ? ":\n"+bt : "\n")); +  } +  + #ifdef MODULE_DEBUG +  report_debug("Disabling "+descr+"\n"); + #endif +  +  clean_up_for_module( moduleinfo, me ); +     m_delete( enabled_modules, modname + "#" + id );    forcibly_added[ modname + "#" + id ] = 0;    store( "EnabledModules",enabled_modules, 1, this_object());