Skip to content

Commit 84bd274

Browse files
committed
Trying to enable Solr service on Travis
1 parent b83a45e commit 84bd274

4 files changed

Lines changed: 27 additions & 3 deletions

File tree

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ before_install:
3737
# - ./bin/ci/scripts/install_arangodb.sh;
3838
- composer install
3939
- composer require phwoolcon/ci-pecl-cacher -n
40+
- "./bin/ci/scripts/install_solr.sh || echo \"Solr install failed\""
4041
- "./bin/ci/scripts/install_arangodb.sh || echo \"Arangodb install failed\""
4142
- "./bin/ci/scripts/install_ssdb.sh || echo \"SSDB install failed\""
4243
- "./bin/ci/scripts/install_couchdb.sh || echo \"Couchdb install failed\""

bin/ci/scripts/install_solr.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
curl -sSL https://raw.githubusercontent.com/PHPSocialNetwork/travis-solr/master/travis-solr.sh | SOLR_COLLECTION=phpfastcache SOLR_VERSION=8.11.1 bash

lib/Phpfastcache/Drivers/Solr/Config.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ class Config extends ConfigurationOption
3838

3939
protected int $port = 8983;
4040

41-
protected string $coreName = '';
41+
protected string $coreName = 'phpfastcache';
42+
43+
protected string $endpointName = 'phpfastcache';
4244

4345
protected string $scheme = 'http';
4446

@@ -194,4 +196,24 @@ public function setMappingSchema(array $mappingSchema): Config
194196
$this->mappingSchema = $mappingSchema;
195197
return $this;
196198
}
199+
200+
/**
201+
* @return string
202+
*/
203+
public function getEndpointName(): string
204+
{
205+
return $this->endpointName;
206+
}
207+
208+
/**
209+
* @param string $endpointName
210+
* @return Config
211+
* @throws PhpfastcacheLogicException
212+
*/
213+
public function setEndpointName(string $endpointName): Config
214+
{
215+
$this->enforceLockedProperty(__FUNCTION__);
216+
$this->endpointName = $endpointName;
217+
return $this;
218+
}
197219
}

lib/Phpfastcache/Drivers/Solr/Driver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ protected function driverConnect(): bool
6060
$this->mappingSchema = $this->getConfig()->getMappingSchema();
6161
$this->instance = new SolariumClient(new SolariumCurlAdapter(), $this->getConfig()->getEventDispatcher(), [
6262
'endpoint' => [
63-
'phpfastcache' => [
63+
$this->getConfig()->getEndpointName() => [
6464
'scheme' => $this->getConfig()->getScheme(),
6565
'host' => $this->getConfig()->getHost(),
6666
'port' => $this->getConfig()->getPort(),
@@ -73,7 +73,7 @@ protected function driverConnect(): bool
7373
try {
7474
$this->instance->ping($this->instance->createPing());
7575
} catch (SolariumExceptionInterface $e) {
76-
throw new PhpfastcacheDriverConnectException('Failed to connect to Solr server with the following error: ' . $e->getMessage(), 0, $e);
76+
throw new PhpfastcacheDriverConnectException($e->getMessage(), 0, $e);
7777
}
7878

7979
return false;

0 commit comments

Comments
 (0)