1.8.3
Peter Molnar hello@petermolnar.eu
Thu, 07 May 2015 13:33:32 +0100
5 files changed,
29 insertions(+),
12 deletions(-)
M
readme.txt
→
readme.txt
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XU3DG7LLA76WC
Tags: cache, page cache, full page cache, nginx, memcached, apc, speed Requires at least: 3.0 Tested up to: 4.2.1 -Stable tag: 1.8.2 +Stable tag: 1.8.3 License: GPLv3 License URI: http://www.gnu.org/licenses/gpl-3.0.html@@ -124,6 +124,11 @@
* every A. indicates BIG changes. * every .B version indicates new features. * every ..C indicates bugfixes for A.B version. + += 1.8.3 = +*2015-05-07* + +* small change in key creation: prefix is kept in front of sha1 hashes for debugging purposes = 1.8.2 = *2015-04-30*
M
wp-ffpc-backend.php
→
wp-ffpc-backend.php
@@ -139,10 +139,11 @@ public function key ( $prefix, $customUrimap = null ) {
$urimap = $customUrimap ?: $this->urimap; $key_base = self::map_urimap($urimap, $this->options['key']); - /* data is string only with content, meta is not used in nginx */ + + if ( isset($this->options['hashkey']) && $this->options['hashkey'] == true) + $key_base = sha1($key_base); + $key = $prefix . $key_base; - if ( isset($this->options['hashkey']) && $this->options['hashkey'] == true) - $key = sha1 ($prefix . $key_base ); $this->log ( sprintf( __translate__( 'original key configuration: %s', $this->plugin_constant ), $this->options['key'] ) ); $this->log ( sprintf( __translate__( 'setting key for: %s', $this->plugin_constant ), $key_base ) );
M
wp-ffpc-class.php
→
wp-ffpc-class.php
@@ -576,7 +576,7 @@ <label for="hashkey"><?php _e('SHA1 hash key', $this->plugin_constant); ?></label>
</dt> <dd> <input type="checkbox" name="hashkey" id="hashkey" value="1" <?php checked($this->options['hashkey'],true); ?> /> - <span class="description"><?php _e('Occasionally URL can be too long to be used as key for the backend storage, especially with memcached. Turn on this feature to use SHA1 hash of the URL as key instead. Please be aware that you have to add ( or uncomment ) a line in nginx if you want nginx to fetch the data directly; for details, please see the nginx example tab.', $this->plugin_constant); ?> + <span class="description"><?php _e('Occasionally URL can be too long to be used as key for the backend storage, especially with memcached. Turn on this feature to use SHA1 hash of the URL as key instead. Please be aware that you have to add ( or uncomment ) a line and a <strong>module</strong> in nginx if you want nginx to fetch the data directly; for details, please see the nginx example tab.', $this->plugin_constant); ?> </dd>@@ -745,6 +745,7 @@ </fieldset>
<fieldset id="<?php echo $this->plugin_constant ?>-nginx"> <legend><?php _e('Sample config for nginx to utilize the data entries', $this->plugin_constant); ?></legend> + <div class="update-nag"><strong>In case you are about to use nginx to fetch memcached entries directly and to use SHA1 hash keys, you will need an nginx version compiled with <a href="http://wiki.nginx.org/HttpSetMiscModule">HttpSetMiscModule</a>. Otherwise set_sha1 function is not available in nginx.</strong></div> <pre><?php echo $this->nginx_example(); ?></pre> </fieldset>@@ -1019,10 +1020,19 @@ private function nginx_example () {
/* read the sample file */ $nginx = file_get_contents ( $this->nginx_sample ); + if ( isset($this->options['hashkey']) && $this->options['hashkey'] == true ) + $mckeys = 'set_sha1 $memcached_sha1_key $memcached_raw_key; + set $memcached_key DATAPREFIX$memcached_sha1_key;'; + else + $mckeys = 'set $memcached_key DATAPREFIX$memcached_raw_key;'; + + $nginx = str_replace ( 'HASHEDORNOT' , $mckeys , $nginx ); + /* replace the data prefix with the configured one */ - $to_replace = array ( 'DATAPREFIX' , 'SERVERROOT', 'SERVERLOG' ); - $replace_with = array ( $this->options['prefix_data'] . $this->options['key'] , ABSPATH, $_SERVER['SERVER_NAME'] ); + $to_replace = array ( 'DATAPREFIX' , 'KEYFORMAT', 'SERVERROOT', 'SERVERLOG' ); + $replace_with = array ( $this->options['prefix_data'], $this->options['key'] , ABSPATH, $_SERVER['SERVER_NAME'] ); $nginx = str_replace ( $to_replace , $replace_with , $nginx ); + /* set upstream servers from configured servers, best to get from the actual backend */ $servers = $this->backend->get_servers();
M
wp-ffpc-nginx-sample.conf
→
wp-ffpc-nginx-sample.conf
@@ -70,10 +70,11 @@ #fastcgi_param SSL_SESSION_ID $ssl_session_id if_not_empty;
#fastcgi_param SSL_CLIENT_VERIFY $ssl_client_verify if_not_empty; default_type text/html; - set $memcached_raw_key data-$scheme://$host$request_uri; - # uncomment the following line if you have enabled - # sha1 hash option - # set_sha1 $memcached_key $memcached_raw_key; + + set $memcached_raw_key KEYFORMAT; + + HASHEDORNOT + set $memcached_request 1; if ($request_method = POST ) {
M
wp-ffpc.php
→
wp-ffpc.php
@@ -3,7 +3,7 @@ /*
Plugin Name: WP-FFPC Plugin URI: https://github.com/petermolnar/wp-ffpc Description: WordPress in-memory full page cache plugin -Version: 1.8.2 +Version: 1.8.3 Author: Peter Molnar <hello@petermolnar.eu> Author URI: http://petermolnar.eu/ License: GPLv3