From 9804bc515ef6e37176094fe7f35de57c4d3f78e5 Mon Sep 17 00:00:00 2001 From: Peter Molnar Date: Mon, 2 Jun 2014 16:02:13 +0100 Subject: [PATCH] adding SASL auth fields & support for memcached --- wp-ffpc-backend.php | 4 ++++ wp-ffpc-class.php | 25 +++++++++++++++++++++++++ wp-ffpc.php | 4 +++- 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/wp-ffpc-backend.php b/wp-ffpc-backend.php index c30f401..c26a783 100644 --- a/wp-ffpc-backend.php +++ b/wp-ffpc-backend.php @@ -735,6 +735,10 @@ if (!class_exists('WP_FFPC_Backend')) { /* use binary and not compressed format, good for nginx and still fast */ $this->connection->setOption( Memcached::OPT_COMPRESSION , false ); $this->connection->setOption( Memcached::OPT_BINARY_PROTOCOL , true ); + + if ( version_compare( phpversion( 'memcached' ) , '2.0.0', '>=' ) && ini_get( 'memcached.use_sasl' ) == 1 ) { + $this->connection->setSaslAuthData ( $this->options['authuser'], $this->options['authpass']); + } } /* check if initialization was success or not */ diff --git a/wp-ffpc-class.php b/wp-ffpc-class.php index 83c1310..7d71713 100644 --- a/wp-ffpc-class.php +++ b/wp-ffpc-class.php @@ -631,6 +631,31 @@ if ( ! class_exists( 'WP_FFPC' ) ) { options['persistent'],true); ?> /> plugin_constant); ?> + + options['cache_type'], 'memcached') && extension_loaded ( 'memcached' ) && version_compare( phpversion( 'memcached' ) , '2.0.0', '>=' ) ) { ?> + options['authuser'] ) || !empty( $this->options['authpass'] ) ) ) { ?> +

plugin_constant ) ?>

+ +
+ +
+
+ + + plugin_constant); ?> +
+ +
+ +
+
+ + + plugin_constant); ?> +
+ diff --git a/wp-ffpc.php b/wp-ffpc.php index 97d793d..ef1da94 100644 --- a/wp-ffpc.php +++ b/wp-ffpc.php @@ -29,6 +29,8 @@ include_once ( 'wp-ffpc-class.php' ); $wp_ffpc_defaults = array ( 'hosts'=>'127.0.0.1:11211', + 'authpass'=>'', + 'authuser'=>'', 'expire'=>300, 'invalidation_method'=>0, 'prefix_meta' =>'meta-', @@ -51,6 +53,6 @@ $wp_ffpc_defaults = array ( 'comments_invalidate' => true, ); -$wp_ffpc = new WP_FFPC ( 'wp-ffpc', '1.4.0', 'WP-FFPC', $wp_ffpc_defaults, 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XU3DG7LLA76WC' ); +$wp_ffpc = new WP_FFPC ( 'wp-ffpc', '1.6.0', 'WP-FFPC', $wp_ffpc_defaults, 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XU3DG7LLA76WC' ); ?>