|
@@ 809-826 (lines=18) @@
|
| 806 |
|
* |
| 807 |
|
* @throws NotPermittedException |
| 808 |
|
*/ |
| 809 |
|
private function extractContentFromFilePDF(FilesDocument $document, File $file) { |
| 810 |
|
if ($this->parseMimeType($document->getMimeType()) !== self::MIMETYPE_PDF) { |
| 811 |
|
return; |
| 812 |
|
} |
| 813 |
|
|
| 814 |
|
$this->configService->setDocumentIndexOption($document, ConfigService::FILES_PDF); |
| 815 |
|
if (!$this->isSourceIndexable($document)) { |
| 816 |
|
return; |
| 817 |
|
} |
| 818 |
|
|
| 819 |
|
if ($this->configService->getAppValue(ConfigService::FILES_PDF) !== '1') { |
| 820 |
|
$document->setContent(''); |
| 821 |
|
|
| 822 |
|
return; |
| 823 |
|
} |
| 824 |
|
|
| 825 |
|
$document->setContent(base64_encode($file->getContent()), IndexDocument::ENCODED_BASE64); |
| 826 |
|
} |
| 827 |
|
|
| 828 |
|
|
| 829 |
|
/** |
|
@@ 835-852 (lines=18) @@
|
| 832 |
|
* |
| 833 |
|
* @throws NotPermittedException |
| 834 |
|
*/ |
| 835 |
|
private function extractContentFromFileOffice(FilesDocument $document, File $file) { |
| 836 |
|
if ($this->parseMimeType($document->getMimeType()) !== self::MIMETYPE_OFFICE) { |
| 837 |
|
return; |
| 838 |
|
} |
| 839 |
|
|
| 840 |
|
$this->configService->setDocumentIndexOption($document, ConfigService::FILES_OFFICE); |
| 841 |
|
if (!$this->isSourceIndexable($document)) { |
| 842 |
|
return; |
| 843 |
|
} |
| 844 |
|
|
| 845 |
|
if ($this->configService->getAppValue(ConfigService::FILES_OFFICE) !== '1') { |
| 846 |
|
$document->setContent(''); |
| 847 |
|
|
| 848 |
|
return; |
| 849 |
|
} |
| 850 |
|
|
| 851 |
|
$document->setContent(base64_encode($file->getContent()), IndexDocument::ENCODED_BASE64); |
| 852 |
|
} |
| 853 |
|
|
| 854 |
|
|
| 855 |
|
/** |
|
@@ 861-878 (lines=18) @@
|
| 858 |
|
* |
| 859 |
|
* @throws NotPermittedException |
| 860 |
|
*/ |
| 861 |
|
private function extractContentFromFileOCR(FilesDocument $document, File $file) { |
| 862 |
|
if ($this->parseMimeType($document->getMimeType()) !== self::MIMETYPE_OCR) { |
| 863 |
|
return; |
| 864 |
|
} |
| 865 |
|
|
| 866 |
|
$this->configService->setDocumentIndexOption($document, ConfigService::FILES_OCR); |
| 867 |
|
if (!$this->isSourceIndexable($document)) { |
| 868 |
|
return; |
| 869 |
|
} |
| 870 |
|
|
| 871 |
|
if ($this->configService->getAppValue(ConfigService::FILES_OCR) !== '1') { |
| 872 |
|
$document->setContent(''); |
| 873 |
|
|
| 874 |
|
return; |
| 875 |
|
} |
| 876 |
|
|
| 877 |
|
$document->setContent(base64_encode($file->getContent()), IndexDocument::ENCODED_BASE64); |
| 878 |
|
} |
| 879 |
|
|
| 880 |
|
|
| 881 |
|
/** |