jenkins-bot has submitted this change and it was merged.

Change subject: PHP 5.5 upgrade
......................................................................


PHP 5.5 upgrade

Change-Id: I1744d964d9df17ba17842eae441b9f51d100dfb5
---
M ElasticaConnection.php
M composer.json
2 files changed, 8 insertions(+), 9 deletions(-)

Approvals:
  Smalyshev: Looks good to me, but someone else must approve
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/ElasticaConnection.php b/ElasticaConnection.php
index d42fee3..8a0ee15 100644
--- a/ElasticaConnection.php
+++ b/ElasticaConnection.php
@@ -71,28 +71,26 @@
        public function getClient() {
                if ( $this->client === null ) {
                        // Setup the Elastica servers
-                       $servers = array();
+                       $servers = [];
                        $serverList = $this->getServerList();
                        if ( !is_array( $serverList ) ) {
-                               $serverList = array( $serverList );
+                               $serverList = [ $serverList ];
                        }
                        foreach ( $serverList as $server ) {
                                if ( is_array( $server ) ) {
                                        $servers[] = $server;
                                } else {
-                                       $servers[] = array( 'host' => $server );
+                                       $servers[] = [ 'host' => $server ];
                                }
                        }
 
-                       $self = $this;
-                       $this->client = new \Elastica\Client( array( 'servers' 
=> $servers ),
+                       $this->client = new \Elastica\Client( [ 'servers' => 
$servers ],
                                /**
                                 * Callback for \Elastica\Client on request 
failures.
                                 * @param \Elastica\Connection $connection The 
current connection to elasticasearch
                                 * @param \Elastica\Exception $e Exception to 
be thrown if we don't do anything
-                                * @param \ElasticaConnection $self This class
                                 */
-                               function( $connection, $e ) use ( $self ) {
+                               function( $connection, $e ) {
                                        // We only want to try to reconnect on 
http connection errors
                                        // Beyond that we want to give up fast. 
 Configuring a single connection
                                        // through LVS accomplishes this.
@@ -117,13 +115,13 @@
                                                return;
                                        }
                                        // Keep track of the number of times 
we've hit a host
-                                       static $connectionAttempts = array();
+                                       static $connectionAttempts = [];
                                        $host = $connection->getParam( 'host' );
                                        $connectionAttempts[ $host ] = isset( 
$connectionAttempts[ $host ] )
                                                ? $connectionAttempts[ $host ] 
+ 1 : 1;
 
                                        // Check if we've hit the host the max 
# of times. If not, try again
-                                       if ( $connectionAttempts[ $host ] < 
$self->getMaxConnectionAttempts() ) {
+                                       if ( $connectionAttempts[ $host ] < 
$this->getMaxConnectionAttempts() ) {
                                                wfLogWarning( "Retrying 
connection to $host after " . $connectionAttempts[ $host ] .
                                                        ' attempts.' );
                                                $connection->setEnabled( true );
diff --git a/composer.json b/composer.json
index 21dc317..7bd62b1 100644
--- a/composer.json
+++ b/composer.json
@@ -12,6 +12,7 @@
                }
        ],
        "require": {
+               "php": ">=5.5.9",
                "ruflin/elastica": "2.2.1"
        }
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I1744d964d9df17ba17842eae441b9f51d100dfb5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Elastica
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[email protected]>
Gerrit-Reviewer: EBernhardson <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Manybubbles <[email protected]>
Gerrit-Reviewer: Smalyshev <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to