Roxen.git / server / base_server / configuration.pike

version» Context lines:

Roxen.git/server/base_server/configuration.pike:1:   // A vitual server's main configuration   // Copyright © 1996 - 2000, Roxen IS.    - constant cvs_version = "$Id: configuration.pike,v 1.343 2000/08/19 01:27:31 per Exp $"; + constant cvs_version = "$Id: configuration.pike,v 1.344 2000/08/19 01:39:17 per Exp $";   constant is_configuration = 1;   #include <module.h>   #include <module_constants.h>   #include <roxen.h>   #include <request_trace.h>      inherit "basic_defvar";      mapping enabled_modules = ([]);   mapping(string:array(int)) error_log=([]);
Roxen.git/server/base_server/configuration.pike:166:   int received;   //! Bytes data received      // Will write a line to the log-file. This will probably be replaced   // entirely by log-modules in the future, since this would be much   // cleaner.   function(string:int) log_function;      // The logging format used. This will probably move to the above   // mentioned module in the future. - private mapping (string:string) log_format = ([]); + private mapping (int:string) log_format = ([]);      // A list of priority objects   private array (Priority) pri = allocate_pris();      public mapping modules = ([]);   //! All enabled modules in this virtual server.   //! The format is "module":{ "copies":([ num:instance, ... ]) }      public mapping (RoxenModule:string) otomod = ([]);   //! A mapping from the module objects to module names
Roxen.git/server/base_server/configuration.pike:516:    sscanf(s, "%*[\t ]%s", s);    return s;   }      private void parse_log_formats()   {    string b;    array foo=query("LogFormat")/"\n";    foreach(foo, b)    if(strlen(b) && b[0] != '#' && sizeof(b/":")>1) -  log_format[(b/":")[0]] = fix_logging((b/":")[1..]*":"); +  log_format[(int)(b/":")[0]] = fix_logging((b/":")[1..]*":");   }      public void log(mapping file, RequestID request_id)   { -  string form; +     function f;      // Call all logging functions    foreach(logger_module_cache||logger_modules(request_id), f)    if( f( request_id, file ) )    return;    -  if(!log_function || !request_id) +  if( !log_function )    return;// No file is open for logging.    -  -  if(QUERY(NoLog) && -  Roxen._match(request_id->remoteaddr, QUERY(NoLog))) +  if(do_not_log_patterns && +  Roxen._match(request_id->remoteaddr, do_not_log_patterns))    return;    -  if(!(form=log_format[(string)file->error])) -  form = log_format["*"]; -  +  string form; +  if(!(form=log_format[file->error])) +  form = log_format[0];    if(!form) return;    -  roxen.LogFormat fmt = roxen.compile_format( form ); -  fmt->log( log_function, request_id, file ); +  roxen.run_log_format( form, log_function, request_id, file );   }      // These are here for statistics and debug reasons only.   public string status()   {    float tmp;    string res="";    float dt = (float)(time(1) - roxen->start_time + 1);       res = "<p><table>";
Roxen.git/server/base_server/configuration.pike:1999:    return res;   }      int(0..1) is_file(string virt_path, RequestID id)   //! Is `virt_path' a file in our virtual filesystem?   {    return !!stat_file(virt_path, id);   }      array registered_urls = ({}); + array do_not_log_patterns = 0;   void start(int num)   {    // Note: This is run as root if roxen is started as root    foreach( query( "URLs" )-registered_urls, string url )    {    registered_urls += ({ url });    roxenp()->register_url( url, this_object() );    }    foreach( registered_urls-query("URLs"), string url )    {    registered_urls -= ({ url });    roxenp()->unregister_url( url );    }    if( !datacache )    datacache = DataCache( );    else    datacache->init_from_variables(); -  +  +  parse_log_formats(); +  init_log_file(); +  do_not_log_patterns = query("NoLog"); +  if(!sizeof(do_not_log_patterns)) +  do_not_log_patterns = 0;   }      void save_me()   {    save_one( 0 );   }      void save(int|void all)   //! Save this configuration. If all is included, save all configuration   //! global variables as well, otherwise only all module variables.
Roxen.git/server/base_server/configuration.pike:2742:    report_debug("\nEnabling all modules for "+query_name()+"... \n");       add_parse_module( (object)this_object() );    enabled_modules = retrieve("EnabledModules", this_object());    object ec = roxenloader.LowErrorContainer();    roxenloader.push_compile_error_handler( ec );       array modules_to_process = indices( enabled_modules );    string tmp_string;    -  parse_log_formats(); -  init_log_file(); -  +     // Always enable the user database module first.    if(search(modules_to_process, "userdb#0")>-1)    modules_to_process = (({"userdb#0"})+(modules_to_process-({"userdb#0"})));       array err;    forcibly_added = (<>);    enable_module_batch_msgs = 1;    foreach( modules_to_process, tmp_string )    {    if( !forcibly_added[ tmp_string ] )