mirror of
https://github.com/silverstripe/silverstripe-textextraction
synced 2024-10-22 11:06:00 +02:00
Merge branch '3.0'
This commit is contained in:
commit
5b967fd5d3
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user