From 2aa0f33fbe12ed65a0d30b5048bc2dd5719bd621 Mon Sep 17 00:00:00 2001 From: Peter Molnar Date: Tue, 18 Jun 2013 18:17:52 +0100 Subject: [PATCH] messed up a var name in backed; added warning eliminator array check --- wp-ffpc-backend.php | 5 +++-- wp-ffpc-class.php | 9 +++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/wp-ffpc-backend.php b/wp-ffpc-backend.php index f6b9970..c684e66 100644 --- a/wp-ffpc-backend.php +++ b/wp-ffpc-backend.php @@ -62,7 +62,7 @@ if (!class_exists('WP_FFPC_Backend')) { public function __construct( $config, $network = false ) { /* no config, nothing is going to work */ - if ( empty ( $this->options ) ) { + if ( empty ( $config ) ) { return false; //die ( __translate__ ( 'WP-FFPC Backend class received empty configuration array, the plugin will not work this way', $this->plugin_constant ) ); } @@ -406,7 +406,8 @@ if (!class_exists('WP_FFPC_Backend')) { * */ public function get_servers () { - return $this->options['servers']; + $r = isset ( $this->options['servers'] ) ? $this->options['servers'] : ''; + return $r; } /** diff --git a/wp-ffpc-class.php b/wp-ffpc-class.php index 3a30ce0..d03fbdd 100644 --- a/wp-ffpc-class.php +++ b/wp-ffpc-class.php @@ -884,8 +884,13 @@ if ( ! class_exists( 'WP_FFPC' ) ) { /* set upstream servers from configured servers, best to get from the actual backend */ $servers = $this->backend->get_servers(); $nginx_servers = ''; - foreach ( array_keys( $servers ) as $server ) { - $nginx_servers .= " server ". $server .";\n"; + if ( is_array ( $servers )) { + foreach ( array_keys( $servers ) as $server ) { + $nginx_servers .= " server ". $server .";\n"; + } + } + else { + $nginx_servers .= " server ". $servers .";\n"; } $nginx = str_replace ( 'MEMCACHED_SERVERS' , $nginx_servers , $nginx );