Ensure that the version number has a major, minor and patch number

This commit is contained in:
Steve Boyd 2018-07-11 14:03:00 +12:00
parent 9f04583ed5
commit 4429acb6ec

View File

@ -70,9 +70,17 @@ class TikaServerTextExtractor extends FileTextExtractor
public function isAvailable()
{
$version = $this->getVersion();
// ensure that the version number has a major, minor and patch number
// reason being that version_compare('1.7', '1.7.0') will return -1 instead of 0
for ($i = 0; $i < 2; $i++) {
if (substr_count($version, '.') < 2) {
$version .= '.0';
}
}
return $this->getServerEndpoint() &&
$this->getClient()->isAvailable() &&
version_compare($this->getVersion(), '1.7.0') >= 0;
version_compare($version, '1.7.0') >= 0;
}
public function supportsExtension($extension)