Skip to content

Commit 73d99c3

Browse files
committed
Added configure flag to disable sessions.
1 parent 956e3e4 commit 73d99c3

File tree

4 files changed

+19
-1
lines changed

4 files changed

+19
-1
lines changed

config.m4

+9
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,17 @@ PHP_ARG_ENABLE(redis, whether to enable redis support,
55
dnl Make sure that the comment is aligned:
66
[ --enable-redis Enable redis support])
77

8+
PHP_ARG_ENABLE(redis-session, whether to enable sessions,
9+
[ --disable-redis-session Disable session support], yes, no)
10+
11+
12+
813
if test "$PHP_REDIS" != "no"; then
914

15+
if test "$PHP_REDIS_SESSION" != "no"; then
16+
AC_DEFINE(PHP_SESSION,1,[redis sessions])
17+
fi
18+
1019
dnl # --with-redis -> check with-path
1120
dnl SEARCH_PATH="/usr/local /usr" # you might want to change this
1221
dnl SEARCH_FOR="/include/redis.h" # you most likely want to change this

redis.c

+6
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
#include "php_redis.h"
2929
#include <zend_exceptions.h>
3030

31+
#ifdef PHP_SESSION
3132
#include "ext/session/php_session.h"
33+
#endif
3234

3335
#include "library.h"
3436

@@ -37,7 +39,9 @@
3739

3840
static int le_redis_sock;
3941

42+
#ifdef PHP_SESSION
4043
extern ps_module ps_mod_redis;
44+
#endif
4145

4246
zend_class_entry *redis_ce;
4347
zend_class_entry *redis_exception_ce;
@@ -332,8 +336,10 @@ PHP_MINIT_FUNCTION(redis)
332336
zend_declare_class_constant_stringl(redis_ce, "AFTER", 5, "after", 5 TSRMLS_CC);
333337
zend_declare_class_constant_stringl(redis_ce, "BEFORE", 6, "before", 6 TSRMLS_CC);
334338

339+
#ifdef PHP_SESSION
335340
/* declare session handler */
336341
php_session_register_module(&ps_mod_redis);
342+
#endif
337343

338344
return SUCCESS;
339345
}

redis_session.c

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "config.h"
2424
#endif
2525

26+
#ifdef PHP_SESSION
2627
#include "common.h"
2728
#include "ext/standard/info.h"
2829
#include "php_redis.h"
@@ -426,5 +427,6 @@ PS_GC_FUNC(redis)
426427
}
427428
/* }}} */
428429

430+
#endif
429431
/* vim: set tabstop=4 expandtab: */
430432

redis_session.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#ifndef REDIS_SESSION_H
22
#define REDIS_SESSION_H
3-
3+
#ifdef PHP_SESSION
44
#include "ext/session/php_session.h"
55

66
PS_OPEN_FUNC(redis);
@@ -12,4 +12,5 @@ PS_GC_FUNC(redis);
1212

1313

1414
#endif
15+
#endif
1516

0 commit comments

Comments
 (0)