mirror of
https://github.com/silverstripe/silverstripe-textextraction
synced 2024-10-22 11:06:00 +02:00
Return version number as string instead of floats so '1.20' does not become 1.2
This commit is contained in:
parent
9c2da06178
commit
bff5eb2b79
@ -70,22 +70,22 @@ class TikaRestClient extends Client
|
|||||||
/**
|
/**
|
||||||
* Get version code
|
* Get version code
|
||||||
*
|
*
|
||||||
* @return float
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getVersion()
|
public function getVersion()
|
||||||
{
|
{
|
||||||
/** @var Response $response */
|
/** @var Response $response */
|
||||||
$response = $this->get('version', $this->getGuzzleOptions());
|
$response = $this->get('version', $this->getGuzzleOptions());
|
||||||
$version = 0.0;
|
$version = 0;
|
||||||
|
|
||||||
// Parse output
|
// Parse output
|
||||||
if ($response->getStatusCode() == 200
|
if ($response->getStatusCode() == 200
|
||||||
&& preg_match('/Apache Tika (?<version>[\.\d]+)/', $response->getBody(), $matches)
|
&& preg_match('/Apache Tika (?<version>[\.\d]+)/', $response->getBody(), $matches)
|
||||||
) {
|
) {
|
||||||
$version = (float)$matches['version'];
|
$version = $matches['version'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $version;
|
return (string) $version;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user