Skip to content

Commit

Permalink
MDL-60346 core_search: Solr connection ignores proxy settings
Browse files Browse the repository at this point in the history
  • Loading branch information
sammarshallou committed Oct 6, 2017
1 parent d8e9a23 commit 558b630
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions search/engine/solr/classes/engine.php
Expand Up @@ -1144,6 +1144,7 @@ public function is_installed() {
* @return \SolrClient
*/
protected function get_search_client($triggerexception = true) {
global $CFG;

// Type comparison as it is set to false if not available.
if ($this->client !== null) {
Expand All @@ -1165,6 +1166,11 @@ protected function get_search_client($triggerexception = true) {
'timeout' => !empty($this->config->server_timeout) ? $this->config->server_timeout : '30'
);

if ($CFG->proxyhost && !is_proxybypass('http://' . $this->config->server_hostname . '/')) {
$options['proxy_host'] = $CFG->proxyhost;
$options['proxy_port'] = $CFG->proxyport;
}

if (!class_exists('\SolrClient')) {
throw new \core_search\engine_exception('enginenotinstalled', 'search', '', 'solr');
}
Expand Down

0 comments on commit 558b630

Please sign in to comment.