Merge branch '3.0'

This commit is contained in:
Robbie Averill 2019-06-26 15:26:08 +12:00
commit 5b967fd5d3
2 changed files with 10 additions and 1 deletions

View File

@ -127,6 +127,11 @@ class TikaServerTextExtractor extends FileTextExtractor
public function getContent($file) public function getContent($file)
{ {
$tempFile = $file instanceof File ? $this->getPathFromFile($file) : $file; $tempFile = $file instanceof File ? $this->getPathFromFile($file) : $file;
return $this->getClient()->tika($tempFile); $content = $this->getClient()->tika($tempFile);
//Cleanup temp file
if ($file instanceof File) {
unlink($tempFile);
}
return $content;
} }
} }

View File

@ -80,6 +80,10 @@ class TikaTextExtractor extends FileTextExtractor
$path = $file instanceof File ? $this->getPathFromFile($file) : $file; $path = $file instanceof File ? $this->getPathFromFile($file) : $file;
$command = sprintf('tika %s %s', $mode, escapeshellarg($path)); $command = sprintf('tika %s %s', $mode, escapeshellarg($path));
$code = $this->runShell($command, $output); $code = $this->runShell($command, $output);
//Cleanup temp file
if ($file instanceof File) {
unlink($path);
}
if ($code == 0) { if ($code == 0) {
return $output; return $output;