From 9d5b24e2b012a9701a2fce5fa04df2eb44f0dba7 Mon Sep 17 00:00:00 2001 From: Harold Kyle Date: Tue, 24 Sep 2013 23:54:33 -0400 Subject: [PATCH 1/6] Update configuration to avoid checking for URLs with query strings. These are never cached. --- wp-ffpc-nginx-sample.conf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wp-ffpc-nginx-sample.conf b/wp-ffpc-nginx-sample.conf index 487de73..1afe2a8 100644 --- a/wp-ffpc-nginx-sample.conf +++ b/wp-ffpc-nginx-sample.conf @@ -93,6 +93,11 @@ MEMCACHED_SERVERS set $memcached_request 0; } + # avoid cache serve of any URL with query strings + if ( $args ) { + set $memcached_request 0; + } + LOGGEDIN_EXCEPTION COOKIES_EXCEPTION -- 2.46.2 From 3013c1ed7a2bf7aed127d2603182ca8d7995833f Mon Sep 17 00:00:00 2001 From: Peter Molnar Date: Thu, 7 Nov 2013 20:53:32 +0000 Subject: [PATCH 2/6] Merge branches 'master' and 'mcachesock' into mcachesock -- 2.46.2 From 3168ca38924fa0662e005dfbde2826b7825efef4 Mon Sep 17 00:00:00 2001 From: Peter Molnar Date: Thu, 7 Nov 2013 21:11:12 +0000 Subject: [PATCH 3/6] memcached unix socket, first draft --- wp-ffpc-backend.php | 24 ++++++++++++++---------- wp-ffpc-class.php | 6 +++--- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/wp-ffpc-backend.php b/wp-ffpc-backend.php index c323116..18d02c6 100644 --- a/wp-ffpc-backend.php +++ b/wp-ffpc-backend.php @@ -387,14 +387,13 @@ if (!class_exists('WP_FFPC_Backend')) { $separator = strpos( $sstring , self::port_separator ); $host = substr( $sstring, 0, $separator ); $port = substr( $sstring, $separator + 1 ); + // unix socket failsafe + if ( empty ($port) ) $port = 0; - /* IP server */ - if ( !empty ( $host ) && !empty($port) && is_numeric($port) ) { - $this->options['servers'][$sstring] = array ( - 'host' => $host, - 'port' => $port - ); - } + $this->options['servers'][$sstring] = array ( + 'host' => $host, + 'port' => $port + ); } } @@ -692,11 +691,16 @@ if (!class_exists('WP_FFPC_Backend')) { /* adding servers */ foreach ( $this->options['servers'] as $server_id => $server ) { - /* reset server status to unknown */ if ( $this->options['persistent'] == '1' ) - $this->status[$server_id] = $this->connection->pconnect ( $server['host'] , $server['port'] ); + $conn = 'pconnect'; else - $this->status[$server_id] = $this->connection->connect ( $server['host'] , $server['port'] ); + $conn = 'connect'; + + /* in case of unix socket */ + if ( $server['port'] === 0 ) + $this->status[$server_id] = $this->connection->$conn ( 'unix:/' . $server['host'] ); + else + $this->status[$server_id] = $this->connection->$conn ( $server['host'] , $server['port'] ); $this->log ( $server_id . __translate__(" added, persistent mode: ", $this->plugin_constant ) . $this->options['persistent'] ); } diff --git a/wp-ffpc-class.php b/wp-ffpc-class.php index ab3ec9a..e2c1812 100644 --- a/wp-ffpc-class.php +++ b/wp-ffpc-class.php @@ -250,9 +250,8 @@ if ( ! class_exists( 'WP_FFPC' ) ) { /** * uninstall hook function, to be extended - * [TODO] static abstraction is not allowed in PHP; how to do this? */ - static public function plugin_uninstall( $delete_options = true ) { + public function plugin_uninstall( $delete_options = true ) { /* delete advanced-cache.php file */ unlink ( $this->acache ); @@ -606,7 +605,8 @@ if ( ! class_exists( 'WP_FFPC' ) ) {
- No spaces are allowed, please stick to use ":" for separating host and port and "," for separating entries. Do not add trailing ",".', $this->plugin_constant); ?> + + - in case of TCP based connections, list the servers as host1:port1,host2:port2,... . Do not add trailing , and always separate host and port with : .
- in2.0.0b1 case using unix sockets with the Memcache driver: unix:// ', $this->plugin_constant); ?>
-- 2.46.2 From e068f395560bda0b7c7a6d1f742c3bfd669b6eb9 Mon Sep 17 00:00:00 2001 From: Dave Clark Date: Wed, 1 Jan 2014 23:19:04 +1100 Subject: [PATCH 4/6] Update wp-ffpc-class.php Fixed undefined variable - minor typo (memcache_protocol was defined however conditional test was checking equivalence of undefined variable memcached_protocol). --- wp-ffpc-class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-ffpc-class.php b/wp-ffpc-class.php index ab3ec9a..c6873fc 100644 --- a/wp-ffpc-class.php +++ b/wp-ffpc-class.php @@ -220,7 +220,7 @@ if ( ! class_exists( 'WP_FFPC' ) ) { if ( !empty ( $memcache_settings ) && $this->options['cache_type'] == 'memcache' ) { $memcache_protocol = strtolower($memcache_settings['memcache.protocol']['local_value']); - if ( $memcached_protocol == 'binary' ) { + if ( $memcache_protocol == 'binary' ) { $this->errors['binary_memcache'] = __('WARNING: Memcache extension is configured to use binary mode. This is very buggy and the plugin will most probably not work correctly.
Please consider to change either to ASCII mode or to Memcached extension.', $this->plugin_constant ); } } -- 2.46.2 From cc68f59215d517cebbe813815d5eaa35aed1ba6e Mon Sep 17 00:00:00 2001 From: Dave Clark Date: Wed, 1 Jan 2014 23:38:59 +1100 Subject: [PATCH 5/6] Update wp-ffpc-acache.php Minor edit to avoid message: "Strict Standards: Only variables should be passed by reference" --- wp-ffpc-acache.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wp-ffpc-acache.php b/wp-ffpc-acache.php index 5325aee..da503d8 100644 --- a/wp-ffpc-acache.php +++ b/wp-ffpc-acache.php @@ -100,7 +100,8 @@ $wp_ffpc_keys = array ( 'meta' => $wp_ffpc_config['prefix_meta'], 'data' => $wp_ $wp_ffpc_values = array(); foreach ( $wp_ffpc_keys as $internal => $key ) { - $value = $wp_ffpc_backend->get ( $wp_ffpc_backend->key ( $key ) ); + $key = $wp_ffpc_backend->key ( $key ); + $value = $wp_ffpc_backend->get ( $key ); if ( ! $value ) { /* does not matter which is missing, we need both, if one fails, no caching */ -- 2.46.2 From e019caa4adc1ea91bf20826bea06e0cf0afc6f67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Jerosimi=C4=87?= Date: Fri, 10 Jan 2014 23:20:55 +0100 Subject: [PATCH 6/6] Fixed issue in uninstall script When using 'uninstall.php' the plugin should always check for the WP_UNINSTALL_PLUGIN constant, before executing. The WP_UNINSTALL_PLUGIN constant is defined by WordPress at runtime during a plugin uninstall, it will not be present if 'uninstall.php' is requested directly. --- uninstall.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/uninstall.php b/uninstall.php index 144627d..bc66239 100644 --- a/uninstall.php +++ b/uninstall.php @@ -3,6 +3,11 @@ * uninstall file for WP-FFPC; uninstall hook does not remove the databse options */ +// exit if uninstall not called from WordPress +if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) { + exit; +} + /* get the worker file */ include_once ( 'wp-ffpc.php' ); -- 2.46.2