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 );