/** * @NoAdminRequired * * Returns an app configuration array * * @param bool $extraMediaTypes * * @return array <string,null|array> */ private function getConfig($extraMediaTypes = false) { $features = $this->configService->getFeaturesList(); //$this->logger->debug("Features: {features}", ['features' => $features]); $nativeSvgSupport = $this->isNativeSvgActivated($features); $mediaTypes = $this->configService->getSupportedMediaTypes($extraMediaTypes, $nativeSvgSupport); return ['features' => $features, 'mediatypes' => $mediaTypes]; }
/** * @NoAdminRequired * * Returns an app configuration array * * @param bool $extraMediaTypes * * @return array <string,null|array> */ private function getConfig($extraMediaTypes = false) { $features = $this->configService->getFeaturesList(); //$this->logger->debug("Features: {features}", ['features' => $features]); $nativeSvgSupport = $this->isNativeSvgActivated($features); $mediaTypes = $this->configService->getSupportedMediaTypes($extraMediaTypes, $nativeSvgSupport); $enablePreviews = \OC::$server->getConfig()->getSystemValue('enable_previews', true); return ['features' => $features, 'mediatypes' => $mediaTypes, 'enablePreviews' => $enablePreviews]; }
/** * @dataProvider providesValidateMimeTypeWithForbiddenMimeData * * @param $mimeType * * @expectedException \OCA\Gallery\Service\ForbiddenServiceException */ public function testValidateMimeTypeWithForbiddenMime($mimeType) { $supportedMimeTypes = ['image/png', 'image/jpeg', 'image/gif', 'image/x-xbitmap', 'image/bmp', 'application/postscript', 'application/x-font']; $this->assertSame($supportedMimeTypes, self::invokePrivate($this->service, 'baseMimeTypes', [$supportedMimeTypes])); $this->mockIsMimeSupported($nativeSvgSupport = true); $this->service->validateMimeType($mimeType); }
/** * Generates the download data * * @param int $fileId the ID of the file of which we need a large preview of * @param string|null $filename * * @return array|false */ private function getDownload($fileId, $filename) { /** @type File $file */ $file = $this->downloadService->getResourceFromId($fileId); $this->configService->validateMimeType($file->getMimeType()); $download = $this->downloadService->downloadFile($file); if (is_null($filename)) { $filename = $file->getName(); } $download['name'] = $filename; return $download; }
/** * Returns the file of which a preview will be generated * * @param int $fileId * * @return array<File|int|null> */ private function getFile($fileId) { $status = Http::STATUS_OK; try { /** @type File $file */ $file = $this->previewService->getResourceFromId($fileId); $this->configService->validateMimeType($file->getMimeType()); } catch (ServiceException $exception) { $file = null; $status = $this->getHttpStatusCode($exception); } return [$file, $status]; }
/** * Mocks PreviewService->getSupportedMediaTypes * * @param $slideshow * @param $nativeSvgSupport * @param $mimeTypes */ private function mockSupportedMediaTypes($slideshow, $nativeSvgSupport, $mimeTypes) { $this->configService->expects($this->any())->method('getSupportedMediaTypes')->with($this->equalTo($slideshow), $this->equalTo($nativeSvgSupport))->willReturn($mimeTypes); }
private function mockGetAlbumInfo($folderNode, $folderPathFromRoot, $features, $answer) { $this->configService->expects($this->once())->method('getAlbumInfo')->with($folderNode, $folderPathFromRoot, $features)->willReturn($answer); }