Florianschmidtwelzow has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/225030

Change subject: Handle non-array values of ElasticaConnection::getServerList()
......................................................................

Handle non-array values of ElasticaConnection::getServerList()

This prevents warning messages, if there is a bad configured server list
in, e.g., CirrusSearch.

Change-Id: I8126cf422abb59aa30ab012020fd3c0941556315
---
M ElasticaConnection.php
1 file changed, 8 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Elastica 
refs/changes/30/225030/1

diff --git a/ElasticaConnection.php b/ElasticaConnection.php
index 2e05a1f..e2de3c4 100644
--- a/ElasticaConnection.php
+++ b/ElasticaConnection.php
@@ -75,11 +75,14 @@
                if ( $this->client === null ) {
                        // Setup the Elastica servers
                        $servers = array();
-                       foreach ( $this->getServerList() as $server ) {
-                               if ( is_array( $server ) ) {
-                                       $servers[] = $server;
-                               } else {
-                                       $servers[] = array( 'host' => $server );
+                       $serverList = $this->getServerList();
+                       if ( is_array( $serverList ) ) {
+                               foreach ( $this->getServerList() as $server ) {
+                                       if ( is_array( $server ) ) {
+                                               $servers[] = $server;
+                                       } else {
+                                               $servers[] = array( 'host' => 
$server );
+                                       }
                                }
                        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/225030
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8126cf422abb59aa30ab012020fd3c0941556315
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Elastica
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to