]> granicus.if.org Git - php/commitdiff
@- Added session_cache_expire() function. (patch from anuradha@gnu.org)
authorAndrei Zmievski <andrei@php.net>
Mon, 22 Oct 2001 15:18:06 +0000 (15:18 +0000)
committerAndrei Zmievski <andrei@php.net>
Mon, 22 Oct 2001 15:18:06 +0000 (15:18 +0000)
ext/session/session.c

index bc9e0cc37247adda8b3aeab471c649ea0ff6e655..9a9708a6cc2ae66fae497e1647284a55c1c2bbb2 100644 (file)
@@ -67,6 +67,7 @@ function_entry session_functions[] = {
        PHP_FE(session_unset, NULL)
        PHP_FE(session_set_save_handler, NULL)
        PHP_FE(session_cache_limiter, NULL)
+       PHP_FE(session_cache_expire, NULL)
        PHP_FE(session_set_cookie_params, NULL)
        PHP_FE(session_get_cookie_params, NULL)
        PHP_FE(session_write_close, NULL)
@@ -1174,6 +1175,29 @@ PHP_FUNCTION(session_cache_limiter)
 }
 /* }}} */
 
+/* {{{ proto int session_cache_expire([int new_cache_expire])
+   Return the current cache expire. If new_cache_expire is given, the current cache_expire is replaced with new_cache_expire */
+PHP_FUNCTION(session_cache_expire)
+{
+       zval **p_cache_expire;
+       int ac = ZEND_NUM_ARGS();
+       long old;
+       PSLS_FETCH();
+
+       old = PS(cache_expire);
+
+       if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_cache_expire) == FAILURE)
+               WRONG_PARAM_COUNT;
+
+       if (ac == 1) {
+               convert_to_long_ex(p_cache_expire);
+               PS(cache_expire) = Z_LVAL_PP(p_cache_expire);
+       }
+
+       RETVAL_LONG(old);
+}
+/* }}} */
+
 /* {{{ static void php_register_var(zval** entry TSRMLS_DC) */
 static void php_register_var(zval** entry TSRMLS_DC)
 {