From 0cbe1017a956f11b2ec372454d8464067dc0c93f Mon Sep 17 00:00:00 2001 From: Peter Molnar Date: Thu, 25 Apr 2013 10:35:11 +0100 Subject: [PATCH 1/2] log typo && Memcache status bugfix --- wp-ffpc-abstract.php | 14 +++++++------- wp-ffpc-backend.php | 18 +++++++++++------- wp-ffpc-class.php | 2 +- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/wp-ffpc-abstract.php b/wp-ffpc-abstract.php index e835877..63a7fcd 100644 --- a/wp-ffpc-abstract.php +++ b/wp-ffpc-abstract.php @@ -361,7 +361,7 @@ if (!class_exists('WP_Plugins_Abstract')) { abstract function plugin_hook_options_save ( $activating ); /** - * sends message to sysog + * sends message to syslog * * @param string $message message to add besides basic info * @param int $log_level [optional] Level of log, info by default @@ -372,22 +372,22 @@ if (!class_exists('WP_Plugins_Abstract')) { if ( @is_array( $message ) || @is_object ( $message ) ) $message = serialize($message); - if (! $this->config['log'] ) + if ( !isset ( $this->options['log'] ) || $this->options['log'] != 1 ) return false; switch ( $log_level ) { case LOG_ERR : if ( function_exists( 'syslog' ) && function_exists ( 'openlog' ) ) { - openlog('wordpress('.$_SERVER['HTTP_HOST'].')',LOG_NDELAY|LOG_PID,LOG_SYSLOG); + openlog('wordpress('.$_SERVER['HTTP_HOST'].')',LOG_NDELAY|LOG_PERROR,LOG_SYSLOG); syslog( $log_level , self::plugin_constant . $message ); } /* error level is real problem, needs to be displayed on the admin panel */ - throw new Exception ( $message ); + //throw new Exception ( $message ); break; default: - if ( function_exists( 'syslog' ) && function_exists ( 'openlog' ) && $this->config['debug'] ) { - openlog('wordpress('.$_SERVER['HTTP_HOST'].')',LOG_NDELAY|LOG_PID,LOG_SYSLOG); - syslog( $log_level , self::plugin_constant . $message ); + if ( function_exists( 'syslog' ) && function_exists ( 'openlog' ) && isset( $this->options['log_info'] ) && $this->options['log_info'] == 1 ) { + openlog('wordpress(' .$_SERVER['HTTP_HOST']. ')', LOG_NDELAY,LOG_SYSLOG); + syslog( $log_level, self::plugin_constant . $message ); } break; } diff --git a/wp-ffpc-backend.php b/wp-ffpc-backend.php index b56057d..ac88b8e 100644 --- a/wp-ffpc-backend.php +++ b/wp-ffpc-backend.php @@ -62,7 +62,7 @@ if (!class_exists('WP_FFPC_Backend')) { /* call backend initiator based on cache type */ $init = $this->proxy( 'init' ); - $this->log ( __translate__(' init starting', self::plugin_constant )); + $this->log ( __translate__('init starting', self::plugin_constant )); $this->$init(); } @@ -376,24 +376,28 @@ if (!class_exists('WP_FFPC_Backend')) { * @param mixed $message message to add besides basic info * */ - public function log ( $message, $log_level = LOG_WARNING ) { + private function log ( $message, $log_level = LOG_WARNING ) { if ( @is_array( $message ) || @is_object ( $message ) ) $message = serialize($message); - if (! $this->options['log'] ) + if ( !isset ( $this->options['log'] ) || $this->options['log'] != 1 ) return false; switch ( $log_level ) { case LOG_ERR : - if ( function_exists( 'syslog' ) ) - syslog( $log_level , self::plugin_constant . " with " . $this->options['cache_type'] . ' ' . $message ); + if ( function_exists( 'syslog' ) && function_exists ( 'openlog' ) ) { + openlog('wordpress('.$_SERVER['HTTP_HOST'].')',LOG_NDELAY|LOG_PERROR,LOG_SYSLOG); + syslog( $log_level , self::plugin_constant . $message ); + } /* error level is real problem, needs to be displayed on the admin panel */ //throw new Exception ( $message ); break; default: - if ( function_exists( 'syslog' ) && isset($this->options['debug']) && $this->options['debug'] ) - syslog( $log_level , self::plugin_constant . " with " . $this->options['cache_type'] . ' ' . $message ); + if ( function_exists( 'syslog' ) && function_exists ( 'openlog' ) && isset( $this->options['log_info'] ) && $this->options['log_info'] == 1 ) { + openlog('wordpress(' .$_SERVER['HTTP_HOST']. ')', LOG_NDELAY,LOG_SYSLOG); + syslog( $log_level, self::plugin_constant . " " . $message ); + } break; } diff --git a/wp-ffpc-class.php b/wp-ffpc-class.php index fb7c9b0..617db24 100644 --- a/wp-ffpc-class.php +++ b/wp-ffpc-class.php @@ -326,7 +326,7 @@ if ( ! class_exists( 'WP_FFPC' ) ) { if ( $status == 0 ) _e ( 'down
', $this->plugin_constant ); - elseif ( $status == 1 ) + elseif ( ( $this->options['cache_type'] == 'memcache' && $status > 0 ) || $status == 1 ) _e ( 'up & running
', $this->plugin_constant ); else _e ( 'unknown, please try re-saving settings!
', $this->plugin_constant ); From 1aa01ea217caa1185ce8c33d58a330756fc1895f Mon Sep 17 00:00:00 2001 From: Peter Molnar Date: Thu, 25 Apr 2013 10:38:43 +0100 Subject: [PATCH 2/2] v 1.1.1 --- readme.txt | 10 ++++++++-- wp-ffpc.php | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/readme.txt b/readme.txt index 9d3cdf3..ebb0124 100644 --- a/readme.txt +++ b/readme.txt @@ -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, fast Requires at least: 3.0 Tested up to: 3.5.1 -Stable tag: 1.1 +Stable tag: 1.1.1 License: GPLv3 License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -85,8 +85,14 @@ Please post feature requests to [WP-FFPC feature request topic](http://wordpress == Changelog == += 1.1.1 = +*2013.04.25* + +* bugfix: Memcache plugin was diplaying server status incorrectly ( although the plugin was working ) +* bugfix: typo prevented log to work correctly + = 1.1 = -2013.04.24 +*2013.04.24* What's new: diff --git a/wp-ffpc.php b/wp-ffpc.php index a3c8fee..06d808b 100644 --- a/wp-ffpc.php +++ b/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.1 +Version: 1.1.1 Author: Peter Molnar Author URI: http://petermolnar.eu/ License: GPLv3 @@ -49,7 +49,7 @@ $wp_ffpc_defaults = array ( 'generate_time' => false, ); -$wp_ffpc = new WP_FFPC ( 'wp-ffpc', '1.1', '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.1.1', 'WP-FFPC', $wp_ffpc_defaults, 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XU3DG7LLA76WC' ); ?>