| @@ 874-894 (lines=21) @@ | ||
| 871 | * |
|
| 872 | * @throws NotPermittedException |
|
| 873 | */ |
|
| 874 | private function extractContentFromFilePDF(FilesDocument $document, File $file) { |
|
| 875 | if ($this->parseMimeType($document->getMimeType(), $file->getExtension()) |
|
| 876 | !== self::MIMETYPE_PDF) { |
|
| 877 | return; |
|
| 878 | } |
|
| 879 | ||
| 880 | $this->configService->setDocumentIndexOption($document, ConfigService::FILES_PDF); |
|
| 881 | if (!$this->isSourceIndexable($document)) { |
|
| 882 | return; |
|
| 883 | } |
|
| 884 | ||
| 885 | if ($this->configService->getAppValue(ConfigService::FILES_PDF) !== '1') { |
|
| 886 | $document->setContent(''); |
|
| 887 | ||
| 888 | return; |
|
| 889 | } |
|
| 890 | ||
| 891 | $document->setContent( |
|
| 892 | base64_encode($file->getContent()), IndexDocument::ENCODED_BASE64 |
|
| 893 | ); |
|
| 894 | } |
|
| 895 | ||
| 896 | ||
| 897 | /** |
|
| @@ 903-923 (lines=21) @@ | ||
| 900 | * |
|
| 901 | * @throws NotPermittedException |
|
| 902 | */ |
|
| 903 | private function extractContentFromFileZip(FilesDocument $document, File $file) { |
|
| 904 | if ($this->parseMimeType($document->getMimeType(), $file->getExtension()) |
|
| 905 | !== self::MIMETYPE_ZIP) { |
|
| 906 | return; |
|
| 907 | } |
|
| 908 | ||
| 909 | $this->configService->setDocumentIndexOption($document, ConfigService::FILES_ZIP); |
|
| 910 | if (!$this->isSourceIndexable($document)) { |
|
| 911 | return; |
|
| 912 | } |
|
| 913 | ||
| 914 | if ($this->configService->getAppValue(ConfigService::FILES_ZIP) !== '1') { |
|
| 915 | $document->setContent(''); |
|
| 916 | ||
| 917 | return; |
|
| 918 | } |
|
| 919 | ||
| 920 | $document->setContent( |
|
| 921 | base64_encode($file->getContent()), IndexDocument::ENCODED_BASE64 |
|
| 922 | ); |
|
| 923 | } |
|
| 924 | ||
| 925 | ||
| 926 | /** |
|
| @@ 932-952 (lines=21) @@ | ||
| 929 | * |
|
| 930 | * @throws NotPermittedException |
|
| 931 | */ |
|
| 932 | private function extractContentFromFileOffice(FilesDocument $document, File $file) { |
|
| 933 | if ($this->parseMimeType($document->getMimeType(), $file->getExtension()) |
|
| 934 | !== self::MIMETYPE_OFFICE) { |
|
| 935 | return; |
|
| 936 | } |
|
| 937 | ||
| 938 | $this->configService->setDocumentIndexOption($document, ConfigService::FILES_OFFICE); |
|
| 939 | if (!$this->isSourceIndexable($document)) { |
|
| 940 | return; |
|
| 941 | } |
|
| 942 | ||
| 943 | if ($this->configService->getAppValue(ConfigService::FILES_OFFICE) !== '1') { |
|
| 944 | $document->setContent(''); |
|
| 945 | ||
| 946 | return; |
|
| 947 | } |
|
| 948 | ||
| 949 | $document->setContent( |
|
| 950 | base64_encode($file->getContent()), IndexDocument::ENCODED_BASE64 |
|
| 951 | ); |
|
| 952 | } |
|
| 953 | ||
| 954 | ||
| 955 | /** |
|