bugfixes and small enhancements

This commit is contained in:
Peter Molnar 2014-12-08 09:19:01 +00:00
parent 8d14b21ad8
commit eb49420052
5 changed files with 50 additions and 19 deletions

View file

@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
Tags: cache, page cache, full page cache, nginx, memcached, apc, speed Tags: cache, page cache, full page cache, nginx, memcached, apc, speed
Requires at least: 3.0 Requires at least: 3.0
Tested up to: 4.0 Tested up to: 4.0
Stable tag: 1.7.0 Stable tag: 1.7.1
License: GPLv3 License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html License URI: http://www.gnu.org/licenses/gpl-3.0.html
@ -47,8 +47,12 @@ Many thanks for donations, contributors, supporters, testers & bug reporters:
* [Dave Clark](https://github.com/dkcwd "Dave Clark") * [Dave Clark](https://github.com/dkcwd "Dave Clark")
* Miguel Clara * Miguel Clara
* [plescheff](https://github.com/plescheff) * [plescheff](https://github.com/plescheff)
* Firas Dib
* [CotswoldPhoto](http://wordpress.org/support/profile/cotswoldphoto) * [CotswoldPhoto](http://wordpress.org/support/profile/cotswoldphoto)
* [tamagokun](https://github.com/tamagokun) * [tamagokun](https://github.com/tamagokun)
* Many Ayromlou
* mailgarant.nl
* Christian Rößner
== Installation == == Installation ==
@ -110,6 +114,22 @@ Version numbering logic:
* every .B version indicates new features. * every .B version indicates new features.
* every ..C indicates bugfixes for A.B version. * every ..C indicates bugfixes for A.B version.
= 1.7.1 =
*2014-12-04*
What's fixed:
* [Unable to determine path from Post Permalink](https://wordpress.org/support/topic/unable-to-determine-path-from-post-permalink) noise fixed
* potential Multisite precache bug fixed ( database prefixes were not set according to original prefix )
What's new:
* added permanent cache exception of localhost
What's changed:
* pingback header preservation is now off by default and can manually be turned on
= 1.7.0 = = 1.7.0 =
*2014-09-19* *2014-09-19*
@ -123,10 +143,6 @@ What's changed:
* **dropped persistent memcache mode**: no one was using it and even if the were only caused trouble * **dropped persistent memcache mode**: no one was using it and even if the were only caused trouble
* **removed '/wp-' hardcoded cache exception**; this is now the default in the regex exceptions field as ^/wp-; please add this manually in case you've already been using the regex field * **removed '/wp-' hardcoded cache exception**; this is now the default in the regex exceptions field as ^/wp-; please add this manually in case you've already been using the regex field
What's on it's way:
* brace yourselves, redis support is coming
= 1.6.4 = = 1.6.4 =
*2014-09-12* *2014-09-12*

View file

@ -3,6 +3,10 @@
* advanced cache worker of WordPress plugin WP-FFPC * advanced cache worker of WordPress plugin WP-FFPC
*/ */
/* ignore localhost */
if ( $_SERVER['SERVER_ADDR'] == $_SERVER['REMOTE_ADDR'] || $_SERVER['REMOTE_ADDR'] == '127.0.0.1' )
return false;
/* check for WP cache enabled*/ /* check for WP cache enabled*/
if ( !WP_CACHE ) if ( !WP_CACHE )
return false; return false;
@ -173,7 +177,7 @@ if ( !empty($wp_ffpc_values['meta']['lastmodified']) )
header( 'Last-Modified: ' . gmdate("D, d M Y H:i:s", $wp_ffpc_values['meta']['lastmodified'] ). " GMT" ); header( 'Last-Modified: ' . gmdate("D, d M Y H:i:s", $wp_ffpc_values['meta']['lastmodified'] ). " GMT" );
/* pingback urls, if existx */ /* pingback urls, if existx */
if ( !empty( $wp_ffpc_values['meta']['pingback'] ) ) if ( !empty( $wp_ffpc_values['meta']['pingback'] ) && $wp_ffpc_config['pingback_header'] )
header( 'X-Pingback: ' . $wp_ffpc_values['meta']['pingback'] ); header( 'X-Pingback: ' . $wp_ffpc_values['meta']['pingback'] );
/* for debugging */ /* for debugging */
@ -182,6 +186,7 @@ if ( $wp_ffpc_config['response_header'] )
/* HTML data */ /* HTML data */
echo $wp_ffpc_values['data']; echo $wp_ffpc_values['data'];
flush(); flush();
die(); die();
@ -318,6 +323,9 @@ function wp_ffpc_callback( $buffer ) {
$wp_ffpc_backend->set ( $prefix_meta, $meta ); $wp_ffpc_backend->set ( $prefix_meta, $meta );
$prefix_data = $wp_ffpc_backend->key ( $wp_ffpc_config['prefix_data'] ); $prefix_data = $wp_ffpc_backend->key ( $wp_ffpc_config['prefix_data'] );
//if ( $wp_ffpc_config['gzip'] && function_exists('gzencode') )
$wp_ffpc_backend->set ( $prefix_data , $buffer ); $wp_ffpc_backend->set ( $prefix_data , $buffer );
if ( !empty( $meta['status'] ) && $meta['status'] == 404 ) { if ( !empty( $meta['status'] ) && $meta['status'] == 404 ) {

View file

@ -254,7 +254,7 @@ class WP_FFPC_Backend {
$permalink = get_permalink( $post_id ); $permalink = get_permalink( $post_id );
/* no path, don't do anything */ /* no path, don't do anything */
if ( empty( $permalink ) ) { if ( empty( $permalink ) && $permalink != false ) {
$this->log ( sprintf( __translate__( 'unable to determine path from Post Permalink, post ID: %s', $this->plugin_constant ), $post_id ), LOG_WARNING ); $this->log ( sprintf( __translate__( 'unable to determine path from Post Permalink, post ID: %s', $this->plugin_constant ), $post_id ), LOG_WARNING );
return false; return false;
} }

View file

@ -176,8 +176,8 @@ class WP_FFPC extends PluginAbstract {
/* initiate backend */ /* initiate backend */
$this->backend = new WP_FFPC_Backend ( $this->options ); $this->backend = new WP_FFPC_Backend ( $this->options );
/* get all available post types */ /* get all available post types *
$post_types = get_post_types( ); $post_types = get_post_types( );*/
/* cache invalidation hooks */ /* cache invalidation hooks */
add_action( 'transition_post_status', array( &$this->backend , 'clear_ng' ), 10, 3 ); add_action( 'transition_post_status', array( &$this->backend , 'clear_ng' ), 10, 3 );
@ -562,6 +562,14 @@ class WP_FFPC extends PluginAbstract {
<fieldset id="<?php echo $this->plugin_constant ?>-debug"> <fieldset id="<?php echo $this->plugin_constant ?>-debug">
<legend><?php _e( 'Debug & in-depth settings', $this->plugin_constant ); ?></legend> <legend><?php _e( 'Debug & in-depth settings', $this->plugin_constant ); ?></legend>
<dl> <dl>
<dt>
<label for="pingback_header"><?php _e('Enable X-Pingback header preservation', $this->plugin_constant); ?></label>
</dt>
<dd>
<input type="checkbox" name="pingback_header" id="pingback_header" value="1" <?php checked($this->options['pingback_header'],true); ?> />
<span class="description"><?php _e('Preserve X-Pingback URL in response header.', $this->plugin_constant); ?></span>
</dd>
<dt> <dt>
<label for="log"><?php _e("Enable logging", $this->plugin_constant); ?></label> <label for="log"><?php _e("Enable logging", $this->plugin_constant); ?></label>
</dt> </dt>
@ -652,12 +660,6 @@ class WP_FFPC extends PluginAbstract {
<span class="description"><?php _e('Exclude content based on cookies names starting with this from caching. Separate multiple cookies names with commas.<br />If you are caching with nginx, you should update your nginx configuration and reload nginx after changing this value.', $this->plugin_constant); ?></span> <span class="description"><?php _e('Exclude content based on cookies names starting with this from caching. Separate multiple cookies names with commas.<br />If you are caching with nginx, you should update your nginx configuration and reload nginx after changing this value.', $this->plugin_constant); ?></span>
</dd> </dd>
<dt>
</dt>
<dd>
</dd>
<dt> <dt>
<label for="nocache_url"><?php _e("Don't cache following URL paths - use with caution!", $this->plugin_constant); ?></label> <label for="nocache_url"><?php _e("Don't cache following URL paths - use with caution!", $this->plugin_constant); ?></label>
</dt> </dt>
@ -669,6 +671,7 @@ class WP_FFPC extends PluginAbstract {
?></textarea> ?></textarea>
<span class="description"><?php _e('Regular expressions use you must! e.g. <em>pattern1|pattern2|etc</em>', $this->plugin_constant); ?></span> <span class="description"><?php _e('Regular expressions use you must! e.g. <em>pattern1|pattern2|etc</em>', $this->plugin_constant); ?></span>
</dd> </dd>
</dl> </dl>
</fieldset> </fieldset>
@ -1128,7 +1131,8 @@ class WP_FFPC extends PluginAbstract {
if ( $this->network ) { if ( $this->network ) {
/* list all blogs */ /* list all blogs */
global $wpdb; global $wpdb;
$blog_list = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM wp_blogs ORDER BY blog_id", '' ) ); $pfix = empty ( $wpdb->base_prefix ) ? 'wp' : $wpdb->base_prefix;
$blog_list = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM ". $pfix ."_blogs ORDER BY blog_id", '' ) );
foreach ($blog_list as $blog) { foreach ($blog_list as $blog) {
if ( $blog->archived != 1 && $blog->spam != 1 && $blog->deleted != 1) { if ( $blog->archived != 1 && $blog->spam != 1 && $blog->deleted != 1) {
@ -1190,14 +1194,16 @@ class WP_FFPC extends PluginAbstract {
case 'page': case 'page':
$permalink = get_page_link( $post->ID ); $permalink = get_page_link( $post->ID );
break; break;
case 'post': /*
* case 'post':
$permalink = get_permalink( $post->ID ); $permalink = get_permalink( $post->ID );
break; break;
*/
case 'attachment': case 'attachment':
$permalink = get_attachment_link( $post->ID ); $permalink = get_attachment_link( $post->ID );
break; break;
default: default:
$permalink = get_post_permalink( $post->ID ); $permalink = get_permalink( $post->ID );
break; break;
} }

View file

@ -54,8 +54,9 @@ $wp_ffpc_defaults = array (
'precache_schedule' => 'null', 'precache_schedule' => 'null',
'key' => '$scheme://$host$request_uri', 'key' => '$scheme://$host$request_uri',
'comments_invalidate' => true, 'comments_invalidate' => true,
'pingback_header' => false,
); );
$wp_ffpc = new WP_FFPC ( 'wp-ffpc', '1.7.0', 'WP-FFPC', $wp_ffpc_defaults, 'PeterMolnar_WordPressPlugins_wp-ffpc_HU' , 'WP-FFPC' , 'FA3NT7XDVHPWU' ); $wp_ffpc = new WP_FFPC ( 'wp-ffpc', '1.7.1', 'WP-FFPC', $wp_ffpc_defaults, 'PeterMolnar_WordPressPlugins_wp-ffpc_HU' , 'WP-FFPC' , 'FA3NT7XDVHPWU' );
?> ?>