Merge branch 'm36_MDL-63789_Search_SOLR_Fixes_Proxy_Auth' of https://github.com/scara...
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 6 Nov 2018 23:08:12 +0000 (00:08 +0100)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 6 Nov 2018 23:08:12 +0000 (00:08 +0100)
search/engine/solr/classes/engine.php

index 21199d4..74b2e08 100644 (file)
@@ -1257,7 +1257,13 @@ class engine extends \core_search\engine {
 
         if ($CFG->proxyhost && !is_proxybypass('http://' . $this->config->server_hostname . '/')) {
             $options['proxy_host'] = $CFG->proxyhost;
-            $options['proxy_port'] = $CFG->proxyport;
+            if (!empty($CFG->proxyport)) {
+                $options['proxy_port'] = $CFG->proxyport;
+            }
+            if (!empty($CFG->proxyuser) && !empty($CFG->proxypassword)) {
+                $options['proxy_login'] = $CFG->proxyuser;
+                $options['proxy_password'] = $CFG->proxypassword;
+            }
         }
 
         if (!class_exists('\SolrClient')) {