all repos — wp-ffpc @ 2aa0f33fbe12ed65a0d30b5048bc2dd5719bd621

messed up a var name in backed; added warning eliminator array check
Peter Molnar hello@petermolnar.eu
Tue, 18 Jun 2013 18:17:52 +0100
commit

2aa0f33fbe12ed65a0d30b5048bc2dd5719bd621

parent

c040f976be81c3ab00606e584e0f7b195a3969bd

2 files changed, 10 insertions(+), 4 deletions(-)

jump to
M wp-ffpc-backend.phpwp-ffpc-backend.php

@@ -62,7 +62,7 @@ */

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 @@ * @return array Server list in current config

* */ public function get_servers () { - return $this->options['servers']; + $r = isset ( $this->options['servers'] ) ? $this->options['servers'] : ''; + return $r; } /**
M wp-ffpc-class.phpwp-ffpc-class.php

@@ -884,8 +884,13 @@

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