Manybubbles has uploaded a new change for review.

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


Change subject: Squash master to REL1_22
......................................................................

Squash master to REL1_22

Change-Id: I4da5ab163d4146202ffe0320e963db5dfb9ede10
---
M Elastica
M Elastica.i18n.php
M Elastica.php
M ElasticaConnection.php
4 files changed, 84 insertions(+), 11 deletions(-)


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

diff --git a/Elastica b/Elastica
index db7c85f..e362133 160000
--- a/Elastica
+++ b/Elastica
-Subproject commit db7c85f5af0d85f04b1fe955c8202fd69b417901
+Subproject commit e36213362ef459f92e8b09167e537e9312f55ae3
diff --git a/Elastica.i18n.php b/Elastica.i18n.php
index 1ee731e..df4fffc 100644
--- a/Elastica.i18n.php
+++ b/Elastica.i18n.php
@@ -34,10 +34,25 @@
 );
 
 /** German (Deutsch)
+ * @author Kghbln
  * @author Metalhead64
  */
 $messages['de'] = array(
-       'elastica-desc' => 'Basis-[http://www.elasticsearch.org/ 
Elasticsearch]-Funktionalität, die von anderen Erweiterungen verwendet wird',
+       'elastica-desc' => 'Stellt anderen Erweiterungen die 
Basisfunktionalität von [http://www.elasticsearch.org/ elasticsearch] bereit',
+);
+
+/** Swiss High German (Schweizer Hochdeutsch)
+ * @author Filzstift
+ */
+$messages['de-ch'] = array(
+       'elastica-desc' => 'Stellt anderen Erweiterungen die 
Basisfunktionalität von «[http://www.elasticsearch.org/ Elasticsearch]» bereit',
+);
+
+/** Lower Sorbian (dolnoserbski)
+ * @author Michawiki
+ */
+$messages['dsb'] = array(
+       'elastica-desc' => 'Zakładna funkcionalnosć 
[http://www.elasticsearch.org/ Elasticsearch], kótaraž wužywa se wót drugich 
rozšyrjenjow',
 );
 
 /** Spanish (español)
@@ -66,6 +81,13 @@
  */
 $messages['he'] = array(
        'elastica-desc' => 'יכולות בסיסיות של [http://www.elasticsearch.org/ 
Elasticsearch] שמשמשות בהרחבות אחרות',
+);
+
+/** Upper Sorbian (hornjoserbsce)
+ * @author Michawiki
+ */
+$messages['hsb'] = array(
+       'elastica-desc' => 'Zakładna funkcionalnosć 
[http://www.elasticsearch.org/ Elasticsearch], kotraž so wot druhich 
rozšěrjenjow wužiwa',
 );
 
 /** Interlingua (interlingua)
@@ -110,6 +132,21 @@
        'elastica-desc' => 'Kefungsian [http://www.elasticsearch.org/ 
Elasticsearch] asas yang digunakan oleh ekstensi-ekstensi lain',
 );
 
+/** Dutch (Nederlands)
+ * @author GerardM
+ * @author Siebrand
+ */
+$messages['nl'] = array(
+       'elastica-desc' => 'Basisfunctionaliteit voor 
[http://www.elasticsearch.org/ Elasticsearch] gebruikt door andere 
uitbreidingen',
+);
+
+/** Occitan (occitan)
+ * @author Cedric31
+ */
+$messages['oc'] = array(
+       'elastica-desc' => 'Foncionalitat [http://www.elasticsearch.org/ 
Elasticsearch] de basa utilizada per d’autras extensions',
+);
+
 /** Brazilian Portuguese (português do Brasil)
  * @author Jaideraf
  */
@@ -138,6 +175,13 @@
        'elastica-desc' => 'Funkcionalnost baze [http://www.elasticsearch.org/ 
Elasticsearch], ki jo uporabljajo druge razširitve',
 );
 
+/** Swedish (svenska)
+ * @author Bengt B
+ */
+$messages['sv'] = array(
+       'elastica-desc' => 'Grundläggande 
[http://www.elasticsearch.org/Elasticsearch] funktionalitet används av andra 
tillägg',
+);
+
 /** Ukrainian (українська)
  * @author Andriykopanytsia
  */
diff --git a/Elastica.php b/Elastica.php
index ba4d3fa..fd57d03 100644
--- a/Elastica.php
+++ b/Elastica.php
@@ -46,6 +46,7 @@
 $wgAutoloadClasses['Elastica\Document'] = $elasticaDir . 'Document.php';
 $wgAutoloadClasses['Elastica\Index'] = $elasticaDir . 'Index.php';
 $wgAutoloadClasses['Elastica\Log'] = $elasticaDir . 'Log.php';
+$wgAutoloadClasses['Elastica\Node'] = $elasticaDir . 'Node.php';
 $wgAutoloadClasses['Elastica\Param'] = $elasticaDir . 'Param.php';
 $wgAutoloadClasses['Elastica\Percolator'] = $elasticaDir . 'Percolator.php';
 $wgAutoloadClasses['Elastica\Query'] = $elasticaDir . 'Query.php';
@@ -89,6 +90,7 @@
 $wgAutoloadClasses['Elastica\Facet\AbstractFacet'] = $elasticaDir . 
'Facet/AbstractFacet.php';
 $wgAutoloadClasses['Elastica\Facet\DateHistogram'] = $elasticaDir . 
'Facet/DateHistogram.php';
 $wgAutoloadClasses['Elastica\Facet\Filter'] = $elasticaDir . 
'Facet/Filter.php';
+$wgAutoloadClasses['Elastica\Facet\GeoCluster'] = $elasticaDir . 
'Facet/GeoCluster.php';
 $wgAutoloadClasses['Elastica\Facet\GeoDistance'] = $elasticaDir . 
'Facet/GeoDistance.php';
 $wgAutoloadClasses['Elastica\Facet\Histogram'] = $elasticaDir . 
'Facet/Histogram.php';
 $wgAutoloadClasses['Elastica\Facet\Query'] = $elasticaDir . 'Facet/Query.php';
@@ -120,6 +122,7 @@
 $wgAutoloadClasses['Elastica\Filter\Prefix'] = $elasticaDir . 
'Filter/Prefix.php';
 $wgAutoloadClasses['Elastica\Filter\Query'] = $elasticaDir . 
'Filter/Query.php';
 $wgAutoloadClasses['Elastica\Filter\Range'] = $elasticaDir . 
'Filter/Range.php';
+$wgAutoloadClasses['Elastica\Filter\Regexp'] = $elasticaDir . 
'Filter/Regexp.php';
 $wgAutoloadClasses['Elastica\Filter\Script'] = $elasticaDir . 
'Filter/Script.php';
 $wgAutoloadClasses['Elastica\Filter\Term'] = $elasticaDir . 'Filter/Term.php';
 $wgAutoloadClasses['Elastica\Filter\Terms'] = $elasticaDir . 
'Filter/Terms.php';
@@ -136,10 +139,11 @@
 $wgAutoloadClasses['Elastica\Query\Builder'] = $elasticaDir . 
'Query/Builder.php';
 $wgAutoloadClasses['Elastica\Query\Common'] = $elasticaDir . 
'Query/Common.php';
 $wgAutoloadClasses['Elastica\Query\ConstantScore'] = $elasticaDir . 
'Query/ConstantScore.php';
-$wgAutoloadClasses['Elastica\Query\CustomerFiltersScore'] = $elasticaDir . 
'Query/CustomerFiltersScore.php';
+$wgAutoloadClasses['Elastica\Query\CustomFiltersScore'] = $elasticaDir . 
'Query/CustomFiltersScore.php';
 $wgAutoloadClasses['Elastica\Query\CustomScore'] = $elasticaDir . 
'Query/CustomScore.php';
 $wgAutoloadClasses['Elastica\Query\Field'] = $elasticaDir . 'Query/Field.php';
 $wgAutoloadClasses['Elastica\Query\Filtered'] = $elasticaDir . 
'Query/Filtered.php';
+$wgAutoloadClasses['Elastica\Query\FunctionScore'] = $elasticaDir . 
'Query/FunctionScore.php';
 $wgAutoloadClasses['Elastica\Query\Fuzzy'] = $elasticaDir . 'Query/Fuzzy.php';
 $wgAutoloadClasses['Elastica\Query\FuzzyLikeThis'] = $elasticaDir . 
'Query/FuzzyLikeThis.php';
 $wgAutoloadClasses['Elastica\Query\HasChild'] = $elasticaDir . 
'Query/HasChild.php';
@@ -159,6 +163,8 @@
 $wgAutoloadClasses['Elastica\Query\Text'] = $elasticaDir . 'Query/Text.php';
 $wgAutoloadClasses['Elastica\Query\TopChildren'] = $elasticaDir . 
'Query/TopChildren.php';
 $wgAutoloadClasses['Elastica\Query\Wildcard'] = $elasticaDir . 
'Query/Wildcard.php';
+$wgAutoloadClasses['Elastica\Suggest\AbstractSuggest'] = $elasticaDir . 
'Suggest/AbstractSuggest.php';
+$wgAutoloadClasses['Elastica\Suggest\Term'] = $elasticaDir . 
'Suggest/Term.php';
 $wgAutoloadClasses['Elastica\Transport\AbstractTransport'] = $elasticaDir . 
'Transport/AbstractTransport.php';
 $wgAutoloadClasses['Elastica\Transport\Http'] = $elasticaDir . 
'Transport/Http.php';
 $wgAutoloadClasses['Elastica\Transport\Https'] = $elasticaDir . 
'Transport/Https.php';
diff --git a/ElasticaConnection.php b/ElasticaConnection.php
index d83d8ba..9d9fc8c 100644
--- a/ElasticaConnection.php
+++ b/ElasticaConnection.php
@@ -40,6 +40,19 @@
        }
 
        /**
+        * Set the client side timeout to be used for the rest of this process.
+        * @param int $timeout timeout in seconds
+        */
+       public static function setTimeout( $timeout ) {
+               $client = self::getClient();
+               // Set the timeout for new connections
+               $client->setConfigValue( 'timeout', $timeout );
+               foreach ( $client->getConnections() as $connection ) {
+                       $connection->setTimeout( $timeout );
+               }
+       }
+
+       /**
         * Fetch a connection.
         * @return \Elastica\Client
         */
@@ -60,14 +73,23 @@
                                 * @param \ElasticaConnection $me Child class 
of us
                                 */
                                function( $connection, $e ) use ( $me ) {
+                                       // 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.
+                                       if ( !( $e instanceof 
\Elastica\Exception\Connection\HttpException ) ||
+                                                       $e->getError() !== 
CURLE_COULDNT_CONNECT ) {
+                                               return;
+                                       }
                                        // Keep track of the number of times 
we've hit a host
                                        static $connectionAttempts = array();
-                                       $host = $connection->getConfig( 'host' 
);
-                                       $connectionAttempts[$host] = isset( 
$connectionAttempts[$host] )
-                                               ? $connectionAttempts[$host] + 
1 : 1;
+                                       $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] < 
$me->getMaxConnectionAttempts() ) {
+                                       if ( $connectionAttempts[ $host ] < 
$me->getMaxConnectionAttempts() ) {
+                                               wfLogWarning( "Retrying 
connection to $host after " . $connectionAttempts[ $host ] .
+                                                       ' attempts.' );
                                                $connection->setEnabled( true );
                                        }
                                }
@@ -79,22 +101,23 @@
 
        /**
         * Fetch the Elastica Index.
+        * @param string $name get the index(es) with this basename
         * @param mixed $type type of index (named type or false to get all)
-        * @param mixed $identifier if specified get the named identified 
version of the index
+        * @param mixed $identifier if specified get the named identifier of 
the index
         * @return \Elastica\Index
         */
-       public static function getIndex( $type = false, $identifier = false ) {
-               return self::getClient()->getIndex( self::getIndexName( $type, 
$identifier ) );
+       public static function getIndex( $name, $type = false, $identifier = 
false ) {
+               return self::getClient()->getIndex( self::getIndexName( $name, 
$type, $identifier ) );
        }
 
        /**
         * Get the name of the index.
+        * @param string $name get the index(es) with this basename
         * @param mixed $type type of index (named type or false to get all)
         * @param mixed $identifier if specified get the named identifier of 
the index
         * @return string name of index for $type and $identifier
         */
-       public static function getIndexName( $type = false, $identifier = false 
) {
-               $name = wfWikiId();
+       public static function getIndexName( $name, $type = false, $identifier 
= false ) {
                if ( $type ) {
                        $name .= '_' . $type;
                }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4da5ab163d4146202ffe0320e963db5dfb9ede10
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Elastica
Gerrit-Branch: master
Gerrit-Owner: Manybubbles <[email protected]>
Gerrit-Reviewer: L10n-bot <[email protected]>

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

Reply via email to