log typo && Memcache status bugfix

This commit is contained in:
Peter Molnar 2013-04-25 10:35:11 +01:00
parent 90f5d4947f
commit 0cbe1017a9
3 changed files with 19 additions and 15 deletions

View file

@ -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;
}

View file

@ -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;
}

View file

@ -326,7 +326,7 @@ if ( ! class_exists( 'WP_FFPC' ) ) {
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 );