CVS update: php31/os/nt
| From: | shane | Date: | Thu, 03 Sep 1998 18:42:07 +0000 |
| Subject: | CVS update: php31/os/nt | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-780@lists.php.net to get a copy of this message | ||
Date: Thursday September 3, 1998 @ 14:42
Author: shane
Update of /repository/php31/os/nt
In directory asf:/u2/tmp/cvs-serv25682/os/nt
Modified Files:
registry.c
Log Message:
Per server/directory reading much optimized.
Index: php31/os/nt/registry.c
diff -c php31/os/nt/registry.c:1.4 php31/os/nt/registry.c:1.5
*** php31/os/nt/registry.c:1.4 Thu Sep 3 03:11:21 1998
--- php31/os/nt/registry.c Thu Sep 3 14:42:07 1998
***************
*** 515,521 ****
if (_php3_win32_reg_read_value(pRegKey, key, &dwSize, &dwType, pbuffer, &dwbSize
_INLINE_TLS)) {
if (dwType == REG_SZ) {
! #if 0
{
char buf[10];
snprintf(buf,10," (%u) = ",dwSize);
--- 515,521 ----
if (_php3_win32_reg_read_value(pRegKey, key, &dwSize, &dwType, pbuffer, &dwbSize
_INLINE_TLS)) {
if (dwType == REG_SZ) {
! #if 1
{
char buf[10];
snprintf(buf,10," (%u) = ",dwSize);
***************
*** 599,635 ****
! _reg_value *_reg_get_server_val(char *server, int type, char *var_name){
! DWORD dwType;
! TCHAR regkey[1024];
! TCHAR *temp;
! _reg_value *value=emalloc(sizeof(_reg_value));
!
! value->lval=0;
!
! snprintf(regkey, 1024, "%s%s\\%s", PHP_REG_KEY, server, var_name);
! switch (type) {
! case 1:
! temp=_php3_win32_reg_read(regkey,&dwType);
! if (temp) {
! value->lval=atol(temp);
! efree(temp);
! }
! return value;
! break;
! case 2:
! value->strval=_php3_win32_reg_read(regkey,&dwType);
! return value;
! break;
! default:
! efree(value);
! return NULL;
! break;
! }
! }
! void _reg_get_server_config(char *server INLINE_TLS){
int i=0;
#define AC_REGISTRY_TABLE
--- 599,616 ----
! /*******************************************************\
! * The following functions handle per server direcive
! * cacheing
! \*******************************************************/
! /*******************************************************\
! * The following functions handle getting per server
! * and per directory directives
! \*******************************************************/
!
! void _reg_set_server_var(BYTE *name, BYTE *value INLINE_TLS){
int i=0;
#define AC_REGISTRY_TABLE
***************
*** 638,686 ****
#undef AC_REGISTRY_TABLE
while(php3_reg_vars[i].name){
! if(php3_reg_vars[i].user_modify){
! php3_reg_vars[i].value = _reg_get_server_val(
! server,
! php3_reg_vars[i].type, php3_reg_vars[i].name);
! OutputDebugString(php3_reg_vars[i].name);
! OutputDebugString(" = ");
switch (php3_reg_vars[i].type) {
! case AC_LONG:
! if(php3_reg_vars[i].value->lval) {
! char buf[5];
! snprintf(buf,4,"%u",php3_reg_vars[i].value->lval);
! OutputDebugString(buf);
! (*(DWORD *)php3_reg_vars[i].address) = php3_reg_vars[i].value->lval;
! }
! break;
! case AC_STRING:
! if(php3_reg_vars[i].value->strval) {
! OutputDebugString(php3_reg_vars[i].value->strval);
! (*(char **)php3_reg_vars[i].address) = php3_reg_vars[i].value->strval;
! }
! break;
}
- OutputDebugString("\n");
- if(php3_reg_vars[i].value)efree(php3_reg_vars[i].value);
}
i++;
}
}
! void _reg_get_directory_config(INLINE_TLS_VOID){
char regkey[1024];
!
! if(GLOBAL(php3_ini)->use_registry_dir && GLOBAL(sapi_rqst)->server_name &&
GLOBAL(sapi_rqst)->path_info){
! snprintf(regkey, 1024, "%s\\%s", GLOBAL(sapi_rqst)->server_name,
GLOBAL(sapi_rqst)->path_info);
! CONVERT_TO_WIN_FS(regkey);
! _reg_get_server_config(regkey _INLINE_TLS);
}
}
/* FIXME not finished here on down. */
! void _reg_free_server_config(INLINE_TLS_VOID){
char *server=NULL;
int i;
#define AC_REGISTRY_TABLE
--- 619,703 ----
#undef AC_REGISTRY_TABLE
while(php3_reg_vars[i].name){
! if(!stricmp(name,php3_reg_vars[i].name) &&
! (php3_reg_vars[i].user_modify == AC_YES ||
! (php3_reg_vars[i].user_modify == AC_NO_SAFEMODE &&
! !php3_ini_master.safe_mode))){
!
switch (php3_reg_vars[i].type) {
! case AC_LONG:
! (*(DWORD *)php3_reg_vars[i].address) = atol(value);
! break;
! case AC_STRING:
! if (stricmp(php3_reg_vars[i].name,"include_path")) {
! (*(char **)php3_reg_vars[i].address) = estrdup(value);
! } else {
! int size=strlen(GLOBAL(php3_ini)->include_path)+strlen(value)+2;
! BYTE *temp=emalloc(size);
!
! snprintf(temp, size, "%s;%s", value, GLOBAL(php3_ini)->include_path);
! (*(char **)php3_reg_vars[i].address) = temp;
! }
! break;
! default:
! break;
}
}
i++;
}
}
+ void _reg_get_server_config(char *server INLINE_TLS){
+ RegKey *pRegKey;
+ char regkey[1024];
+ DWORD dwSize, dwbSize, dwType, i;
+ BYTE *key, *pbuffer;
! snprintf(regkey, 1024, "%s%s", PHP_REG_KEY, server);
! if (pRegKey = _php3_win32_reg_open(regkey _INLINE_TLS)) {
! /* ok default keys exist */
! for (i=0;i < pRegKey->dwcValues; i++){
! /* allocate memory for keynames and values. */
! dwSize = (pRegKey->dwcMaxValueName+1);
! key=emalloc(dwSize);
! dwbSize = (pRegKey->dwcMaxValueData+1);
! pbuffer=emalloc(dwbSize);
! if (_php3_win32_reg_read_value(pRegKey, key, &dwSize, &dwType, pbuffer, &dwbSize
_INLINE_TLS)) {
! _reg_set_server_var(key, pbuffer _INLINE_TLS);
! }
! efree(key);
! key = NULL;
! efree(pbuffer);
! pbuffer = NULL;
! }
! _php3_win32_reg_close(pRegKey _INLINE_TLS);
! }
! }
!
!
! void _reg_get_directory_config(INLINE_TLS_VOID) {
char regkey[1024];
! char *e, *r;
!
! if (GLOBAL(php3_ini)->use_registry_dir && GLOBAL(sapi_rqst)->server_name &&
GLOBAL(sapi_rqst)->script_name) {
! e=strstr(GLOBAL(sapi_rqst)->script_name,".");
! r=GLOBAL(sapi_rqst)->script_name;
! if (e && r) {
! while((r=strstr(r,"/")) && r < e) {
! *r = '\0';
! snprintf(regkey, 1024, "%s\\root%s", GLOBAL(sapi_rqst)->server_name,
GLOBAL(sapi_rqst)->script_name);
! *r = '/';
! CONVERT_TO_WIN_FS(regkey);
! _reg_get_server_config(regkey _INLINE_TLS);
! r++;
! }
! }
}
}
/* FIXME not finished here on down. */
! void _reg_free_server_config(INLINE_TLS_VOID) {
char *server=NULL;
int i;
#define AC_REGISTRY_TABLE
--
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