Skip to content

Commit 47172e1

Browse files
committed
Drop libmemcached 0.x series support, release 2.1.0.
1 parent 9f86643 commit 47172e1

6 files changed

+31
-34
lines changed

ChangeLog

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
memcached extension changelog
22

3+
Version 2.1.0
4+
-------------
5+
* Drop support for libmemcached 0.x series, now 1.0.x is required
6+
* Add support for virtual bucket distribution
7+
* Fix compilation against PHP 5.2
8+
39
Version 2.0.1
410
-------------
511
* Fix embedded version number to be not -dev

config.m4

+11-12
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,16 @@ if test "$PHP_MEMCACHED" != "no"; then
216216
AC_MSG_RESULT([disabled])
217217
fi
218218

219+
if test "$PHP_MEMCACHED_SASL" != "no"; then
220+
AC_CHECK_HEADERS([sasl/sasl.h], [memcached_enable_sasl="yes"], [memcached_enable_sasl="no"])
221+
AC_MSG_CHECKING([whether to enable sasl support])
222+
AC_MSG_RESULT([$memcached_enable_sasl])
223+
fi
224+
225+
AC_MSG_CHECKING([for libmemcached location])
219226
if test "$PHP_LIBMEMCACHED_DIR" != "no" && test "$PHP_LIBMEMCACHED_DIR" != "yes"; then
220-
if test -r "$PHP_LIBMEMCACHED_DIR/include/libmemcached/memcached.h"; then
221-
PHP_LIBMEMCACHED_DIR="$PHP_LIBMEMCACHED_DIR"
222-
else
223-
AC_MSG_ERROR([Can't find libmemcached headers under "$PHP_LIBMEMCACHED_DIR"])
227+
if ! test -r "$PHP_LIBMEMCACHED_DIR/include/libmemcached-1.0/memcached.h"; then
228+
AC_MSG_ERROR([Can't find libmemcached 1.0.x headers under "$PHP_LIBMEMCACHED_DIR"])
224229
fi
225230
else
226231
PHP_LIBMEMCACHED_DIR="no"
@@ -232,17 +237,11 @@ if test "$PHP_MEMCACHED" != "no"; then
232237
done
233238
fi
234239

235-
if test "$PHP_MEMCACHED_SASL" != "no"; then
236-
AC_CHECK_HEADERS([sasl/sasl.h], [memcached_enable_sasl="yes"], [memcached_enable_sasl="no"])
237-
AC_MSG_CHECKING([whether to enable sasl support])
238-
AC_MSG_RESULT([$memcached_enable_sasl])
239-
fi
240-
241-
AC_MSG_CHECKING([for libmemcached location])
242240
if test "$PHP_LIBMEMCACHED_DIR" = "no"; then
243-
AC_MSG_ERROR([memcached support requires libmemcached. Use --with-libmemcached-dir=<DIR> to specify the prefix where libmemcached headers and library are located])
241+
AC_MSG_ERROR([memcached support requires libmemcached 1.0.x. Use --with-libmemcached-dir=<DIR> to specify the prefix where libmemcached headers and library are located])
244242
else
245243
AC_MSG_RESULT([$PHP_LIBMEMCACHED_DIR])
244+
246245
PHP_LIBMEMCACHED_INCDIR="$PHP_LIBMEMCACHED_DIR/include"
247246
PHP_ADD_INCLUDE($PHP_LIBMEMCACHED_INCDIR)
248247
PHP_ADD_LIBRARY_WITH_PATH(memcached, $PHP_LIBMEMCACHED_DIR/$PHP_LIBDIR, MEMCACHED_SHARED_LIBADD)

php_libmemcached_compat.h

+2-11
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
1-
/*
2-
* Here we define backwards compatibility for older
3-
* libmemcached API:s
4-
*
5-
* // Teddy Grenman <[email protected]>
6-
*/
7-
81
#ifndef PHP_LIBMEMCACHED_COMPAT
92
#define PHP_LIBMEMCACHED_COMPAT
103

11-
#if !defined(LIBMEMCACHED_VERSION_HEX) || LIBMEMCACHED_VERSION_HEX < 0x00039000
12-
/* definition from libmemcached/types.h version 0.39+ */
13-
typedef const struct memcached_server_st *memcached_server_instance_st;
14-
#endif
4+
/* this is the version(s) we support */
5+
#include <libmemcached-1.0/memcached.h>
156

167
#endif

php_memcached.c

+10-8
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@
4343
#include <ext/standard/php_smart_str.h>
4444
#include <ext/standard/php_var.h>
4545
#include <ext/standard/basic_functions.h>
46-
#include <libmemcached/memcached.h>
4746

48-
#include "php_libmemcached_compat.h"
4947
#include "php_memcached.h"
5048
#include "g_fmt.h"
5149

@@ -2582,9 +2580,12 @@ static memcached_return php_memc_do_serverlist_callback(const memcached_st *ptr,
25822580

25832581
MAKE_STD_ZVAL(array);
25842582
array_init(array);
2585-
add_assoc_string(array, "host", instance->hostname, 1);
2586-
add_assoc_long(array, "port", instance->port);
2583+
add_assoc_string(array, "host", memcached_server_name(instance), 1);
2584+
add_assoc_long(array, "port", memcached_server_port(instance));
2585+
/*
2586+
* API does not allow to get at this field.
25872587
add_assoc_long(array, "weight", instance->weight);
2588+
*/
25882589
add_next_index_zval(context->return_value, array);
25892590
return MEMCACHED_SUCCESS;
25902591
}
@@ -2595,7 +2596,7 @@ static memcached_return php_memc_do_stats_callback(const memcached_st *ptr, memc
25952596
int hostport_len;
25962597
struct callbackContext* context = (struct callbackContext*) in_context;
25972598
zval *entry;
2598-
hostport_len = spprintf(&hostport, 0, "%s:%d", instance->hostname, instance->port);
2599+
hostport_len = spprintf(&hostport, 0, "%s:%d", memcached_server_name(instance), memcached_server_port(instance));
25992600

26002601
MAKE_STD_ZVAL(entry);
26012602
array_init(entry);
@@ -2640,10 +2641,11 @@ static memcached_return php_memc_do_version_callback(const memcached_st *ptr, me
26402641
int hostport_len, version_len;
26412642
struct callbackContext* context = (struct callbackContext*) in_context;
26422643

2643-
hostport_len = spprintf(&hostport, 0, "%s:%d", instance->hostname, instance->port);
2644+
hostport_len = spprintf(&hostport, 0, "%s:%d", memcached_server_name(instance), memcached_server_port(instance));
26442645
version_len = snprintf(version, sizeof(version), "%d.%d.%d",
2645-
instance->major_version, instance->minor_version,
2646-
instance->micro_version);
2646+
memcached_server_major_version(instance),
2647+
memcached_server_minor_version(instance),
2648+
memcached_server_micro_version(instance));
26472649

26482650
add_assoc_stringl_ex(context->return_value, hostport, hostport_len+1, version, version_len, 1);
26492651
efree(hostport);

php_memcached.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#ifndef PHP_MEMCACHED_H
2020
#define PHP_MEMCACHED_H
2121

22-
#include <libmemcached/memcached.h>
22+
#include "php_libmemcached_compat.h"
2323

2424
#ifdef HAVE_CONFIG_H
2525
# include "config.h"
@@ -91,7 +91,7 @@ PHP_MINIT_FUNCTION(memcached);
9191
PHP_MSHUTDOWN_FUNCTION(memcached);
9292
PHP_MINFO_FUNCTION(memcached);
9393

94-
#define PHP_MEMCACHED_VERSION "2.0.1"
94+
#define PHP_MEMCACHED_VERSION "2.1.0"
9595

9696
#ifdef ZTS
9797
#define MEMC_G(v) TSRMG(php_memcached_globals_id, zend_php_memcached_globals *, v)

php_memcached_session.c

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#include <zend_exceptions.h>
3131
#include <ext/standard/php_smart_str.h>
3232
#include <ext/standard/php_var.h>
33-
#include <libmemcached/memcached.h>
3433

3534
#include "php_memcached.h"
3635
#include "php_memcached_session.h"

0 commit comments

Comments
 (0)