From 2cb41589c72ae8634a2433061811e695ee2d8bf6 Mon Sep 17 00:00:00 2001 From: Peter Molnar Date: Thu, 18 Apr 2013 16:10:40 +0100 Subject: [PATCH] added openlog functions --- wp-ffpc-abstract.php | 8 ++++++-- wp-ffpc-class.php | 4 ++-- wp-ffpc-nginx-sample.conf | 14 -------------- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/wp-ffpc-abstract.php b/wp-ffpc-abstract.php index dc5d5ba..563b358 100644 --- a/wp-ffpc-abstract.php +++ b/wp-ffpc-abstract.php @@ -377,14 +377,18 @@ if (!class_exists('WP_Plugins_Abstract')) { switch ( $log_level ) { case LOG_ERR : - if ( function_exists( 'syslog' ) ) + if ( function_exists( 'syslog' ) && function_exists ( 'openlog' ) ) { + openlog('wordpress('.$_SERVER['HTTP_HOST'].')',LOG_NDELAY|LOG_PID,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' ) && $this->config['debug'] ) + 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 ); + } break; } diff --git a/wp-ffpc-class.php b/wp-ffpc-class.php index 8dc4de2..0ec75fc 100644 --- a/wp-ffpc-class.php +++ b/wp-ffpc-class.php @@ -766,8 +766,8 @@ if ( ! class_exists( 'WP_FFPC' ) ) { }'; /* replace the data prefix with the configured one */ - $to_replace = array ( 'DATAPREFIX' , 'SERVERROOT' ); - $replace_with = array ( $this->options['prefix_data'], ABSPATH ); + $to_replace = array ( 'DATAPREFIX' , 'SERVERROOT', 'SERVERLOG' ); + $replace_with = array ( $this->options['prefix_data'], ABSPATH, $_SERVER['SERVER_NAME'] ); $nginx = str_replace ( $to_replace , $replace_with , $nginx ); /* set upstream servers from configured servers, best to get from the actual backend */ diff --git a/wp-ffpc-nginx-sample.conf b/wp-ffpc-nginx-sample.conf index 16817f3..11b477c 100644 --- a/wp-ffpc-nginx-sample.conf +++ b/wp-ffpc-nginx-sample.conf @@ -47,24 +47,10 @@ MEMCACHED_SERVERS location ~ [a-zA-Z0-9_]=(\.\.//?)+ { deny all; } location ~ [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ { deny all; } - ## Disable Akeeba Remote Control 2.5 and earlier - if ($http_user_agent ~ "Indy Library") { return 403; } - - ## Common bandwidth hoggers and hacking tools. - if ($http_user_agent ~ "libwww-perl") { return 403; } - if ($http_user_agent ~ "GetRight") { return 403; } - if ($http_user_agent ~ "GetWeb!") { return 403; } - if ($http_user_agent ~ "Go!Zilla") { return 403; } - if ($http_user_agent ~ "Download Demon") { return 403; } - if ($http_user_agent ~ "Go-Ahead-Got-It") { return 403; } - if ($http_user_agent ~ "TurnitinBot") { return 403; } - if ($http_user_agent ~ "GrabNet") { return 403; } - ## wordpress security location ~* wp-config.php { deny all; } location ~* wp-admin/includes { deny all; } location ~* wp-app\.log { deny all; } - location ~* wp-includes/.*\.php$ { deny all; } location ~ /wp-content/plugins/akismet/readme\.txt { deny all; } location ~ (licence|readme|license)\.(html|txt) { deny all; }