CVS update: php31/main

From: Date: Thu, 03 Sep 1998 07:11:20 +0000
Subject: CVS update: php31/main
Groups: php.dev 
Request: Send a blank email to php-dev+get-770@lists.php.net to get a copy of this message
Date: Thursday September 3, 1998 @ 3:11 Author: shane Update of /repository/php31/main In directory asf:/u2/tmp/cvs-serv19580/main Modified Files: automated_configuration.h automated_configuration_definitions.h dl.c main.c php3_ini.c tls.h Log Message: Now here's a ton of work! per server directives working via registry per directory directives writen, untested registry functions using automated config main.c now uses automated config added some stuff to automated config info uses automated config dl fix Index: php31/main/automated_configuration.h diff -c php31/main/automated_configuration.h:2.4 php31/main/automated_configuration.h:2.5 *** php31/main/automated_configuration.h:2.4 Thu Aug 27 16:55:44 1998 --- php31/main/automated_configuration.h Thu Sep 3 03:11:18 1998 *************** *** 2,7 **** --- 2,9 ---- BEGIN_INI_TABLE() INI_ENTRY(engine, AC_BOOL, 1, AC_NO, "Turn the PHP engine on/off") + INI_ENTRY(use_registry, AC_BOOL, 0, AC_NO, "Use Win32 Registry for per-server vars") + INI_ENTRY(use_registry_dir, AC_BOOL, 0, AC_NO, "Use Win32 Registry for per-directory vars") INI_ENTRY(short_open_tag, AC_BOOL, 1, AC_YES, "Allow <? as an open tag") INI_ENTRY(precision, AC_LONG, 14, AC_YES, "Precision of floating point numbers") INI_ENTRY(y2k_compliance, AC_BOOL, 0, AC_YES, "Year 2000 compliance") *************** *** 31,37 **** INI_ENTRY(log_errors, AC_BOOL, 0, AC_NO, "Log error messages") INI_ENTRY(errors, AC_BOOL, 0, AC_NO, "apache errors") INI_ENTRY(track_errors, AC_BOOL, 0, AC_YES, "Track errors in $php_errormsg") ! INI_ENTRY(warn_plus_overloading,AC_BOOL, 0, AC_YES, "Warn when + is used with strings") INI_ENTRY(error_log, AC_STRING, NULL, AC_YES, "device on which to log errors") INI_ENTRY(error_prepend_string, AC_STRING, NULL, AC_YES, "String to add before an error msg from PHP") INI_ENTRY(error_append_string, AC_STRING, NULL, AC_YES, "String to add after an error msg from PHP") --- 33,39 ---- INI_ENTRY(log_errors, AC_BOOL, 0, AC_NO, "Log error messages") INI_ENTRY(errors, AC_BOOL, 0, AC_NO, "apache errors") INI_ENTRY(track_errors, AC_BOOL, 0, AC_YES, "Track errors in $php_errormsg") ! INI_ENTRY(warn_plus_overloading,AC_BOOL, 0, AC_YES, "log errors to specified file or syslog") INI_ENTRY(error_log, AC_STRING, NULL, AC_YES, "device on which to log errors") INI_ENTRY(error_prepend_string, AC_STRING, NULL, AC_YES, "String to add before an error msg from PHP") INI_ENTRY(error_append_string, AC_STRING, NULL, AC_YES, "String to add after an error msg from PHP") *************** *** 60,68 **** --- 62,76 ---- /* mail */ INI_ENTRY(SMTP, AC_STRING, "localhost", AC_YES, "SMTP server (Win32 only)") + INI_ENTRY(domain, AC_STRING, "localhost.com", AC_YES, "SMTP server (Win32 only)") INI_ENTRY(sendmail_from, AC_STRING, "me@localhost.com", AC_YES, "Sendmail From: field (Win32 only)") INI_ENTRY(sendmail_path, AC_STRING, NULL, AC_YES, "Path to sendmail binary, including switches (UNIX only)") + /* debugger */ + GROUP_INI_ENTRY(debugger, host, AC_STRING, "localhost",AC_YES, "Debugger host") + GROUP_INI_ENTRY(debugger, port, AC_LONG, 7869, AC_YES, "Debugger port") + GROUP_INI_ENTRY(debugger, enabled, AC_LONG, 0, AC_YES, "Debugger enabled") + /* logging */ GROUP_INI_ENTRY(logging, method, AC_STRING, NULL, AC_YES, "Logging method") GROUP_INI_ENTRY(logging, directory, AC_STRING, NULL, AC_YES, "Logging directory") *************** *** 72,75 **** --- 80,86 ---- /* browscap */ INI_ENTRY(browscap, AC_STRING, NULL, AC_YES, "Path to browscap file") + + /* browscap */ + GROUP_INI_ENTRY(bcmath, scale, AC_LONG, 0, AC_YES, "BCMath Default Scale") END_INI_TABLE() Index: php31/main/automated_configuration_definitions.h diff -c php31/main/automated_configuration_definitions.h:2.2 php31/main/automated_configuration_definitions.h:2.3 *** php31/main/automated_configuration_definitions.h:2.2 Fri Aug 21 16:03:38 1998 --- php31/main/automated_configuration_definitions.h Thu Sep 3 03:11:18 1998 *************** *** 252,257 **** --- 252,321 ---- + #elif defined(AC_REGISTRY_TABLE) && !defined(AC_REGISTRY_TABLE_DONE) + # define BEGIN_INI_TABLE() struct _php3_reg_vars php3_reg_vars[]={ + # define END_INI_TABLE() {NULL,NULL,0,0,0} }; + # define AC_LONG 1 + # define AC_DOUBLE 3 + # define AC_STRING 2 + # define AC_BOOL AC_LONG + # define AC_YES 1 + # define AC_NO 0 + # define AC_NO_SAFEMODE AC_NO + # define INI_ENTRY(name, type, default_value, user_modifyable, description) \ + { #name, (void *)&GLOBAL(php3_ini)->name, type, user_modifyable, NULL }, + # define GROUP_INI_ENTRY(group_name, name, type, default_value, user_modifyable, description) \ + { #group_name "." #name, (void *)&GLOBAL(php3_ini)->group_name##_##name, type, user_modifyable, NULL }, + + + #elif defined(AC_REGISTRY_TABLE_FREE) && !defined(AC_REGISTRY_TABLE_FREE_DONE) + # define BEGIN_INI_TABLE() + # define END_INI_TABLE() + # define AC_LONG 0 + # define AC_DOUBLE 0 + # define AC_STRING 1 + # define AC_BOOL AC_LONG + # define AC_YES 1 + # define AC_NO 0 + # define AC_NO_SAFEMODE AC_NO + # define INI_ENTRY(name, type, default_value, user_modifyable, description) \ + if (user_modifyable && type) efree(GLOBAL(php3_ini)->name; + # define GROUP_INI_ENTRY(group_name, name, type, default_value, user_modifyable, description) \ + if (user_modifyable && type) efree(GLOBAL(php3_ini)->group_name##_##name; + + #elif defined(AC_INFO_TABLE) && !defined(AC_INFO_TABLE_DONE) + # define BEGIN_INI_TABLE() + # define END_INI_TABLE() + # define AC_LONG 1 + # define AC_DOUBLE 2 + # define AC_STRING 3 + # define AC_BOOL AC_LONG + # define AC_YES 1 + # define AC_NO 0 + # define AC_NO_SAFEMODE AC_NO + # define INI_ENTRY(name, type, default_value, user_modifyable, description) \ + PHP3_CONF_OUT( #name, type, php3_ini_master.name, GLOBAL(php3_ini)->name); + # define GROUP_INI_ENTRY(group_name, name, type, default_value, user_modifyable, description) \ + PHP3_CONF_OUT( #group_name "." #name , type, php3_ini_master.group_name##_##name, GLOBAL(php3_ini)->group_name##_##name); + + #elif defined(AC_MASTER_INI_TABLE) && !defined(AC_MASTER_INI_TABLE_DONE) + + # define BEGIN_INI_TABLE() + # define END_INI_TABLE() + # define AC_LONG 1 + # define AC_DOUBLE 2 + # define AC_STRING 3 + # define AC_BOOL AC_LONG + # define AC_YES 1 + # define AC_NO 0 + # define AC_NO_SAFEMODE AC_NO + + + + # define INI_ENTRY(name, type, default_value, user_modifyable, description) \ + if(!cfg_get_ini_var(type, #name, (void *)&php3_ini_master.name)){php3_ini_master.name=default_value;} + # define GROUP_INI_ENTRY(group_name, name, type, default_value, user_modifyable, description) \ + if(!cfg_get_ini_var(type, #group_name "." #name, (void *)&php3_ini_master.group_name##_##name)){php3_ini_master.group_name##_##name=default_value;} #else # define BEGIN_INI_TABLE() Index: php31/main/dl.c diff -c php31/main/dl.c:2.1 php31/main/dl.c:2.2 *** php31/main/dl.c:2.1 Tue Sep 1 16:21:23 1998 --- php31/main/dl.c Thu Sep 3 03:11:19 1998 *************** *** 266,274 **** newdl->module_entry=NULL; if(!dllist){ dllist=(void *)newdl; ! newdl->next=newdl; }else{ ! newdl->next=main; main->next=newdl; } } --- 266,274 ---- newdl->module_entry=NULL; if(!dllist){ dllist=(void *)newdl; ! newdl->next=(dl_plist *)dllist; }else{ ! newdl->next=main->next; main->next=newdl; } } Index: php31/main/main.c diff -c php31/main/main.c:2.31 php31/main/main.c:2.32 *** php31/main/main.c:2.31 Wed Sep 2 15:18:24 1998 --- php31/main/main.c Thu Sep 3 03:11:19 1998 *************** *** 29,35 **** +----------------------------------------------------------------------+ */ ! /* $Id: main.c,v 2.31 1998/09/02 19:18:24 shane Exp $ */ /* #define CRASH_DETECTION */ --- 29,35 ---- +----------------------------------------------------------------------+ */ ! /* $Id: main.c,v 2.32 1998/09/03 07:11:19 shane Exp $ */ /* #define CRASH_DETECTION */ *************** *** 536,541 **** --- 536,548 ---- start_memory_manager(); + /*get the server config from the registry, if we are using that*/ + #if WIN32|WINNT + if (php3_ini_master.use_registry) { + _reg_get_server_config(GLOBAL(sapi_rqst)->server_name _INLINE_TLS); + } + #endif + /* * For the Apache module version, this bit of code registers a cleanup * function that gets triggered when our request pool is destroyed. *************** *** 831,836 **** --- 838,848 ---- #if 0 debug_log("%d:timer unset\n",GetCurrentThreadId()); #endif + + /* FIXME free up per-server config */ + #if WIN32|WINNT + /*_reg_free_server_config();*/ + #endif /* FIXME ok we're freeing the ini now */ free(GLOBAL(php3_ini)); *************** *** 838,843 **** --- 850,887 ---- GLOBAL(sapi_rqst)->flush(SAPI_GLOBAL_PASS_V); } + + int cfg_get_ini_var(int type, char *name, void *address){ + if (type == 1) { + if (cfg_get_long( name, ((long *)address)) == FAILURE) { + return 0; + } + #if 0 /* keep around a bit longer whilst I debug further */ + else { + char buf[20]; + OutputDebugString(name); + OutputDebugString(" = "); + snprintf(buf,20,"%u",*((long *)address)); + OutputDebugString(buf); + OutputDebugString("\n"); + } + #endif + } else if(type == 3) { + if (cfg_get_string( name, ((char **)address)) == FAILURE) { + return 0; + } + #if 0 /* keep around a bit longer whilst I debug further */ + else { + OutputDebugString(name); + OutputDebugString(" = "); + OutputDebugString(*((char **)address)); + OutputDebugString("\n"); + } + #endif + } + } + + static int php3_config_ini_startup(INLINE_TLS_VOID) { if (php3_init_config() == FAILURE) { *************** *** 847,1022 **** #if !USE_SAPI GLOBAL(module_initialized) |= INIT_CONFIG; #endif - /* initialize run-time variables */ - /* I have remarked out some stuff - that may or may not be needed */ - { - char *temp; ! if (cfg_get_long("max_execution_time", &php3_ini_master.max_execution_time) == FAILURE) { ! php3_ini_master.max_execution_time = 30; ! } ! if (cfg_get_long("memory_limit", &php3_ini_master.memory_limit) == FAILURE) { ! php3_ini_master.memory_limit = 8 * 1048576; ! } ! if (cfg_get_long("precision", &php3_ini_master.precision) == FAILURE) { ! php3_ini_master.precision = 14; ! } ! if (cfg_get_string("SMTP", &php3_ini_master.SMTP) == FAILURE) { ! php3_ini_master.SMTP = "localhost"; ! } ! if (cfg_get_string("sendmail_path", &php3_ini_master.sendmail_path) == FAILURE ! || !php3_ini_master.sendmail_path[0]) { ! #ifdef PHP_PROG_SENDMAIL ! php3_ini_master.sendmail_path = PHP_PROG_SENDMAIL " -t"; ! #else ! php3_ini_master.sendmail_path = NULL; ! #endif ! } ! if (cfg_get_string("sendmail_from", &php3_ini_master.sendmail_from) == FAILURE) { ! php3_ini_master.sendmail_from = NULL; ! } ! if (cfg_get_string("error_log", &php3_ini_master.error_log) == FAILURE) { ! php3_ini_master.error_log = NULL; ! } ! if (cfg_get_long("error_reporting", &php3_ini_master.error_reporting) == FAILURE) { ! php3_ini_master.error_reporting = 7; ! } ! ! if (cfg_get_long("track_errors", &php3_ini_master.track_errors) == FAILURE) { ! php3_ini_master.track_errors = 0; ! } ! if (cfg_get_long("display_errors", &php3_ini_master.display_errors) == FAILURE) { ! php3_ini_master.display_errors = 1; ! } ! if (cfg_get_long("log_errors", &php3_ini_master.log_errors) == FAILURE) { ! php3_ini_master.log_errors = 0; ! } ! if (cfg_get_long("warn_plus_overloading", &php3_ini_master.warn_plus_overloading) == FAILURE) { ! php3_ini_master.warn_plus_overloading = 0; ! } ! if (cfg_get_long("magic_quotes_gpc", &php3_ini_master.magic_quotes_gpc) == FAILURE) { ! php3_ini_master.magic_quotes_gpc = MAGIC_QUOTES; ! } ! if (cfg_get_long("magic_quotes_runtime", &php3_ini_master.magic_quotes_runtime) == FAILURE) { ! php3_ini_master.magic_quotes_runtime = MAGIC_QUOTES; ! } ! if (cfg_get_long("magic_quotes_sybase", &php3_ini_master.magic_quotes_sybase) == FAILURE) { ! php3_ini_master.magic_quotes_sybase = 0; ! } ! if (cfg_get_long("y2k_compliance", &php3_ini_master.y2k_compliance) == FAILURE) { ! php3_ini_master.y2k_compliance = 0; ! } ! if (cfg_get_long("define_syslog_variables", &php3_ini_master.define_syslog_variables) == FAILURE) { ! php3_ini_master.define_syslog_variables = 0; ! } ! if (cfg_get_string("doc_root", &php3_ini_master.doc_root) == FAILURE) { ! if ((temp = getenv("PHP_DOCUMENT_ROOT"))) { ! php3_ini_master.doc_root = temp; ! } else { ! php3_ini_master.doc_root = NULL; ! } ! } ! if (cfg_get_long("short_open_tag", &php3_ini_master.short_open_tag) == FAILURE) { ! php3_ini_master.short_open_tag = DEFAULT_SHORT_OPEN_TAG; ! } ! if (cfg_get_string("user_dir", &php3_ini_master.user_dir) == FAILURE) { ! if ((temp = getenv("PHP_USER_DIR"))) { ! php3_ini_master.user_dir = temp; ! } else { ! php3_ini_master.user_dir = NULL; ! } ! } ! if (cfg_get_long("safe_mode", &php3_ini_master.safe_mode) == FAILURE) { ! php3_ini_master.safe_mode = PHP_SAFE_MODE; ! } ! if (cfg_get_string("safe_mode_exec_dir", &php3_ini_master.safe_mode_exec_dir) == FAILURE) { ! #ifdef PHP_SAFE_MODE_EXEC_DIR ! php3_ini_master.safe_mode_exec_dir = PHP_SAFE_MODE_EXEC_DIR; ! #else ! php3_ini_master.safe_mode_exec_dir = "/"; ! #endif ! } ! if (cfg_get_long("track_vars", &php3_ini_master.track_vars) == FAILURE) { ! php3_ini_master.track_vars = PHP_TRACK_VARS; ! } ! if (cfg_get_string("include_path", &php3_ini_master.include_path) == FAILURE) { ! if ((temp = getenv("PHP_INCLUDE_PATH"))) { ! php3_ini_master.include_path = temp; ! } else { ! php3_ini_master.include_path = NULL; ! } ! } ! if (cfg_get_string("auto_prepend_file", &php3_ini_master.auto_prepend_file) == FAILURE) { ! if ((temp = getenv("PHP_AUTO_PREPEND_FILE"))) { ! php3_ini_master.auto_prepend_file = temp; ! } else { ! php3_ini_master.auto_prepend_file = NULL; ! } ! } ! if (cfg_get_string("auto_append_file", &php3_ini_master.auto_append_file) == FAILURE) { ! if ((temp = getenv("PHP_AUTO_APPEND_FILE"))) { ! php3_ini_master.auto_append_file = temp; ! } else { ! php3_ini_master.auto_append_file = NULL; ! } ! } ! if (cfg_get_string("upload_tmp_dir", &php3_ini_master.upload_tmp_dir) == FAILURE) { ! /* GLOBAL(php3_ini)->upload_tmp_dir = UPLOAD_TMPDIR; */ ! php3_ini_master.upload_tmp_dir = NULL; ! } ! if (cfg_get_long("upload_max_filesize", &php3_ini_master.upload_max_filesize) == FAILURE) { ! php3_ini_master.upload_max_filesize = 2097152; /* 2 Meg default */ ! } ! if (cfg_get_string("extension_dir", &php3_ini_master.extension_dir) == FAILURE) { ! php3_ini_master.extension_dir = NULL; ! } ! if (cfg_get_long("sql.safe_mode", &php3_ini_master.sql_safe_mode) == FAILURE) { ! php3_ini_master.sql_safe_mode = 0; ! } ! /* Syntax highlighting */ ! if (cfg_get_string("highlight.comment", &php3_ini_master.highlight_comment) == FAILURE) { ! php3_ini_master.highlight_comment = HL_COMMENT_COLOR; ! } ! if (cfg_get_string("highlight.default", &php3_ini_master.highlight_default) == FAILURE) { ! php3_ini_master.highlight_default = HL_DEFAULT_COLOR; ! } ! if (cfg_get_string("highlight.html", &php3_ini_master.highlight_html) == FAILURE) { ! php3_ini_master.highlight_html = HL_HTML_COLOR; ! } ! if (cfg_get_string("highlight.string", &php3_ini_master.highlight_string) == FAILURE) { ! php3_ini_master.highlight_string = HL_STRING_COLOR; ! } ! if (cfg_get_string("highlight.bg", &php3_ini_master.highlight_bg) == FAILURE) { ! php3_ini_master.highlight_bg = HL_BG_COLOR; ! } ! if (cfg_get_string("highlight.keyword", &php3_ini_master.highlight_keyword) == FAILURE) { ! php3_ini_master.highlight_keyword = HL_KEYWORD_COLOR; ! } ! if (cfg_get_long("engine", &php3_ini_master.engine) == FAILURE) { ! php3_ini_master.engine = 1; ! } ! if (cfg_get_long("last_modified", &php3_ini_master.last_modified) == FAILURE) { ! php3_ini_master.last_modified = 0; ! } ! if (cfg_get_long("xbithack", &php3_ini_master.xbithack) == FAILURE) { ! php3_ini_master.xbithack = 0; ! } ! if (cfg_get_string("browscap", &php3_ini_master.browscap) == FAILURE) { ! php3_ini_master.browscap = NULL; ! } ! if (cfg_get_string("arg_separator", &php3_ini_master.arg_separator) == FAILURE) { ! php3_ini_master.arg_separator = "&"; ! } ! if (cfg_get_string("gpc_order", &php3_ini_master.gpc_order) == FAILURE) { ! php3_ini_master.gpc_order = "GPC"; ! } ! if (cfg_get_string("open_basedir", &php3_ini_master.open_basedir) == FAILURE) { ! php3_ini_master.open_basedir = NULL; ! } ! if (cfg_get_long("enable_dl", &php3_ini_master.enable_dl) == FAILURE) { ! php3_ini_master.enable_dl = 1; ! } } #if defined(CRASH_DETECTION) debug_log("%d:INI OK\n",GetCurrentThreadId()); --- 891,903 ---- #if !USE_SAPI GLOBAL(module_initialized) |= INIT_CONFIG; #endif ! /* now using the new nifty auto configurator */ ! { ! #define AC_MASTER_INI_TABLE ! #include "automated_configuration_definitions.h" ! #include "automated_configuration.h" ! #undef AC_MASTER_INI_TABLE } #if defined(CRASH_DETECTION) debug_log("%d:INI OK\n",GetCurrentThreadId()); *************** *** 1569,1575 **** return FAILURE; } ! // GLOBAL(sapi_rqst)->treat_headers(SAPI_GLOBAL_PASS_V); php3_treat_headers(_INLINE_TLS_VOID); #if defined(CRASH_DETECTION) --- 1450,1459 ---- return FAILURE; } ! #if WIN32|WINNT ! _reg_get_directory_config(_INLINE_TLS_VOID); ! #endif ! php3_treat_headers(_INLINE_TLS_VOID); #if defined(CRASH_DETECTION) Index: php31/main/php3_ini.c diff -c php31/main/php3_ini.c:2.1 php31/main/php3_ini.c:2.2 *** php31/main/php3_ini.c:2.1 Fri Aug 21 13:37:06 1998 --- php31/main/php3_ini.c Thu Sep 3 03:11:19 1998 *************** *** 12,29 **** */ PHPAPI void *_php3_copy_ini_master(void) { ! php3_ini_structure *newiniini; ! newiniini = (php3_ini_structure *) malloc(sizeof(php3_ini_structure)); ! memcpy(newiniini,&php3_ini_master,sizeof(php3_ini_structure)); ! return newiniini; } PHPAPI void _php3_set_ini(php3_ini_structure *conf){ TLS_VARS; ! GLOBAL(php3_ini)=_php3_copy_ini_master(); if(conf)memcpy(GLOBAL(php3_ini),conf,sizeof(php3_ini_structure)); } --- 12,29 ---- */ PHPAPI void *_php3_copy_ini_master(void) { ! php3_ini_structure *newini; ! newini = (php3_ini_structure *) malloc(sizeof(php3_ini_structure)); ! memcpy(newini,&php3_ini_master,sizeof(php3_ini_structure)); ! return newini; } PHPAPI void _php3_set_ini(php3_ini_structure *conf){ TLS_VARS; ! /* GLOBAL(php3_ini)=_php3_copy_ini_master(); */ if(conf)memcpy(GLOBAL(php3_ini),conf,sizeof(php3_ini_structure)); } Index: php31/main/tls.h diff -c php31/main/tls.h:2.10 php31/main/tls.h:2.11 *** php31/main/tls.h:2.10 Tue Sep 1 12:58:42 1998 --- php31/main/tls.h Thu Sep 3 03:11:19 1998 *************** *** 207,212 **** --- 207,213 ---- /*registry.c*/ int registry_hkey_id; int registry_le_hkey; + DWORD use_registry; #endif /*check for each module if it is compiled staticly we should include their globals here.*/ -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#770) next »