summaryrefslogtreecommitdiff
path: root/sapi/apache_hooks
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2002-12-27 22:47:06 +0000
committerIlia Alshanetsky <iliaa@php.net>2002-12-27 22:47:06 +0000
commit648dd88b42ffeda9922611a7ce7e83416382c381 (patch)
treea38b8deae950a28cb84e3ed44797dc45c10708ec /sapi/apache_hooks
parent572394db74cef01dbc7ab0a6bb3dada25b730f0a (diff)
downloadphp-git-648dd88b42ffeda9922611a7ce7e83416382c381.tar.gz
Added apache_get_version() & apache_get_modules() to Apache 1.X & Apache
Hooks sapis. Made the module listing in Apache 2 not show the '.c' portion, to be consistent with Apache 1.X.
Diffstat (limited to 'sapi/apache_hooks')
-rw-r--r--sapi/apache_hooks/php_apache.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/sapi/apache_hooks/php_apache.c b/sapi/apache_hooks/php_apache.c
index e8006e2f0d..e8cd54d53b 100644
--- a/sapi/apache_hooks/php_apache.c
+++ b/sapi/apache_hooks/php_apache.c
@@ -40,6 +40,7 @@ php_apache_info_struct php_apache_info;
#define offsetof(s_type,field) ((size_t)&(((s_type*)0)->field))
extern module *top_module;
+extern module **ap_loaded_modules;
static int le_apachereq;
static zend_class_entry *apacherequest_class_entry;
@@ -53,6 +54,8 @@ PHP_FUNCTION(apache_note);
PHP_FUNCTION(apache_lookup_uri);
PHP_FUNCTION(apache_child_terminate);
PHP_FUNCTION(apache_setenv);
+PHP_FUNCTION(apache_get_version);
+PHP_FUNCTION(apache_get_modules);
PHP_MINFO_FUNCTION(apache);
@@ -65,6 +68,8 @@ function_entry apache_functions[] = {
PHP_FE(apache_child_terminate, NULL)
PHP_FE(apache_setenv, NULL)
PHP_FE(apache_response_headers, NULL)
+ PHP_FE(apache_get_version, NULL)
+ PHP_FE(apache_get_modules, NULL)
PHP_FALIAS(getallheaders, apache_request_headers, NULL)
{NULL, NULL, NULL}
};
@@ -1907,6 +1912,34 @@ PHP_FUNCTION(apache_exec_uri)
}
#endif
+/* {{{ proto string apache_get_version(void)
+ Fetch Apache version */
+PHP_FUNCTION(apache_get_version)
+{
+ RETURN_STRING(SERVER_VERSION, 1);
+}
+/* }}} */
+
+/* {{{ proto array apache_get_modules(void)
+ Get a list of loaded Apache modules */
+PHP_FUNCTION(apache_get_modules)
+{
+ int n;
+ char *p;
+
+ array_init(return_value);
+
+ for (n = 0; ap_loaded_modules[n]; ++n) {
+ char *s = (char *) ap_loaded_modules[n]->name;
+ if ((p = strchr(s, '.'))) {
+ add_next_index_stringl(return_value, s, (p - s), 1);
+ } else {
+ add_next_index_string(return_value, s, 1);
+ }
+ }
+}
+/* }}} */
+
/*
* Local variables:
* tab-width: 4