messed up a var name in backed; added warning eliminator array check

This commit is contained in:
Peter Molnar 2013-06-18 18:17:52 +01:00
parent c040f976be
commit 2aa0f33fbe
2 changed files with 10 additions and 4 deletions

View file

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

View file

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