all repos — wp-ffpc @ d715c6fbaf69c9eec8d44de611a50ac064240ca9

fixes + hand-merge of https://github.com/petermolnar/wp-ffpc/pull/38/files
Peter Molnar hello@petermolnar.eu
Fri, 05 Jun 2015 09:50:42 +0100
commit

d715c6fbaf69c9eec8d44de611a50ac064240ca9

parent

0da7a83f0eed0310639f67d6c9efe3120eb8da10

3 files changed, 17 insertions(+), 17 deletions(-)

jump to
M readme.txtreadme.txt

@@ -15,7 +15,7 @@

WP-FFPC ( WordPress Fast Full Page Cache ) is a cache plugin for [WordPress](http://wordpress.org/ "WordPress"). It works with any webserver, including apache2, lighttpd, nginx. It can be configured to join forces with [NGiNX](http://NGiNX.org "NGiNX")'s built-in [memcached plugin](http://nginx.org/en/docs/http/ngx_http_memcached_module.html "memcached plugin") for unbeatable speed. -= IMPORTANT NOTES, PLEASE READ THIS LIST = += **IMPORTANT NOTES, PLEASE READ THIS LIST** = * Requirements: * WordPress >= 3.0

@@ -25,7 +25,7 @@ * memcached with [PHP Memcache](http://php.net/manual/en/book.memcache.php "Memcache") > 2.1.0

* [APC](http://php.net/manual/en/book.apc.php "APC") * [APCu](http://pecl.php.net/package/APCu "APC User Cache") * PHP 5.3+ is really highly recommended, see "Known issues" -* This plugin does kick in right after activation. You have to adjust the setting in Settings -> WP-FFPC.* +* This plugin does **not** kick in right after activation. You have to adjust the setting in Settings -> WP-FFPC and save the settings.* = Known issues =
M wp-ffpc-acache.phpwp-ffpc-acache.php

@@ -71,6 +71,12 @@ return false;

} } +/* canonical redirect storage */ +$wp_ffpc_redirect = null; +/* fires up the backend storage array with current config */ +include_once ('wp-ffpc-backend.php'); +$wp_ffpc_backend = new WP_FFPC_Backend( $wp_ffpc_config ); + /* no cache for for logged in users unless it's set identifier cookies are listed in backend as var for easier usage */

@@ -83,14 +89,7 @@ return false;

} } } - } - -/* canonical redirect storage */ -$wp_ffpc_redirect = null; -/* fires up the backend storage array with current config */ -include_once ('wp-ffpc-backend.php'); -$wp_ffpc_backend = new WP_FFPC_Backend( $wp_ffpc_config ); /* will store time of page generation */ $wp_ffpc_gentime = 0;

@@ -182,7 +181,7 @@ if ( $wp_ffpc_config['generate_time'] == '1' && stripos($wp_ffpc_values['data'], '</body>') ) {

$mtime = explode ( " ", microtime() ); $wp_ffpc_gentime = ( $mtime[1] + $mtime[0] ) - $wp_ffpc_gentime; - $insertion = "\n<!-- \nWP-FFPC cache output stats\n\tcache engine: ". $wp_ffpc_config['cache_type'] ."\n\tUNIX timestamp: ". time() . "\n\tdate: ". date( 'c' ) . "\n\tfrom server: ". $_SERVER['SERVER_ADDR'] . "\n\t - if you see this, WP-FFPC used the cache to serve the page\n-->\n"; + $insertion = "\n<!-- WP-FFPC cache output stats\n\tcache engine: ". $wp_ffpc_config['cache_type'] ."\n\tUNIX timestamp: ". time() . "\n\tdate: ". date( 'c' ) . "\n\tfrom server: ". $_SERVER['SERVER_ADDR'] . " -->\n"; $index = stripos( $wp_ffpc_values['data'] , '</body>' ); $wp_ffpc_values['data'] = substr_replace( $wp_ffpc_values['data'], $insertion, $index, 0);

@@ -316,17 +315,17 @@ global $wp_ffpc_gentime;

$mtime = explode ( " ", microtime() ); $wp_ffpc_gentime = ( $mtime[1] + $mtime[0] )- $wp_ffpc_gentime; - $insertion = "\n<!-- \nWP-FFPC cache generation stats" . "\n\tgeneration time: ". round( $wp_ffpc_gentime, 3 ) ." seconds\n\tgeneraton UNIX timestamp: ". time() . "\n\tgeneraton date: ". date( 'c' ) . "\n\tgenerator server: ". $_SERVER['SERVER_ADDR'] . "\n\t - at this point the cache entry is only created by WP-FFPC but the page is not yet served from the cache\n-->\n"; + $insertion = "\n<!-- WP-FFPC cache generation stats" . "\n\tgeneration time: ". round( $wp_ffpc_gentime, 3 ) ." seconds\n\tgeneraton UNIX timestamp: ". time() . "\n\tgeneraton date: ". date( 'c' ) . "\n\tgenerator server: ". $_SERVER['SERVER_ADDR'] . " -->\n"; $index = stripos( $buffer , '</body>' ); - $buffer = substr_replace( $buffer, $insertion, $index, 0); + $to_store = substr_replace( $buffer, $insertion, $index, 0); } $prefix_meta = $wp_ffpc_backend->key ( $wp_ffpc_config['prefix_meta'] ); $wp_ffpc_backend->set ( $prefix_meta, $meta ); $prefix_data = $wp_ffpc_backend->key ( $wp_ffpc_config['prefix_data'] ); - $wp_ffpc_backend->set ( $prefix_data , $buffer ); + $wp_ffpc_backend->set ( $prefix_data , $to_store ); if ( !empty( $meta['status'] ) && $meta['status'] == 404 ) { header("HTTP/1.1 404 Not Found");
M wp-ffpc-class.phpwp-ffpc-class.php

@@ -221,7 +221,7 @@ $this->errors['no_wp_cache'] = __("WP_CACHE is disabled. Without that, cache plugins, like this, will not work. Please add `define ( 'WP_CACHE', true );` to the beginning of wp-config.php.", $this->plugin_constant );

/* look for global settings array */ if ( ! $this->global_saved ) - $this->errors['no_global_saved'] = sprintf( __('This site was reached as %s ( according to PHP HTTP_HOST ) and there are no settings present for this domain in the WP-FFPC configuration yet. Please save the <a href="%s">WP-FFPC settings</a> for the domain or fix the webserver configuration!', $this->plugin_constant), $_SERVER['HTTP_HOST'], $this->settings_link); + $this->errors['no_global_saved'] = sprintf( __('This site was reached as %s ( according to PHP HTTP_HOST ) and there are no settings present for this domain in the WP-FFPC configuration yet. Please save the %s for the domain or fix the webserver configuration!', $this->plugin_constant), $_SERVER['HTTP_HOST'], $settings_link); /* look for writable acache file */ if ( file_exists ( $this->acache ) && ! is_writable ( $this->acache ) )

@@ -229,7 +229,7 @@ $this->errors['no_acache_write'] = sprintf(__('Advanced cache file (%s) is not writeable!<br />Please change the permissions on the file.', $this->plugin_constant), $this->acache);

/* look for acache file */ if ( ! file_exists ( $this->acache ) ) - $this->errors['no_acache_saved'] = sprintf (__('Advanced cache file is yet to be generated, please save <a href="%s">WP-FFPC settings!</a>', $this->plugin_constant), $this->settings_link ); + $this->errors['no_acache_saved'] = sprintf (__('Advanced cache file is yet to be generated, please save %s', $this->plugin_constant), $settings_link ); /* look for extensions that should be available */ foreach ( $this->valid_cache_type as $backend => $status ) {

@@ -1074,10 +1074,11 @@ $nginx = str_replace ( 'COOKIES_EXCEPTION' , '' , $nginx );

} /* add custom response header if specified in the options */ - if( $this->options['response_header'] ){ + if( $this->options['response_header'] && strstr ( $this->options['cache_type'], 'memcached') ) { $response_header = 'add_header X-Cache-Engine "WP-FFPC with ' . $this->options['cache_type'] .' via nginx";'; $nginx = str_replace ( 'RESPONSE_HEADER' , $response_header , $nginx ); - } else{ + } + else { $nginx = str_replace ( 'RESPONSE_HEADER' , '' , $nginx ); }