Skip to content

Commit

Permalink
Added configure flag to disable sessions.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasff committed Jun 25, 2011
1 parent 956e3e4 commit 73d99c3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
9 changes: 9 additions & 0 deletions config.m4
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -5,8 +5,17 @@ PHP_ARG_ENABLE(redis, whether to enable redis support,
dnl Make sure that the comment is aligned: dnl Make sure that the comment is aligned:
[ --enable-redis Enable redis support]) [ --enable-redis Enable redis support])


PHP_ARG_ENABLE(redis-session, whether to enable sessions,
[ --disable-redis-session Disable session support], yes, no)



if test "$PHP_REDIS" != "no"; then if test "$PHP_REDIS" != "no"; then


if test "$PHP_REDIS_SESSION" != "no"; then
AC_DEFINE(PHP_SESSION,1,[redis sessions])
fi

dnl # --with-redis -> check with-path dnl # --with-redis -> check with-path
dnl SEARCH_PATH="/usr/local /usr" # you might want to change this dnl SEARCH_PATH="/usr/local /usr" # you might want to change this
dnl SEARCH_FOR="/include/redis.h" # you most likely want to change this dnl SEARCH_FOR="/include/redis.h" # you most likely want to change this
Expand Down
6 changes: 6 additions & 0 deletions redis.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
#include "php_redis.h" #include "php_redis.h"
#include <zend_exceptions.h> #include <zend_exceptions.h>


#ifdef PHP_SESSION
#include "ext/session/php_session.h" #include "ext/session/php_session.h"
#endif


#include "library.h" #include "library.h"


Expand All @@ -37,7 +39,9 @@


static int le_redis_sock; static int le_redis_sock;


#ifdef PHP_SESSION
extern ps_module ps_mod_redis; extern ps_module ps_mod_redis;
#endif


zend_class_entry *redis_ce; zend_class_entry *redis_ce;
zend_class_entry *redis_exception_ce; zend_class_entry *redis_exception_ce;
Expand Down Expand Up @@ -332,8 +336,10 @@ PHP_MINIT_FUNCTION(redis)
zend_declare_class_constant_stringl(redis_ce, "AFTER", 5, "after", 5 TSRMLS_CC); zend_declare_class_constant_stringl(redis_ce, "AFTER", 5, "after", 5 TSRMLS_CC);
zend_declare_class_constant_stringl(redis_ce, "BEFORE", 6, "before", 6 TSRMLS_CC); zend_declare_class_constant_stringl(redis_ce, "BEFORE", 6, "before", 6 TSRMLS_CC);


#ifdef PHP_SESSION
/* declare session handler */ /* declare session handler */
php_session_register_module(&ps_mod_redis); php_session_register_module(&ps_mod_redis);
#endif


return SUCCESS; return SUCCESS;
} }
Expand Down
2 changes: 2 additions & 0 deletions redis_session.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "config.h" #include "config.h"
#endif #endif


#ifdef PHP_SESSION
#include "common.h" #include "common.h"
#include "ext/standard/info.h" #include "ext/standard/info.h"
#include "php_redis.h" #include "php_redis.h"
Expand Down Expand Up @@ -426,5 +427,6 @@ PS_GC_FUNC(redis)
} }
/* }}} */ /* }}} */


#endif
/* vim: set tabstop=4 expandtab: */ /* vim: set tabstop=4 expandtab: */


3 changes: 2 additions & 1 deletion redis_session.h
Original file line number Original file line Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifndef REDIS_SESSION_H #ifndef REDIS_SESSION_H
#define REDIS_SESSION_H #define REDIS_SESSION_H

#ifdef PHP_SESSION
#include "ext/session/php_session.h" #include "ext/session/php_session.h"


PS_OPEN_FUNC(redis); PS_OPEN_FUNC(redis);
Expand All @@ -12,4 +12,5 @@ PS_GC_FUNC(redis);




#endif #endif
#endif


0 comments on commit 73d99c3

Please sign in to comment.