log typo && Memcache status bugfix
Peter Molnar hello@petermolnar.eu
Thu, 25 Apr 2013 10:35:11 +0100
3 files changed,
19 insertions(+),
15 deletions(-)
M
wp-ffpc-abstract.php
→
wp-ffpc-abstract.php
@@ -361,7 +361,7 @@ */
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 ( @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; }
M
wp-ffpc-backend.php
→
wp-ffpc-backend.php
@@ -62,7 +62,7 @@
/* 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 @@ *
* @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; }
M
wp-ffpc-class.php
→
wp-ffpc-class.php
@@ -326,7 +326,7 @@ echo $server_string ." => ";
if ( $status == 0 ) _e ( '<span class="error-msg">down</span><br />', $this->plugin_constant ); - elseif ( $status == 1 ) + elseif ( ( $this->options['cache_type'] == 'memcache' && $status > 0 ) || $status == 1 ) _e ( '<span class="ok-msg">up & running</span><br />', $this->plugin_constant ); else _e ( '<span class="error-msg">unknown, please try re-saving settings!</span><br />', $this->plugin_constant );