From fe07b27754afec0bf29729ab8d1db2cdaf9d6eed Mon Sep 17 00:00:00 2001 From: cadeyrn Date: Thu, 16 Aug 2012 10:33:56 +0000 Subject: [PATCH] scheme added to key git-svn-id: http://plugins.svn.wordpress.org/wp-ffpc/trunk@586168 b8457f37-d9ea-0310-8a92-e5e31aec5664 --- advanced-cache.php | 7 +++++-- nginx-sample.conf | 6 ++---- readme.txt | 2 ++ wp-ffpc-common.php | 5 +++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/advanced-cache.php b/advanced-cache.php index 156d968..a3c0ed1 100644 --- a/advanced-cache.php +++ b/advanced-cache.php @@ -65,10 +65,13 @@ if ( !$wp_ffpc_backend_status ) /* use the full accessed URL string as key, same will be generated by nginx as well we need a data and a meta key: data is string only with content, meta is not used in nginx */ +global $wp_ffpc_data_key_protocol; +$wp_ffpc_data_key_protocol = empty ( $_SERVER['HTTPS'] ) ? 'http://' : 'https://'; + global $wp_ffpc_data_key; -$wp_ffpc_data_key = $wp_ffpc_config['prefix_data'] . $_SERVER['HTTP_HOST'] . $wp_ffpc_uri; +$wp_ffpc_data_key = $wp_ffpc_config['prefix_data'] . $wp_ffpc_data_key_protocol . $_SERVER['HTTP_HOST'] . $wp_ffpc_uri; global $wp_ffpc_meta_key; -$wp_ffpc_meta_key = $wp_ffpc_config['prefix_meta'] . $_SERVER['HTTP_HOST'] . $wp_ffpc_uri; +$wp_ffpc_meta_key = $wp_ffpc_config['prefix_meta'] . $wp_ffpc_data_key_protocol . $_SERVER['HTTP_HOST'] . $wp_ffpc_uri; /* search for valid meta entry */ global $wp_ffpc_meta; diff --git a/nginx-sample.conf b/nginx-sample.conf index 4b7e92b..a14867b 100644 --- a/nginx-sample.conf +++ b/nginx-sample.conf @@ -10,7 +10,7 @@ http { location @memcached { default_type text/html; - set $memcached_key DATAPREFIX$host$request_uri; + set $memcached_key DATAPREFIX$scheme://$host$request_uri; memcached_pass MEMCACHEDHOST:MEMCACHEDPORT; error_page 404 = @rewrites; } @@ -18,10 +18,8 @@ http { location @rewrites { rewrite ^(.*)$ /index.php?q=$1 last; } - + ... } } ... - - diff --git a/readme.txt b/readme.txt index bfe86a2..016de7e 100644 --- a/readme.txt +++ b/readme.txt @@ -69,11 +69,13 @@ You have to remove the default yum package, named `php-pecl-memcache` and instal = 0.4 = 2012.08.06 + * tested against new WordPress versions * added lines to "memcached" storage to be able to work with nginx as well * added lines to "memcached" to use binary protocol ( tested with PHP Memcached version 2.0.1 ) KNOWN ISSUES + * "memcache" extension fails in binary mode; the reason is under investigation = 0.3.2 = diff --git a/wp-ffpc-common.php b/wp-ffpc-common.php index a1faaae..df24ea9 100644 --- a/wp-ffpc-common.php +++ b/wp-ffpc-common.php @@ -102,8 +102,9 @@ function wp_ffpc_clear ( $post_id = false ) { $path = substr ( get_permalink($post_id) , 7 ); if (empty($path)) return false; - $meta = $wp_ffpc_config['prefix-meta'] . $path; - $data = $wp_ffpc_config['prefix-data'] . $path; + $wp_ffpc_data_key_protocol = empty ( $_SERVER['HTTPS'] ) ? 'http://' : 'https://'; + $meta = $wp_ffpc_config['prefix-meta'] . $wp_ffpc_data_key_protocol . $path; + $data = $wp_ffpc_config['prefix-data'] . $wp_ffpc_data_key_protocol . $path; } switch ($wp_ffpc_config['cache_type'])