v 1.1, bugfix, html comment functionality
Peter Molnar hello@petermolnar.eu
Mon, 25 Mar 2013 13:11:49 +0000
4 files changed,
34 insertions(+),
4 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, fast Requires at least: 3.0 Tested up to: 3.5.1 -Stable tag: 1.0 +Stable tag: 1.1 License: GPLv3 License URI: http://www.gnu.org/licenses/gpl-3.0.html@@ -77,6 +77,12 @@ 4. memcached servers settings
5. NGiNX example == Changelog == + += 1.1 = +*2013.03.25* + +* bugfix on backend status check +* validate working cache "noob" mode added ( option HTML comment with engine & generation time info ), feature request by rafaelmagic ( http://wordpress.org/support/profile/rafaelmagic ) = 1.0 = *2013.03.22*
M
wp-ffpc-acache.php
→
wp-ffpc-acache.php
@@ -66,6 +66,7 @@ }
$wp_ffpc_redirect = null; $wp_ffpc_backend = new WP_FFPC_Backend( $wp_ffpc_config ); +$wp_ffpc_gentime = 0; if ( $wp_ffpc_backend->status() === false ) return false;@@ -146,6 +147,10 @@ * starts caching function
* */ function wp_ffpc_start( ) { + global $wp_ffpc_gentime; + $mtime = explode ( " ", microtime() ); + $wp_ffpc_gentime = $mtime[1] + $mtime[0]; + /* start object "colleting" and pass it the the actual storer function */ ob_start('wp_ffpc_callback'); }@@ -245,8 +250,7 @@ if ( get_option ( 'default_ping_status' ) == 'open' )
$meta['pingback'] = get_bloginfo('pingback_url'); /* sync all http and https requests if enabled */ - if ( $config['sync_protocols'] == '1' ) - { + if ( $config['sync_protocols'] == '1' ) { if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ) $_SERVER['HTTPS'] = 'on';@@ -260,6 +264,17 @@ $sync_to = 'http://' . $_SERVER['SERVER_NAME'];
} $buffer = str_replace ( $sync_from, $sync_to, $buffer ); + } + + if ( $wp_ffpc_config['generate_time'] == '1' ) { + global $wp_ffpc_gentime; + $mtime = explode ( " ", microtime() ); + $wp_ffpc_gentime = ( $mtime[1] + $mtime[0] )- $wp_ffpc_gentime; + + $insertion = "<!-- \nWP-FFPC \n\tcache engine: ". $wp_ffpc_config['cache_type'] ."\n\tpage generation time: ". round( $wp_ffpc_gentime, 3 ) ." seconds\n-->\n"; + $index = stripos( $buffer , '</body>' ); + + $buffer = substr_replace( $buffer, $insertion, $index, 0); } $wp_ffpc_backend->set ( $wp_ffpc_backend->key ( 'meta' ) , $meta );
M
wp-ffpc-class.php
→
wp-ffpc-class.php
@@ -366,6 +366,14 @@ <span class="description"><?php _e('Add X-Cache-Engine HTTP header to HTTP responses.', $this->plugin_constant); ?></span>
</dd> <dt> + <label for="generate_time"><?php _e("Add HTML debug comment", $this->plugin_constant); ?></label> + </dt> + <dd> + <input type="checkbox" name="generate_time" id="generate_time" value="1" <?php checked($this->options['generate_time'],true); ?> /> + <span class="description"><?php _e('Adds comment string including plugin name, cache engine and page generation time to every generated entry before closing <body> tag.', $this->plugin_constant); ?></span> + </dd> + + <dt> <label for="sync_protocols"><?php _e("Enable sync protocolls", $this->plugin_constant); ?></label> </dt> <dd>
M
wp-ffpc.php
→
wp-ffpc.php
@@ -3,7 +3,7 @@ /*
Plugin Name: WP-FFPC Plugin URI: http://petermolnar.eu/wordpress/wp-ffpc Description: WordPress cache plugin for memcached & nginx - unbeatable speed -Version: 1.0 +Version: 1.1 Author: Peter Molnar <hello@petermolnar.eu> Author URI: http://petermolnar.eu/ License: GPLv3@@ -46,6 +46,7 @@ 'nocache_page' => false,
'sync_protocols' => false, 'persistent' => false, 'response_header' => false, + 'generate_time' => false, ); $wp_ffpc = new WP_FFPC ( 'wp-ffpc', '1.0', 'WP-FFPC', $wp_ffpc_defaults, 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XU3DG7LLA76WC' );