| @@ 855-875 (lines=21) @@ | ||
| 852 | * |
|
| 853 | * @throws NotPermittedException |
|
| 854 | */ |
|
| 855 | private function extractContentFromFilePDF(FilesDocument $document, File $file) { |
|
| 856 | if ($this->parseMimeType($document->getMimeType(), $file->getExtension()) |
|
| 857 | !== self::MIMETYPE_PDF) { |
|
| 858 | return; |
|
| 859 | } |
|
| 860 | ||
| 861 | $this->configService->setDocumentIndexOption($document, ConfigService::FILES_PDF); |
|
| 862 | if (!$this->isSourceIndexable($document)) { |
|
| 863 | return; |
|
| 864 | } |
|
| 865 | ||
| 866 | if ($this->configService->getAppValue(ConfigService::FILES_PDF) !== '1') { |
|
| 867 | $document->setContent(''); |
|
| 868 | ||
| 869 | return; |
|
| 870 | } |
|
| 871 | ||
| 872 | $document->setContent( |
|
| 873 | base64_encode($file->getContent()), IndexDocument::ENCODED_BASE64 |
|
| 874 | ); |
|
| 875 | } |
|
| 876 | ||
| 877 | ||
| 878 | /** |
|
| @@ 884-904 (lines=21) @@ | ||
| 881 | * |
|
| 882 | * @throws NotPermittedException |
|
| 883 | */ |
|
| 884 | private function extractContentFromFileZip(FilesDocument $document, File $file) { |
|
| 885 | if ($this->parseMimeType($document->getMimeType(), $file->getExtension()) |
|
| 886 | !== self::MIMETYPE_ZIP) { |
|
| 887 | return; |
|
| 888 | } |
|
| 889 | ||
| 890 | $this->configService->setDocumentIndexOption($document, ConfigService::FILES_ZIP); |
|
| 891 | if (!$this->isSourceIndexable($document)) { |
|
| 892 | return; |
|
| 893 | } |
|
| 894 | ||
| 895 | if ($this->configService->getAppValue(ConfigService::FILES_ZIP) !== '1') { |
|
| 896 | $document->setContent(''); |
|
| 897 | ||
| 898 | return; |
|
| 899 | } |
|
| 900 | ||
| 901 | $document->setContent( |
|
| 902 | base64_encode($file->getContent()), IndexDocument::ENCODED_BASE64 |
|
| 903 | ); |
|
| 904 | } |
|
| 905 | ||
| 906 | ||
| 907 | /** |
|
| @@ 913-933 (lines=21) @@ | ||
| 910 | * |
|
| 911 | * @throws NotPermittedException |
|
| 912 | */ |
|
| 913 | private function extractContentFromFileOffice(FilesDocument $document, File $file) { |
|
| 914 | if ($this->parseMimeType($document->getMimeType(), $file->getExtension()) |
|
| 915 | !== self::MIMETYPE_OFFICE) { |
|
| 916 | return; |
|
| 917 | } |
|
| 918 | ||
| 919 | $this->configService->setDocumentIndexOption($document, ConfigService::FILES_OFFICE); |
|
| 920 | if (!$this->isSourceIndexable($document)) { |
|
| 921 | return; |
|
| 922 | } |
|
| 923 | ||
| 924 | if ($this->configService->getAppValue(ConfigService::FILES_OFFICE) !== '1') { |
|
| 925 | $document->setContent(''); |
|
| 926 | ||
| 927 | return; |
|
| 928 | } |
|
| 929 | ||
| 930 | $document->setContent( |
|
| 931 | base64_encode($file->getContent()), IndexDocument::ENCODED_BASE64 |
|
| 932 | ); |
|
| 933 | } |
|
| 934 | ||
| 935 | ||
| 936 | /** |
|