= 1.3.3 =

*2014-04-29*

What's changed:

* removed broadcast message
* better logs ( additional logs and adding translation compatibility )
This commit is contained in:
Peter Molnar 2014-04-29 15:58:50 +01:00
parent f95f0a3f2c
commit a9cf7ff058
5 changed files with 45 additions and 32 deletions

View file

@ -4,18 +4,24 @@ 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: 3.9 Tested up to: 3.9
Stable tag: 1.3.2 Stable tag: 1.3.3
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
Fastest way of cache for WordPress: memcached + nginx! The fastest way to cache: full page in memory cache for WordPress!
== Description == == Description ==
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, however, can be connected with [NGiNX](http://NGiNX.org "NGiNX") through memcached for unbeatable speed. 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.
Supports PHP Memcached, PHP Memcache and APC as storage engines, subdomain and domain based WordPress Networks. 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.
= Features: = = Features: =
* Wordpress Network support ( for subdomain layout ) * Wordpress Network support
* fully supported domain/subdomain Networks
* will work in Network Enabled mode only for subdirectory based Multisites ( no per site setting possibility )
* supports variable backends
* memcached with PHP Memcached
* memcached with PHP Memcache
* APC
* cache exclude possibilities ( home, feeds, archieves, pages, singles ) * cache exclude possibilities ( home, feeds, archieves, pages, singles )
* (optional) cache for logged-in users * (optional) cache for logged-in users
* 404 caching * 404 caching
@ -26,7 +32,6 @@ Supports PHP Memcached, PHP Memcache and APC as storage engines, subdomain and d
* talkative log for [WP_DEBUG](http://codex.wordpress.org/WP_DEBUG "WP_DEBUG") * talkative log for [WP_DEBUG](http://codex.wordpress.org/WP_DEBUG "WP_DEBUG")
* multiple memcached upstream support * multiple memcached upstream support
* precache ( manually or by timed by wp-cron ) * precache ( manually or by timed by wp-cron )
* [NGiNX](http://NGiNX.org "NGiNX") compatibility
Many thanks for contributors, supporters, testers & bug reporters: Many thanks for contributors, supporters, testers & bug reporters:
@ -89,6 +94,14 @@ Please post feature requests to [WP-FFPC feature request topic](http://wordpress
== Changelog == == Changelog ==
= 1.3.3 =
*2014-04-29*
What's changed:
* removed broadcast message
* better logs ( additional logs and adding translation compatibility )
= 1.3.2 = = 1.3.2 =
*2014-04-09* *2014-04-09*

@ -1 +1 @@
Subproject commit 7d968c390813664514be669a055a6cf9dddf3c16 Subproject commit 2749265f11b2c2e9d34cc35aa74aca55b2b1b93b

View file

@ -116,9 +116,8 @@ if (!class_exists('WP_FFPC_Backend')) {
public function key ( &$prefix ) { public function key ( &$prefix ) {
/* data is string only with content, meta is not used in nginx */ /* data is string only with content, meta is not used in nginx */
$key = $prefix . str_replace ( array_keys( $this->urimap ), $this->urimap, $this->options['key'] ); $key = $prefix . str_replace ( array_keys( $this->urimap ), $this->urimap, $this->options['key'] );
$this->log ( __translate__('original key configuration: ', $this->plugin_constant ) . $this->options['key'] ); $this->log ( sprintf( __translate__( 'original key configuration: %s', $this->plugin_constant ), $this->options['key'] ) );
$this->log ( __translate__('setting key to: ', $this->plugin_constant ) . $key ); $this->log ( sprintf( __translate__( 'setting key to: %s', $this->plugin_constant ), $key ) );
return $key; return $key;
} }
@ -137,14 +136,14 @@ if (!class_exists('WP_FFPC_Backend')) {
return false; return false;
/* log the current action */ /* log the current action */
$this->log ( __translate__('get ', $this->plugin_constant ). $key ); $this->log ( sprintf( __translate__( 'get %s', $this->plugin_constant ), $key ) );
/* proxy to internal function */ /* proxy to internal function */
$internal = $this->proxy( 'get' ); $internal = $this->proxy( 'get' );
$result = $this->$internal( $key ); $result = $this->$internal( $key );
if ( $result === false ) if ( $result === false )
$this->log ( __translate__( "failed to get entry: ", $this->plugin_constant ) . $key ); $this->log ( sprintf( __translate__( 'failed to get entry: %s', $this->plugin_constant ), $key ) );
return $result; return $result;
} }
@ -164,7 +163,7 @@ if (!class_exists('WP_FFPC_Backend')) {
return false; return false;
/* log the current action */ /* log the current action */
$this->log( __translate__('set ', $this->plugin_constant ) . $key . __translate__(' expiration time: ', $this->plugin_constant ) . $this->options['expire']); $this->log ( sprintf( __translate__( 'set %s expiration time: %s', $this->plugin_constant ), $key, $this->options['expire'] ) );
/* proxy to internal function */ /* proxy to internal function */
$internal = $this->options['cache_type'] . '_set'; $internal = $this->options['cache_type'] . '_set';
@ -172,7 +171,7 @@ if (!class_exists('WP_FFPC_Backend')) {
/* check result validity */ /* check result validity */
if ( $result === false ) if ( $result === false )
$this->log ( __translate__('failed to set entry: ', $this->plugin_constant ) . $key, LOG_WARNING ); $this->log ( sprintf( __translate__( 'failed to set entry: %s', $this->plugin_constant ), $key ), LOG_WARNING );
return $result; return $result;
} }
@ -232,7 +231,7 @@ if (!class_exists('WP_FFPC_Backend')) {
/* no path, don't do anything */ /* no path, don't do anything */
if ( empty( $path ) ) { if ( empty( $path ) ) {
$this->log ( __translate__('unable to determine path from Post Permalink, post ID: ', $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;
} }
@ -499,11 +498,11 @@ if (!class_exists('WP_FFPC_Backend')) {
foreach ( $keys as $key => $dummy ) { foreach ( $keys as $key => $dummy ) {
if ( ! apc_delete ( $key ) ) { if ( ! apc_delete ( $key ) ) {
$this->log ( __translate__('Failed to delete APC entry: ', $this->plugin_constant ) . $key, LOG_ERR ); $this->log ( sprintf( __translate__( 'Failed to delete APC entry: %s', $this->plugin_constant ), $key ), LOG_ERR );
//throw new Exception ( __translate__('Deleting APC entry failed with key ', $this->plugin_constant ) . $key ); //throw new Exception ( __translate__('Deleting APC entry failed with key ', $this->plugin_constant ) . $key );
} }
else { else {
$this->log ( __translate__( 'APC entry delete: ', $this->plugin_constant ) . $key ); $this->log ( sprintf( __translate__( 'APC entry delete: %s', $this->plugin_constant ), $key ) );
} }
} }
} }
@ -567,7 +566,7 @@ if (!class_exists('WP_FFPC_Backend')) {
/* only add servers that does not exists already in connection pool */ /* only add servers that does not exists already in connection pool */
if ( !@array_key_exists($server_id , $servers_alive ) ) { if ( !@array_key_exists($server_id , $servers_alive ) ) {
$this->connection->addServer( $server['host'], $server['port'] ); $this->connection->addServer( $server['host'], $server['port'] );
$this->log ( $server_id . __translate__(" added, persistent mode: ", $this->plugin_constant ) . $this->options['persistent'] ); $this->log ( sprintf( __translate__( '%s added, persistent mode: %s', $this->plugin_constant ), $server_id, $this->options['persistent'] ) );
} }
} }
@ -591,7 +590,7 @@ if (!class_exists('WP_FFPC_Backend')) {
$this->status[$server_id] = 0; $this->status[$server_id] = 0;
/* if server uptime is not empty, it's most probably up & running */ /* if server uptime is not empty, it's most probably up & running */
if ( !empty($details['uptime']) ) { if ( !empty($details['uptime']) ) {
$this->log ( $server_id . __translate__(" server is up & running", $this->plugin_constant )); $this->log ( sprintf( __translate__( '%s server is up & running', $this->plugin_constant ), $server_id ) );
$this->status[$server_id] = 1; $this->status[$server_id] = 1;
} }
} }
@ -621,7 +620,8 @@ if (!class_exists('WP_FFPC_Backend')) {
/* if storing failed, log the error code */ /* if storing failed, log the error code */
if ( $result === false ) { if ( $result === false ) {
$code = $this->connection->getResultCode(); $code = $this->connection->getResultCode();
$this->log ( __translate__('unable to set entry ', $this->plugin_constant ) . $key . __translate__( ', Memcached error code: ', $this->plugin_constant ) . $code ); $this->log ( sprintf( __translate__( 'unable to set entry: %s', $this->plugin_constant ), $key ) );
$this->log ( sprintf( __translate__( 'Memcached error code: %s', $this->plugin_constant ), $code ) );
//throw new Exception ( __translate__('Unable to store Memcached entry ', $this->plugin_constant ) . $key . __translate__( ', error code: ', $this->plugin_constant ) . $code ); //throw new Exception ( __translate__('Unable to store Memcached entry ', $this->plugin_constant ) . $key . __translate__( ', error code: ', $this->plugin_constant ) . $code );
} }
@ -653,10 +653,11 @@ if (!class_exists('WP_FFPC_Backend')) {
if ( $kresult === false ) { if ( $kresult === false ) {
$code = $this->connection->getResultCode(); $code = $this->connection->getResultCode();
$this->log ( __translate__('unable to delete entry ', $this->plugin_constant ) . $key . __translate__( ', Memcached error code: ', $this->plugin_constant ) . $code ); $this->log ( sprintf( __translate__( 'unable to delete entry: %s', $this->plugin_constant ), $key ) );
$this->log ( sprintf( __translate__( 'Memcached error code: %s', $this->plugin_constant ), $code ) );
} }
else { else {
$this->log ( __translate__( 'entry deleted: ', $this->plugin_constant ) . $key ); $this->log ( sprintf( __translate__( 'entry deleted: %s', $this->plugin_constant ), $key ) );
} }
} }
} }
@ -702,7 +703,7 @@ if (!class_exists('WP_FFPC_Backend')) {
else else
$this->status[$server_id] = $this->connection->$conn ( $server['host'] , $server['port'] ); $this->status[$server_id] = $this->connection->$conn ( $server['host'] , $server['port'] );
$this->log ( $server_id . __translate__(" added, persistent mode: ", $this->plugin_constant ) . $this->options['persistent'] ); $this->log ( sprintf( __translate__( '%s added, persistent mode: %s', $this->plugin_constant ), $server_id, $this->options['persistent'] ) );
} }
/* backend is now alive */ /* backend is now alive */
@ -721,9 +722,9 @@ if (!class_exists('WP_FFPC_Backend')) {
foreach ( $this->options['servers'] as $server_id => $server ) { foreach ( $this->options['servers'] as $server_id => $server ) {
$this->status[$server_id] = $this->connection->getServerStatus( $server['host'], $server['port'] ); $this->status[$server_id] = $this->connection->getServerStatus( $server['host'], $server['port'] );
if ( $this->status[$server_id] == 0 ) if ( $this->status[$server_id] == 0 )
$this->log ( $server_id . __translate__(" server is down", $this->plugin_constant )); $this->log ( sprintf( __translate__( '%s server is down', $this->plugin_constant ), $server_id ) );
else else
$this->log ( $server_id . __translate__(" server is up & running", $this->plugin_constant )); $this->log ( sprintf( __translate__( '%s server is up & running', $this->plugin_constant ), $server_id ) );
} }
} }
@ -772,10 +773,10 @@ if (!class_exists('WP_FFPC_Backend')) {
$kresult = $this->connection->delete( $key ); $kresult = $this->connection->delete( $key );
if ( $kresult === false ) { if ( $kresult === false ) {
$this->log ( __translate__('unable to delete entry ', $this->plugin_constant ) . $key ); $this->log ( sprintf( __translate__( 'unable to delete entry: %s', $this->plugin_constant ), $key ) );
} }
else { else {
$this->log ( __translate__( 'entry deleted: ', $this->plugin_constant ) . $key ); $this->log ( sprintf( __translate__( 'entry deleted: %s', $this->plugin_constant ), $key ) );
} }
} }
} }

View file

@ -30,7 +30,7 @@ if ( ! class_exists( 'WP_FFPC' ) ) {
* @var array $shell_possibilities List of possible precache worker callers * @var array $shell_possibilities List of possible precache worker callers
[TODO] finish list of vars [TODO] finish list of vars
*/ */
class WP_FFPC extends WP_Plugins_Abstract_v2 { class WP_FFPC extends WP_Plugins_Abstract_v3 {
const host_separator = ','; const host_separator = ',';
const port_separator = ':'; const port_separator = ':';
const donation_id_key = 'hosted_button_id='; const donation_id_key = 'hosted_button_id=';
@ -188,8 +188,7 @@ if ( ! class_exists( 'WP_FFPC' ) ) {
/* clean up schedule if needed */ /* clean up schedule if needed */
if ( !isset( $this->options['precache_schedule'] ) || $this->options['precache_schedule'] == 'null' ) { if ( !isset( $this->options['precache_schedule'] ) || $this->options['precache_schedule'] == 'null' ) {
$this->log ( 'CRON clearing event' ); $this->log ( sprintf ( __( 'clearing scheduled hook %s', $this->plugin_constant ), self::precache_id ) );
wp_clear_scheduled_hook ( self::precache_id );
} }
/* add precache coldrun action */ /* add precache coldrun action */
@ -744,7 +743,7 @@ if ( ! class_exists( 'WP_FFPC' ) ) {
$this->scheduled = wp_schedule_event( time(), $this->options['precache_schedule'] , self::precache_id ); $this->scheduled = wp_schedule_event( time(), $this->options['precache_schedule'] , self::precache_id );
} }
elseif ( ( !isset($this->options['precache_schedule']) || $this->options['precache_schedule'] == 'null' ) && !empty( $schedule ) ) { elseif ( ( !isset($this->options['precache_schedule']) || $this->options['precache_schedule'] == 'null' ) && !empty( $schedule ) ) {
$this->log ( __('Clearing WP-CRON clearing event ' , $this->plugin_constant ) ); $this->log ( __('Clearing WP-CRON scheduled hook ' , $this->plugin_constant ) );
wp_clear_scheduled_hook ( self::precache_id ); wp_clear_scheduled_hook ( self::precache_id );
} }

View file

@ -50,6 +50,6 @@ $wp_ffpc_defaults = array (
'key' => '$scheme://$host$request_uri', 'key' => '$scheme://$host$request_uri',
); );
$wp_ffpc = new WP_FFPC ( 'wp-ffpc', '1.2', 'WP-FFPC', $wp_ffpc_defaults, 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XU3DG7LLA76WC' ); $wp_ffpc = new WP_FFPC ( 'wp-ffpc', '1.3.3', 'WP-FFPC', $wp_ffpc_defaults, 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XU3DG7LLA76WC' );
?> ?>