cvs: pear /PECL/iisfunc iisfunc.cpp iisfunc.h setup.c setup.h
| From: | Frank M. Kromann | Date: | Mon, 06 May 2002 23:38:34 +0000 |
| Subject: | cvs: pear /PECL/iisfunc iisfunc.cpp iisfunc.h setup.c setup.h | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-3702@lists.php.net to get a copy of this message | ||
fmk Mon May 6 19:38:34 2002 EDT
Modified files:
/pear/PECL/iisfunc iisfunc.cpp iisfunc.h setup.c setup.h
Log:
Adding new functions:
iis_enum_servers
iis_get_server_status
iis_pause_server
Index: pear/PECL/iisfunc/iisfunc.cpp diff -u pear/PECL/iisfunc/iisfunc.cpp:1.9 pear/PECL/iisfunc/iisfunc.cpp:1.10 --- pear/PECL/iisfunc/iisfunc.cpp:1.9 Tue Apr 30 14:22:03 2002 +++ pear/PECL/iisfunc/iisfunc.cpp Mon May 6 19:38:34 2002 @@ -15,7 +15,7 @@ | Authors: Frank M. Kromann <fmk@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: iisfunc.cpp,v 1.9 2002/04/30 18:22:03 fmk Exp $ */ +/* $Id: iisfunc.cpp,v 1.10 2002/05/06 23:38:34 fmk Exp $ */ /* iisfunc.cpp : Defines the entry point for the DLL application. */ @@ -45,6 +45,66 @@ ((IMSAdminBase *) IISG(pIMeta))->Release(); } +extern "C" int fnIisEnumServers(zval *ServerList TSRMLS_DC) +{ + HRESULT hRes = 0, hResSub = 0; + DWORD buffer = 0; + DWORD dwBuffer = 65535; + METADATA_HANDLE MyHandle; + METADATA_RECORD MyRecord; + PBYTE pbBuffer = new BYTE[dwBuffer]; + WCHAR SubKeyName[METADATA_MAX_NAME_LEN]; + WCHAR KeyName[METADATA_MAX_NAME_LEN]; + char extBuffer[256]; + IMSAdminBase *pIMeta; + DWORD indx = 0; + int retval = 0; + + pIMeta = (IMSAdminBase *) IISG(pIMeta); + + hRes = pIMeta->OpenKey(METADATA_MASTER_ROOT_HANDLE, L"/LM/W3SVC", METADATA_PERMISSION_READ, 20, &MyHandle); + while (SUCCEEDED(hRes)){ + hRes = pIMeta->EnumKeys(MyHandle, L"/", SubKeyName, indx); + if (SUCCEEDED(hRes)) { + zval *server = (zval *)emalloc(sizeof(zval)); + MAKE_STD_ZVAL(server); + array_init(server); + + MyRecord.dwMDIdentifier = MD_VR_PATH; + MyRecord.dwMDAttributes = METADATA_INHERIT; + MyRecord.dwMDUserType = IIS_MD_UT_SERVER; + MyRecord.dwMDDataType = ALL_METADATA; + MyRecord.dwMDDataLen = dwBuffer; + MyRecord.pbMDData = pbBuffer; + swprintf(KeyName, L"/%s/ROOT", SubKeyName); + hResSub = pIMeta->GetData(MyHandle, KeyName, &MyRecord, &buffer); + if (SUCCEEDED(hResSub)) { + sprintf(extBuffer, "%ls", MyRecord.pbMDData); + add_assoc_string(server, "PATH", extBuffer, 1); + } + MyRecord.dwMDIdentifier = MD_SERVER_COMMENT; + MyRecord.dwMDAttributes = METADATA_INHERIT; + MyRecord.dwMDUserType = IIS_MD_UT_SERVER; + MyRecord.dwMDDataType = ALL_METADATA; + MyRecord.dwMDDataLen = dwBuffer; + MyRecord.pbMDData = pbBuffer; + swprintf(KeyName, L"/%s/ROOT", SubKeyName); + hResSub = pIMeta->GetData(MyHandle, KeyName, &MyRecord, &buffer); + if (SUCCEEDED(hResSub)) { + sprintf(extBuffer, "%ls", MyRecord.pbMDData); + add_assoc_string(server, "COMMENT", extBuffer, 1); + } + retval = wcstol(SubKeyName, NULL, 10); + if (retval > 0) + zend_hash_index_update(Z_ARRVAL_P(ServerList), retval, &server, sizeof(zval), NULL); + } + indx++; + } + pIMeta->CloseKey(MyHandle); + + return retval; +} + extern "C" int fnIisGetServerByPath(char * ServerPath TSRMLS_DC) { HRESULT hRes = 0, hResSub = 0; @@ -448,6 +508,41 @@ if(!SUCCEEDED(pIMeta->SetData(MyHandle, SubKeyName, &MyRecord))) retval = -508; + } + else + retval = -501; + pIMeta->CloseKey(MyHandle); + + return retval; +} + +extern "C" int fnIisGetServerStatus(DWORD ServerInstance TSRMLS_DC) +{ + HRESULT hRes = 0; + DWORD buffer = 0; + METADATA_HANDLE MyHandle; + METADATA_RECORD MyRecord; + WCHAR SubKeyName[METADATA_MAX_NAME_LEN]; + IMSAdminBase *pIMeta; + int retval = 1; + + pIMeta = (IMSAdminBase *) IISG(pIMeta); + + hRes = pIMeta->OpenKey(METADATA_MASTER_ROOT_HANDLE, L"/LM/W3SVC", METADATA_PERMISSION_READ, 20, &MyHandle); + if (SUCCEEDED(hRes)) { + memset(SubKeyName , 0, sizeof(SubKeyName)); + swprintf(SubKeyName, L"/%ld", ServerInstance); + MyRecord.dwMDIdentifier = MD_SERVER_COMMAND; + MyRecord.dwMDAttributes = METADATA_INHERIT; + MyRecord.dwMDUserType = IIS_MD_UT_SERVER; + MyRecord.dwMDDataType = DWORD_METADATA; + MyRecord.dwMDDataLen = sizeof(DWORD); + + if(!SUCCEEDED(pIMeta->GetData(MyHandle, SubKeyName, &MyRecord, &buffer))) + retval = -508; + else + retval = *(int *)MyRecord.pbMDData; + } else retval = -501; Index: pear/PECL/iisfunc/iisfunc.h diff -u pear/PECL/iisfunc/iisfunc.h:1.5 pear/PECL/iisfunc/iisfunc.h:1.6 --- pear/PECL/iisfunc/iisfunc.h:1.5 Tue Apr 30 14:22:03 2002 +++ pear/PECL/iisfunc/iisfunc.h Mon May 6 19:38:34 2002 @@ -15,7 +15,7 @@ | Authors: Frank M. Kromann <fmk@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: iisfunc.h,v 1.5 2002/04/30 18:22:03 fmk Exp $ */ +/* $Id: iisfunc.h,v 1.6 2002/05/06 23:38:34 fmk Exp $ */ #include "setup.h" @@ -24,6 +24,8 @@ void fnIisInit(TSRMLS_D); void fnIisShutdown(TSRMLS_D); +int fnIisEnumServers(zval *ServerList TSRMLS_DC); + int fnIisGetServerByPath(char * ServerPath TSRMLS_DC); int fnIisGetServerByComment(char * ServerComment TSRMLS_DC); @@ -36,6 +38,7 @@ int fnIisSetServerRight(DWORD ServerInstance, char * VirtualPath, DWORD ServerRights TSRMLS_DC); int fnIisGetServerRight(DWORD ServerInstance, char * VirtualPath, DWORD * ServerRights TSRMLS_DC); int fnIisSetServerStatus(DWORD ServerInstance, DWORD StartServer TSRMLS_DC); +int fnIisGetServerStatus(DWORD ServerInstance TSRMLS_DC); int fnIisSetScriptMap(DWORD ServerInstance, char * VirtualPath, char * ScriptMap TSRMLS_DC); int fnIisGetScriptMap(DWORD ServerInstance, char * VirtualPath, char * SeciptExtention, char * ReturnValue TSRMLS_DC); Index: pear/PECL/iisfunc/setup.c diff -u pear/PECL/iisfunc/setup.c:1.14 pear/PECL/iisfunc/setup.c:1.15 --- pear/PECL/iisfunc/setup.c:1.14 Tue Apr 30 14:22:03 2002 +++ pear/PECL/iisfunc/setup.c Mon May 6 19:38:34 2002 @@ -15,7 +15,7 @@ | Authors: Frank M. Kromann <fmk@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: setup.c,v 1.14 2002/04/30 18:22:03 fmk Exp $ */ +/* $Id: setup.c,v 1.15 2002/05/06 23:38:34 fmk Exp $ */ #ifdef COMPILE_DL_IISFUNC #define HAVE_IISFUNC 1 @@ -34,6 +34,7 @@ #ifdef HAVE_IISFUNC function_entry iisfunc_functions[] = { + PHP_FE(iis_enum_servers, NULL) PHP_FE(iis_get_server_by_path, NULL) PHP_FE(iis_get_server_by_comment, NULL) PHP_FE(iis_add_server, NULL) @@ -44,6 +45,8 @@ PHP_FE(iis_get_server_rights, NULL) PHP_FE(iis_start_server, NULL) PHP_FE(iis_stop_server, NULL) + PHP_FE(iis_pause_server, NULL) + PHP_FE(iis_get_server_status, NULL) PHP_FE(iis_set_script_map, NULL) PHP_FE(iis_get_script_map, NULL) PHP_FE(iis_set_app_settings, NULL) @@ -103,6 +106,10 @@ REGISTER_LONG_CONSTANT("IIS_BASIC", 0x2, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("IIS_NTLM", 0x4, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IIS_STOPPED", 0x2, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IIS_PAUSED", 0x3, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IIS_RUNNING", 0x4, CONST_CS | CONST_PERSISTENT); + return SUCCESS; } @@ -130,6 +137,16 @@ php_info_print_table_end(); } +/* {{{ proto array iis_enum_servers() + Returns an array of servers array(instance, comment, path) */ +PHP_FUNCTION(iis_enum_servers) +{ + array_init(return_value); + + fnIisEnumServers(return_value TSRMLS_CC); +} +/* }}} */ + /* {{{ proto int iis_get_server_by_path(string Path) Return the instance number associated with the Path*/ PHP_FUNCTION(iis_get_server_by_path) @@ -385,7 +402,7 @@ convert_to_long_ex(ServerInstance); - RETVAL_LONG(fnIisSetServerStatus(Z_LVAL_PP(ServerInstance), 1 TSRMLS_CC)); + RETVAL_LONG(fnIisSetServerStatus(Z_LVAL_PP(ServerInstance), 4 TSRMLS_CC)); } /* }}} */ @@ -402,7 +419,41 @@ convert_to_long_ex(ServerInstance); - RETVAL_LONG(fnIisSetServerStatus(Z_LVAL_PP(ServerInstance), 0 TSRMLS_CC)); + RETVAL_LONG(fnIisSetServerStatus(Z_LVAL_PP(ServerInstance), 2 TSRMLS_CC)); +} +/* }}} */ + +/* {{{ proto int iis_pause_server(int ServerInstance) + Pauses the virtual web server*/ +PHP_FUNCTION(iis_pause_server) +{ + zval **ServerInstance; + // Get and check parameters + int argc = ZEND_NUM_ARGS(); + + if (argc != 1 || zend_get_parameters_ex(argc, &ServerInstance) == FAILURE) + WRONG_PARAM_COUNT; + + convert_to_long_ex(ServerInstance); + + RETVAL_LONG(fnIisSetServerStatus(Z_LVAL_PP(ServerInstance), 3 TSRMLS_CC)); +} +/* }}} */ + +/* {{{ proto int iis_get_server_status(int ServerInstance) + Returns the current status of the server (IIS_STOPPED, IIS_PAUSED, IIS_RUNNING) */ +PHP_FUNCTION(iis_get_server_status) +{ + zval **ServerInstance; + // Get and check parameters + int argc = ZEND_NUM_ARGS(); + + if (argc != 1 || zend_get_parameters_ex(argc, &ServerInstance) == FAILURE) + WRONG_PARAM_COUNT; + + convert_to_long_ex(ServerInstance); + + RETVAL_LONG(fnIisGetServerStatus(Z_LVAL_PP(ServerInstance) TSRMLS_CC)); } /* }}} */ Index: pear/PECL/iisfunc/setup.h diff -u pear/PECL/iisfunc/setup.h:1.7 pear/PECL/iisfunc/setup.h:1.8 --- pear/PECL/iisfunc/setup.h:1.7 Tue Dec 11 10:29:37 2001 +++ pear/PECL/iisfunc/setup.h Mon May 6 19:38:34 2002 @@ -15,7 +15,7 @@ | Authors: Frank M. Kromann <fmk@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: setup.h,v 1.7 2001/12/11 15:29:37 sebastian Exp $ */ +/* $Id: setup.h,v 1.8 2002/05/06 23:38:34 fmk Exp $ */ #ifndef PHP_IIS_SETUP_H #define PHP_IIS_SETUP_H @@ -33,6 +33,7 @@ PHP_RSHUTDOWN_FUNCTION(iisfunc); PHP_MINFO_FUNCTION(iisfunc); +PHP_FUNCTION(iis_enum_servers); PHP_FUNCTION(iis_get_server_by_path); PHP_FUNCTION(iis_get_server_by_comment); PHP_FUNCTION(iis_add_server); @@ -43,6 +44,8 @@ PHP_FUNCTION(iis_get_server_rights); PHP_FUNCTION(iis_start_server); PHP_FUNCTION(iis_stop_server); +PHP_FUNCTION(iis_pause_server); +PHP_FUNCTION(iis_get_server_status); PHP_FUNCTION(iis_set_script_map); PHP_FUNCTION(iis_get_script_map); PHP_FUNCTION(iis_set_app_settings);
Index: pear/PECL/iisfunc/iisfunc.cpp diff -u pear/PECL/iisfunc/iisfunc.cpp:1.9 pear/PECL/iisfunc/iisfunc.cpp:1.10 --- pear/PECL/iisfunc/iisfunc.cpp:1.9 Tue Apr 30 14:22:03 2002 +++ pear/PECL/iisfunc/iisfunc.cpp Mon May 6 19:38:34 2002 @@ -15,7 +15,7 @@ | Authors: Frank M. Kromann <fmk@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: iisfunc.cpp,v 1.9 2002/04/30 18:22:03 fmk Exp $ */ +/* $Id: iisfunc.cpp,v 1.10 2002/05/06 23:38:34 fmk Exp $ */ /* iisfunc.cpp : Defines the entry point for the DLL application. */ @@ -45,6 +45,66 @@ ((IMSAdminBase *) IISG(pIMeta))->Release(); } +extern "C" int fnIisEnumServers(zval *ServerList TSRMLS_DC) +{ + HRESULT hRes = 0, hResSub = 0; + DWORD buffer = 0; + DWORD dwBuffer = 65535; + METADATA_HANDLE MyHandle; + METADATA_RECORD MyRecord; + PBYTE pbBuffer = new BYTE[dwBuffer]; + WCHAR SubKeyName[METADATA_MAX_NAME_LEN]; + WCHAR KeyName[METADATA_MAX_NAME_LEN]; + char extBuffer[256]; + IMSAdminBase *pIMeta; + DWORD indx = 0; + int retval = 0; + + pIMeta = (IMSAdminBase *) IISG(pIMeta); + + hRes = pIMeta->OpenKey(METADATA_MASTER_ROOT_HANDLE, L"/LM/W3SVC", METADATA_PERMISSION_READ, 20, &MyHandle); + while (SUCCEEDED(hRes)){ + hRes = pIMeta->EnumKeys(MyHandle, L"/", SubKeyName, indx); + if (SUCCEEDED(hRes)) { + zval *server = (zval *)emalloc(sizeof(zval)); + MAKE_STD_ZVAL(server); + array_init(server); + + MyRecord.dwMDIdentifier = MD_VR_PATH; + MyRecord.dwMDAttributes = METADATA_INHERIT; + MyRecord.dwMDUserType = IIS_MD_UT_SERVER; + MyRecord.dwMDDataType = ALL_METADATA; + MyRecord.dwMDDataLen = dwBuffer; + MyRecord.pbMDData = pbBuffer; + swprintf(KeyName, L"/%s/ROOT", SubKeyName); + hResSub = pIMeta->GetData(MyHandle, KeyName, &MyRecord, &buffer); + if (SUCCEEDED(hResSub)) { + sprintf(extBuffer, "%ls", MyRecord.pbMDData); + add_assoc_string(server, "PATH", extBuffer, 1); + } + MyRecord.dwMDIdentifier = MD_SERVER_COMMENT; + MyRecord.dwMDAttributes = METADATA_INHERIT; + MyRecord.dwMDUserType = IIS_MD_UT_SERVER; + MyRecord.dwMDDataType = ALL_METADATA; + MyRecord.dwMDDataLen = dwBuffer; + MyRecord.pbMDData = pbBuffer; + swprintf(KeyName, L"/%s/ROOT", SubKeyName); + hResSub = pIMeta->GetData(MyHandle, KeyName, &MyRecord, &buffer); + if (SUCCEEDED(hResSub)) { + sprintf(extBuffer, "%ls", MyRecord.pbMDData); + add_assoc_string(server, "COMMENT", extBuffer, 1); + } + retval = wcstol(SubKeyName, NULL, 10); + if (retval > 0) + zend_hash_index_update(Z_ARRVAL_P(ServerList), retval, &server, sizeof(zval), NULL); + } + indx++; + } + pIMeta->CloseKey(MyHandle); + + return retval; +} + extern "C" int fnIisGetServerByPath(char * ServerPath TSRMLS_DC) { HRESULT hRes = 0, hResSub = 0; @@ -448,6 +508,41 @@ if(!SUCCEEDED(pIMeta->SetData(MyHandle, SubKeyName, &MyRecord))) retval = -508; + } + else + retval = -501; + pIMeta->CloseKey(MyHandle); + + return retval; +} + +extern "C" int fnIisGetServerStatus(DWORD ServerInstance TSRMLS_DC) +{ + HRESULT hRes = 0; + DWORD buffer = 0; + METADATA_HANDLE MyHandle; + METADATA_RECORD MyRecord; + WCHAR SubKeyName[METADATA_MAX_NAME_LEN]; + IMSAdminBase *pIMeta; + int retval = 1; + + pIMeta = (IMSAdminBase *) IISG(pIMeta); + + hRes = pIMeta->OpenKey(METADATA_MASTER_ROOT_HANDLE, L"/LM/W3SVC", METADATA_PERMISSION_READ, 20, &MyHandle); + if (SUCCEEDED(hRes)) { + memset(SubKeyName , 0, sizeof(SubKeyName)); + swprintf(SubKeyName, L"/%ld", ServerInstance); + MyRecord.dwMDIdentifier = MD_SERVER_COMMAND; + MyRecord.dwMDAttributes = METADATA_INHERIT; + MyRecord.dwMDUserType = IIS_MD_UT_SERVER; + MyRecord.dwMDDataType = DWORD_METADATA; + MyRecord.dwMDDataLen = sizeof(DWORD); + + if(!SUCCEEDED(pIMeta->GetData(MyHandle, SubKeyName, &MyRecord, &buffer))) + retval = -508; + else + retval = *(int *)MyRecord.pbMDData; + } else retval = -501; Index: pear/PECL/iisfunc/iisfunc.h diff -u pear/PECL/iisfunc/iisfunc.h:1.5 pear/PECL/iisfunc/iisfunc.h:1.6 --- pear/PECL/iisfunc/iisfunc.h:1.5 Tue Apr 30 14:22:03 2002 +++ pear/PECL/iisfunc/iisfunc.h Mon May 6 19:38:34 2002 @@ -15,7 +15,7 @@ | Authors: Frank M. Kromann <fmk@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: iisfunc.h,v 1.5 2002/04/30 18:22:03 fmk Exp $ */ +/* $Id: iisfunc.h,v 1.6 2002/05/06 23:38:34 fmk Exp $ */ #include "setup.h" @@ -24,6 +24,8 @@ void fnIisInit(TSRMLS_D); void fnIisShutdown(TSRMLS_D); +int fnIisEnumServers(zval *ServerList TSRMLS_DC); + int fnIisGetServerByPath(char * ServerPath TSRMLS_DC); int fnIisGetServerByComment(char * ServerComment TSRMLS_DC); @@ -36,6 +38,7 @@ int fnIisSetServerRight(DWORD ServerInstance, char * VirtualPath, DWORD ServerRights TSRMLS_DC); int fnIisGetServerRight(DWORD ServerInstance, char * VirtualPath, DWORD * ServerRights TSRMLS_DC); int fnIisSetServerStatus(DWORD ServerInstance, DWORD StartServer TSRMLS_DC); +int fnIisGetServerStatus(DWORD ServerInstance TSRMLS_DC); int fnIisSetScriptMap(DWORD ServerInstance, char * VirtualPath, char * ScriptMap TSRMLS_DC); int fnIisGetScriptMap(DWORD ServerInstance, char * VirtualPath, char * SeciptExtention, char * ReturnValue TSRMLS_DC); Index: pear/PECL/iisfunc/setup.c diff -u pear/PECL/iisfunc/setup.c:1.14 pear/PECL/iisfunc/setup.c:1.15 --- pear/PECL/iisfunc/setup.c:1.14 Tue Apr 30 14:22:03 2002 +++ pear/PECL/iisfunc/setup.c Mon May 6 19:38:34 2002 @@ -15,7 +15,7 @@ | Authors: Frank M. Kromann <fmk@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: setup.c,v 1.14 2002/04/30 18:22:03 fmk Exp $ */ +/* $Id: setup.c,v 1.15 2002/05/06 23:38:34 fmk Exp $ */ #ifdef COMPILE_DL_IISFUNC #define HAVE_IISFUNC 1 @@ -34,6 +34,7 @@ #ifdef HAVE_IISFUNC function_entry iisfunc_functions[] = { + PHP_FE(iis_enum_servers, NULL) PHP_FE(iis_get_server_by_path, NULL) PHP_FE(iis_get_server_by_comment, NULL) PHP_FE(iis_add_server, NULL) @@ -44,6 +45,8 @@ PHP_FE(iis_get_server_rights, NULL) PHP_FE(iis_start_server, NULL) PHP_FE(iis_stop_server, NULL) + PHP_FE(iis_pause_server, NULL) + PHP_FE(iis_get_server_status, NULL) PHP_FE(iis_set_script_map, NULL) PHP_FE(iis_get_script_map, NULL) PHP_FE(iis_set_app_settings, NULL) @@ -103,6 +106,10 @@ REGISTER_LONG_CONSTANT("IIS_BASIC", 0x2, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("IIS_NTLM", 0x4, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IIS_STOPPED", 0x2, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IIS_PAUSED", 0x3, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IIS_RUNNING", 0x4, CONST_CS | CONST_PERSISTENT); + return SUCCESS; } @@ -130,6 +137,16 @@ php_info_print_table_end(); } +/* {{{ proto array iis_enum_servers() + Returns an array of servers array(instance, comment, path) */ +PHP_FUNCTION(iis_enum_servers) +{ + array_init(return_value); + + fnIisEnumServers(return_value TSRMLS_CC); +} +/* }}} */ + /* {{{ proto int iis_get_server_by_path(string Path) Return the instance number associated with the Path*/ PHP_FUNCTION(iis_get_server_by_path) @@ -385,7 +402,7 @@ convert_to_long_ex(ServerInstance); - RETVAL_LONG(fnIisSetServerStatus(Z_LVAL_PP(ServerInstance), 1 TSRMLS_CC)); + RETVAL_LONG(fnIisSetServerStatus(Z_LVAL_PP(ServerInstance), 4 TSRMLS_CC)); } /* }}} */ @@ -402,7 +419,41 @@ convert_to_long_ex(ServerInstance); - RETVAL_LONG(fnIisSetServerStatus(Z_LVAL_PP(ServerInstance), 0 TSRMLS_CC)); + RETVAL_LONG(fnIisSetServerStatus(Z_LVAL_PP(ServerInstance), 2 TSRMLS_CC)); +} +/* }}} */ + +/* {{{ proto int iis_pause_server(int ServerInstance) + Pauses the virtual web server*/ +PHP_FUNCTION(iis_pause_server) +{ + zval **ServerInstance; + // Get and check parameters + int argc = ZEND_NUM_ARGS(); + + if (argc != 1 || zend_get_parameters_ex(argc, &ServerInstance) == FAILURE) + WRONG_PARAM_COUNT; + + convert_to_long_ex(ServerInstance); + + RETVAL_LONG(fnIisSetServerStatus(Z_LVAL_PP(ServerInstance), 3 TSRMLS_CC)); +} +/* }}} */ + +/* {{{ proto int iis_get_server_status(int ServerInstance) + Returns the current status of the server (IIS_STOPPED, IIS_PAUSED, IIS_RUNNING) */ +PHP_FUNCTION(iis_get_server_status) +{ + zval **ServerInstance; + // Get and check parameters + int argc = ZEND_NUM_ARGS(); + + if (argc != 1 || zend_get_parameters_ex(argc, &ServerInstance) == FAILURE) + WRONG_PARAM_COUNT; + + convert_to_long_ex(ServerInstance); + + RETVAL_LONG(fnIisGetServerStatus(Z_LVAL_PP(ServerInstance) TSRMLS_CC)); } /* }}} */ Index: pear/PECL/iisfunc/setup.h diff -u pear/PECL/iisfunc/setup.h:1.7 pear/PECL/iisfunc/setup.h:1.8 --- pear/PECL/iisfunc/setup.h:1.7 Tue Dec 11 10:29:37 2001 +++ pear/PECL/iisfunc/setup.h Mon May 6 19:38:34 2002 @@ -15,7 +15,7 @@ | Authors: Frank M. Kromann <fmk@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: setup.h,v 1.7 2001/12/11 15:29:37 sebastian Exp $ */ +/* $Id: setup.h,v 1.8 2002/05/06 23:38:34 fmk Exp $ */ #ifndef PHP_IIS_SETUP_H #define PHP_IIS_SETUP_H @@ -33,6 +33,7 @@ PHP_RSHUTDOWN_FUNCTION(iisfunc); PHP_MINFO_FUNCTION(iisfunc); +PHP_FUNCTION(iis_enum_servers); PHP_FUNCTION(iis_get_server_by_path); PHP_FUNCTION(iis_get_server_by_comment); PHP_FUNCTION(iis_add_server); @@ -43,6 +44,8 @@ PHP_FUNCTION(iis_get_server_rights); PHP_FUNCTION(iis_start_server); PHP_FUNCTION(iis_stop_server); +PHP_FUNCTION(iis_pause_server); +PHP_FUNCTION(iis_get_server_status); PHP_FUNCTION(iis_set_script_map); PHP_FUNCTION(iis_get_script_map); PHP_FUNCTION(iis_set_app_settings);