| @@ 781-801 (lines=21) @@ | ||
| 778 | * |
|
| 779 | * @throws NotPermittedException |
|
| 780 | */ |
|
| 781 | private function extractContentFromFilePDF(FilesDocument $document, File $file) { |
|
| 782 | if ($this->parseMimeType($document->getMimeType(), $file->getExtension()) |
|
| 783 | !== self::MIMETYPE_PDF) { |
|
| 784 | return; |
|
| 785 | } |
|
| 786 | ||
| 787 | $this->configService->setDocumentIndexOption($document, ConfigService::FILES_PDF); |
|
| 788 | if (!$this->isSourceIndexable($document)) { |
|
| 789 | return; |
|
| 790 | } |
|
| 791 | ||
| 792 | if ($this->configService->getAppValue(ConfigService::FILES_PDF) !== '1') { |
|
| 793 | $document->setContent(''); |
|
| 794 | ||
| 795 | return; |
|
| 796 | } |
|
| 797 | ||
| 798 | $document->setContent( |
|
| 799 | base64_encode($file->getContent()), IndexDocument::ENCODED_BASE64 |
|
| 800 | ); |
|
| 801 | } |
|
| 802 | ||
| 803 | ||
| 804 | /** |
|
| @@ 810-830 (lines=21) @@ | ||
| 807 | * |
|
| 808 | * @throws NotPermittedException |
|
| 809 | */ |
|
| 810 | private function extractContentFromFileZip(FilesDocument $document, File $file) { |
|
| 811 | if ($this->parseMimeType($document->getMimeType(), $file->getExtension()) |
|
| 812 | !== self::MIMETYPE_ZIP) { |
|
| 813 | return; |
|
| 814 | } |
|
| 815 | ||
| 816 | $this->configService->setDocumentIndexOption($document, ConfigService::FILES_ZIP); |
|
| 817 | if (!$this->isSourceIndexable($document)) { |
|
| 818 | return; |
|
| 819 | } |
|
| 820 | ||
| 821 | if ($this->configService->getAppValue(ConfigService::FILES_ZIP) !== '1') { |
|
| 822 | $document->setContent(''); |
|
| 823 | ||
| 824 | return; |
|
| 825 | } |
|
| 826 | ||
| 827 | $document->setContent( |
|
| 828 | base64_encode($file->getContent()), IndexDocument::ENCODED_BASE64 |
|
| 829 | ); |
|
| 830 | } |
|
| 831 | ||
| 832 | ||
| 833 | /** |
|
| @@ 839-859 (lines=21) @@ | ||
| 836 | * |
|
| 837 | * @throws NotPermittedException |
|
| 838 | */ |
|
| 839 | private function extractContentFromFileOffice(FilesDocument $document, File $file) { |
|
| 840 | if ($this->parseMimeType($document->getMimeType(), $file->getExtension()) |
|
| 841 | !== self::MIMETYPE_OFFICE) { |
|
| 842 | return; |
|
| 843 | } |
|
| 844 | ||
| 845 | $this->configService->setDocumentIndexOption($document, ConfigService::FILES_OFFICE); |
|
| 846 | if (!$this->isSourceIndexable($document)) { |
|
| 847 | return; |
|
| 848 | } |
|
| 849 | ||
| 850 | if ($this->configService->getAppValue(ConfigService::FILES_OFFICE) !== '1') { |
|
| 851 | $document->setContent(''); |
|
| 852 | ||
| 853 | return; |
|
| 854 | } |
|
| 855 | ||
| 856 | $document->setContent( |
|
| 857 | base64_encode($file->getContent()), IndexDocument::ENCODED_BASE64 |
|
| 858 | ); |
|
| 859 | } |
|
| 860 | ||
| 861 | ||
| 862 | /** |
|