cvs: /php4/ext/session mod_user.c mod_user.h /php4 ChangeLog /php4/ext/session Makefile.am modules.c php_session.h session.c
| From: | Sascha Schumann | Date: | Fri, 17 Sep 1999 05:40:59 +0000 |
| Subject: | cvs: /php4/ext/session mod_user.c mod_user.h /php4 ChangeLog /php4/ext/session Makefile.am modules.c php_session.h session.c | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-4552@lists.php.net to get a copy of this message | ||
sas Fri Sep 17 01:40:59 1999 EDT
Added files:
/php4/ext/session mod_user.c mod_user.h
Modified files:
/php4 ChangeLog
/php4/ext/session Makefile.am modules.c php_session.h session.c
Log:
add user-level callbacks
Index: php4/ChangeLog
diff -u php4/ChangeLog:1.111 php4/ChangeLog:1.112
--- php4/ChangeLog:1.111 Thu Sep 16 19:18:13 1999
+++ php4/ChangeLog Fri Sep 17 01:40:58 1999
@@ -2,6 +2,7 @@
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ?? 1999, Version 4.0 Beta 3
+- Added user-level callbacks for session module (Sascha)
- Added support for unknown POST content types (Zeev)
- Added "wddx" serialization handler for session module (Sascha)
(automatically enabled, if you compile with --with-wddx)
Index: php4/ext/session/Makefile.am
diff -u php4/ext/session/Makefile.am:1.2 php4/ext/session/Makefile.am:1.3
--- php4/ext/session/Makefile.am:1.2 Fri Aug 27 17:03:21 1999
+++ php4/ext/session/Makefile.am Fri Sep 17 01:40:59 1999
@@ -1,6 +1,6 @@
-# $Id: Makefile.am,v 1.2 1999/08/27 21:03:21 sas Exp $
+# $Id: Makefile.am,v 1.3 1999/09/17 05:40:59 sas Exp $
INCLUDES=@INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/libzend
noinst_LIBRARIES=libphpext_session.a
-libphpext_session_a_SOURCES=session.c mod_files.c mod_mm.c
+libphpext_session_a_SOURCES=session.c mod_files.c mod_mm.c mod_user.c
Index: php4/ext/session/modules.c
diff -u php4/ext/session/modules.c:1.2 php4/ext/session/modules.c:1.3
--- php4/ext/session/modules.c:1.2 Fri Aug 27 17:03:22 1999
+++ php4/ext/session/modules.c Fri Sep 17 01:40:59 1999
@@ -5,9 +5,11 @@
#include "mod_files.h"
#include "mod_mm.h"
+#include "mod_user.h"
static ps_module *ps_modules[] = {
ps_files_ptr,
ps_mm_ptr,
+ ps_user_ptr,
};
Index: php4/ext/session/php_session.h
diff -u php4/ext/session/php_session.h:1.18 php4/ext/session/php_session.h:1.19
--- php4/ext/session/php_session.h:1.18 Thu Sep 16 08:55:31 1999
+++ php4/ext/session/php_session.h Fri Sep 17 01:40:59 1999
@@ -104,6 +104,7 @@
PHP_FUNCTION(session_start);
PHP_FUNCTION(session_destroy);
PHP_FUNCTION(session_unset);
+PHP_FUNCTION(session_set_save_handler);
#ifdef ZTS
#define PSLS_D php_ps_globals *ps_globals
Index: php4/ext/session/session.c
diff -u php4/ext/session/session.c:1.52 php4/ext/session/session.c:1.53
--- php4/ext/session/session.c:1.52 Thu Sep 16 16:59:44 1999
+++ php4/ext/session/session.c Fri Sep 17 01:40:59 1999
@@ -17,10 +17,6 @@
+----------------------------------------------------------------------+
*/
-/*
- * TODO:
- * - userland callback functions for ps_module
- */
#if !(WIN32|WINNT)
#include <sys/time.h>
#else
@@ -61,6 +57,7 @@
PHP_FE(session_start, NULL)
PHP_FE(session_destroy, NULL)
PHP_FE(session_unset, NULL)
+ PHP_FE(session_set_save_handler, NULL)
{0}
};
@@ -83,6 +80,7 @@
PS_SERIALIZER_FUNCS(wddx);
#endif
+
const static ps_serializer ps_serializers[] = {
#ifdef WDDX_SERIALIZER
PS_SERIALIZER_ENTRY(wddx),
@@ -90,21 +88,22 @@
PS_SERIALIZER_ENTRY(php),
{0}
};
+
+PHP_MINIT_FUNCTION(session);
+PHP_RINIT_FUNCTION(session);
+PHP_MSHUTDOWN_FUNCTION(session);
+PHP_RSHUTDOWN_FUNCTION(session);
+PHP_MINFO_FUNCTION(session);
-static int php_minit_session(INIT_FUNC_ARGS);
-static int php_rinit_session(INIT_FUNC_ARGS);
-static int php_mshutdown_session(SHUTDOWN_FUNC_ARGS);
-static int php_rshutdown_session(SHUTDOWN_FUNC_ARGS);
-static void php_info_isapi(ZEND_MODULE_INFO_FUNC_ARGS);
static void php_rinit_session_globals(PSLS_D);
static void php_rshutdown_session_globals(PSLS_D);
zend_module_entry session_module_entry = {
"session",
session_functions,
- php_minit_session, php_mshutdown_session,
- php_rinit_session, php_rshutdown_session,
- php_info_isapi,
+ PHP_MINIT(session), PHP_MSHUTDOWN(session),
+ PHP_RINIT(session), PHP_RSHUTDOWN(session),
+ PHP_MINFO(session),
STANDARD_MODULE_PROPERTIES,
};
@@ -611,6 +610,38 @@
}
/* }}} */
+/* {{{ proto void session_set_save_handler(string open, string close, string read, string write,
string destroy, string gc)
+ sets user-level functions */
+PHP_FUNCTION(session_set_save_handler)
+{
+ zval **args[6];
+ int i;
+ ps_user *mdata;
+ PSLS_FETCH();
+
+ if(ARG_COUNT(ht) != 6 || getParametersArrayEx(6, args) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+ if(PS(nr_open_sessions) > 0) {
+ RETURN_FALSE;
+ }
+
+ PS(mod) = _php_find_ps_module("user" PSLS_CC);
+
+ mdata = emalloc(sizeof *mdata);
+
+ for(i = 0; i < 6; i++) {
+ convert_to_string_ex(args[i]);
+ mdata->names[i] = estrdup((*args[i])->value.str.val);
+ }
+
+ PS(mod_data) = (void *) mdata;
+
+ RETURN_TRUE;
+}
+/* }}} */
+
/* {{{ proto string session_save_path([string newname])
return the current save path passed to module_name. if newname is given, the save path is
replaced with newname */
PHP_FUNCTION(session_save_path)
@@ -846,7 +877,7 @@
zend_hash_destroy(&PS(vars));
}
-int php_rinit_session(INIT_FUNC_ARGS)
+PHP_RINIT_FUNCTION(session)
{
PSLS_FETCH();
@@ -865,7 +896,7 @@
return SUCCESS;
}
-int php_rshutdown_session(SHUTDOWN_FUNC_ARGS)
+PHP_RSHUTDOWN_FUNCTION(session)
{
PSLS_FETCH();
@@ -877,7 +908,7 @@
return SUCCESS;
}
-int php_minit_session(INIT_FUNC_ARGS)
+PHP_MINIT_FUNCTION(session)
{
#ifdef ZTS
php_ps_globals *ps_globals;
@@ -891,14 +922,14 @@
return SUCCESS;
}
-int php_mshutdown_session(SHUTDOWN_FUNC_ARGS)
+PHP_MSHUTDOWN_FUNCTION(session)
{
UNREGISTER_INI_ENTRIES();
return SUCCESS;
}
-static void php_info_isapi(ZEND_MODULE_INFO_FUNC_ARGS)
+PHP_MINFO_FUNCTION(session)
{
DISPLAY_INI_ENTRIES();
}