diff --git a/UPGRADE-5.10.md b/UPGRADE-5.10.md index b88e253e96..1f80741e4f 100644 --- a/UPGRADE-5.10.md +++ b/UPGRADE-5.10.md @@ -4,7 +4,7 @@ UPGRADE FROM 5.9 to 5.10 AdminBundle ------------ -* The `kunstmaan_admin.google_signin` config and related classes/functionality is deprecated and will be removed in 6.0. If you need the ability +* The `kunstmaan_admin.google_signin` config and related classes/functionality is deprecated and will be removed in 6.0. If you need the ability to login in the admin interface with google, implement the authenticator in your project. * Passing a service instance of `Symfony\Component\HttpFoundation\Session\SessionInterface` for the first argument in `Kunstmaan\AdminBundle\EventListener\PasswordCheckListener::__construct` is deprecated and an instance of `Symfony\Component\HttpFoundation\RequestStack` will be required in 6.0. @@ -13,3 +13,8 @@ NodeBundle * Passing a service instance of `Symfony\Component\HttpFoundation\Session\SessionInterface` for the first argument in `Kunstmaan\NodeBundle\EventListener\NodeTranslationListener::__construct` is deprecated and an instance of `Symfony\Component\HttpFoundation\RequestStack` will be required in 6.0. * The fourth argument of `Kunstmaan\NodeBundle\EventListener\NodeTranslationListener::__construct` is deprecated and will be removed in 6.0. Check the constructor arguments and inject the required services instead. + +MediaBundle +----------- + +* Parameter `kunstmaan_media.full_media_path` is deprecated and will be removed in 6.0. diff --git a/src/Kunstmaan/MediaBundle/DependencyInjection/KunstmaanMediaExtension.php b/src/Kunstmaan/MediaBundle/DependencyInjection/KunstmaanMediaExtension.php index 71e813b7ed..638fea450b 100644 --- a/src/Kunstmaan/MediaBundle/DependencyInjection/KunstmaanMediaExtension.php +++ b/src/Kunstmaan/MediaBundle/DependencyInjection/KunstmaanMediaExtension.php @@ -39,6 +39,8 @@ public function load(array $configs, ContainerBuilder $container) $container->setParameter('kunstmaan_media.enable_pdf_preview', $config['enable_pdf_preview']); $container->setParameter('kunstmaan_media.blacklisted_extensions', $config['blacklisted_extensions']); $container->setParameter('kunstmaan_media.web_root', $config['web_root']); + + // NEXT_MAJOR: Remove parameter because this is not used $container->setParameter('kunstmaan_media.full_media_path', $config['web_root'] . '%kunstmaan_media.media_path%'); $loader->load('services.yml'); diff --git a/src/Kunstmaan/MediaBundle/Helper/File/FileHandler.php b/src/Kunstmaan/MediaBundle/Helper/File/FileHandler.php index 9dd33e34e4..e1a5518d81 100644 --- a/src/Kunstmaan/MediaBundle/Helper/File/FileHandler.php +++ b/src/Kunstmaan/MediaBundle/Helper/File/FileHandler.php @@ -214,7 +214,7 @@ public function prepareMedia(Media $media) $media->setContentType($contentType); $media->setFileSize(filesize($media->getContent())); - $media->setUrl($this->mediaPath . $this->getFilePath($media)); + $media->setUrl($this->getFilePath($media)); $media->setLocation('local'); } @@ -334,7 +334,8 @@ private function getFilePath(Media $media) } return sprintf( - '%s/%s', + '%s%s/%s', + $this->mediaPath, $media->getUuid(), $filename ); @@ -345,7 +346,9 @@ private function getFilePath(Media $media) */ private function getFileFolderPath(Media $media) { - return substr($this->getFilePath($media), 0, strrpos($this->getFilePath($media), $media->getOriginalFilename())); + $filePath = $this->getFilePath($media); + + return substr($filePath, 0, strrpos($filePath, $media->getOriginalFilename())); } private function guessMimeType($pathName) diff --git a/src/Kunstmaan/MediaBundle/Resources/config/services.yml b/src/Kunstmaan/MediaBundle/Resources/config/services.yml index 4dade63c72..8cfbc47473 100644 --- a/src/Kunstmaan/MediaBundle/Resources/config/services.yml +++ b/src/Kunstmaan/MediaBundle/Resources/config/services.yml @@ -114,7 +114,7 @@ services: kunstmaan_media.filesystem_adapter: class: Gaufrette\Adapter\Local arguments: - - '%kunstmaan_media.full_media_path%' + - '%kunstmaan_media.web_root%' - true kunstmaan_media.filesystem: