diff --git a/lib/Alchemy/Phrasea/Application.php b/lib/Alchemy/Phrasea/Application.php index e948159a0a..94a397e8f8 100644 --- a/lib/Alchemy/Phrasea/Application.php +++ b/lib/Alchemy/Phrasea/Application.php @@ -1,4 +1,4 @@ -setupUrlGenerator(); $this->register(new UnicodeServiceProvider()); $this->register(new ValidatorServiceProvider()); - $this->register(new XPDFServiceProvider()); - $this->register(new XSendFileMappingServiceProvider()); $this->register(new FileServeServiceProvider()); $this['phraseanet.exception_handler'] = $this->share(function ($app) { @@ -348,7 +344,6 @@ class Application extends SilexApplication $transport->setPassword($options['password']); $transport->setAuthMode($options['auth_mode']); } - } else { $transport = new \Swift_Transport_MailTransport( new \Swift_Transport_SimpleMailInvoker(), @@ -363,7 +358,6 @@ class Application extends SilexApplication if ($app['phraseanet.registry']->get('GV_imagine_driver') != '') { return $app['phraseanet.registry']->get('GV_imagine_driver'); } - if (class_exists('\Gmagick')) { return 'gmagick'; } @@ -408,7 +402,6 @@ class Application extends SilexApplication $dispatcher->addSubscriber(new LogoutSubscriber()); $dispatcher->addSubscriber(new PhraseaLocaleSubscriber($app)); $dispatcher->addSubscriber(new MaintenanceSubscriber($app)); - $dispatcher->addSubscriber(new XSendFileSubscriber($app)); return $dispatcher; }) diff --git a/lib/Alchemy/Phrasea/Command/Setup/XSendFileMappingNginxDumper.php b/lib/Alchemy/Phrasea/Command/Setup/XSendFileMappingNginxDumper.php index 479d7ce9d9..372fb32105 100644 --- a/lib/Alchemy/Phrasea/Command/Setup/XSendFileMappingNginxDumper.php +++ b/lib/Alchemy/Phrasea/Command/Setup/XSendFileMappingNginxDumper.php @@ -38,7 +38,7 @@ class XSendFileMappingNginxDumper extends Command foreach ($this->container['phraseanet.xsendfile-mapping']->getMapping() as $entry) { $output->writeln(' location ' . $mapper->sanitizeMountPoint($entry['mount-point']) . ' {'); $output->writeln(' internal;'); - $output->writeln(' alias ' . $mapper->sanitizePath($entry['directory'])); + $output->writeln(' alias ' . $mapper->sanitizePath($entry['directory']) . ';'); $output->writeln(' }'); $output->writeln(''); } diff --git a/lib/Alchemy/Phrasea/Controller/AbstractDelivery.php b/lib/Alchemy/Phrasea/Controller/AbstractDelivery.php index 3c8b54b903..7343212d03 100644 --- a/lib/Alchemy/Phrasea/Controller/AbstractDelivery.php +++ b/lib/Alchemy/Phrasea/Controller/AbstractDelivery.php @@ -12,7 +12,7 @@ namespace Alchemy\Phrasea\Controller; use Alchemy\Phrasea\Application; -use Alchemy\Phrasea\Response\ServeFileResponseFactory; +use Alchemy\Phrasea\Response\DeliverDataInterface; use Silex\ControllerProviderInterface; use Symfony\Component\HttpFoundation\Request; @@ -52,7 +52,7 @@ abstract class AbstractDelivery implements ControllerProviderInterface } - $response = $app['phraseanet.file-serve']->deliverFile($pathOut, $file->get_file(), ServeFileResponseFactory::DISPOSITION_INLINE, $file->get_mime()); + $response = $app['phraseanet.file-serve']->deliverFile($pathOut, $file->get_file(), DeliverDataInterface::DISPOSITION_INLINE, $file->get_mime()); $response->setPrivate(); /* @var $response \Symfony\Component\HttpFoundation\Response */ diff --git a/lib/Alchemy/Phrasea/Controller/Prod/DoDownload.php b/lib/Alchemy/Phrasea/Controller/Prod/DoDownload.php index 19714a509e..eb206412e0 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/DoDownload.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/DoDownload.php @@ -11,7 +11,7 @@ namespace Alchemy\Phrasea\Controller\Prod; -use Alchemy\Phrasea\Response\ServeFileResponseFactory; +use Alchemy\Phrasea\Response\DeliverDataInterface; use Silex\Application; use Silex\ControllerProviderInterface; use Symfony\Component\HttpFoundation\Request; @@ -171,7 +171,7 @@ class DoDownload implements ControllerProviderInterface ); }); - return $app['phraseanet.file-serve']->deliverFile($exportFile, $exportName, ServeFileResponseFactory::DISPOSITION_ATTACHMENT, $mime); + return $app['phraseanet.file-serve']->deliverFile($exportFile, $exportName, DeliverDataInterface::DISPOSITION_ATTACHMENT, $mime); } /** diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php b/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php index 5818a496de..60a21c1f1d 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php @@ -14,7 +14,7 @@ namespace Alchemy\Phrasea\Controller\Prod; use Entities\LazaretFile; use Alchemy\Phrasea\Border; use Alchemy\Phrasea\Border\Attribute\AttributeInterface; -use Alchemy\Phrasea\Response\ServeFileResponseFactory; +use Alchemy\Phrasea\Response\DeliverDataInterface; use Silex\Application; use Silex\ControllerProviderInterface; use Symfony\Component\HttpFoundation\Request; @@ -522,7 +522,7 @@ class Lazaret implements ControllerProviderInterface $lazaretThumbFileName = $app['root.path'] . '/tmp/lazaret/' . $lazaretFile->getThumbFilename(); - return $app['phraseanet.file-serve']->deliverFile($lazaretThumbFileName, $lazaretFile->getOriginalName(), ServeFileResponseFactory::DISPOSITION_INLINE, 'image/jpeg'); + return $app['phraseanet.file-serve']->deliverFile($lazaretThumbFileName, $lazaretFile->getOriginalName(), DeliverDataInterface::DISPOSITION_INLINE, 'image/jpeg'); } /** diff --git a/lib/Alchemy/Phrasea/Core/Provider/FileServeServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/FileServeServiceProvider.php index 35362bba02..bb6fad094b 100644 --- a/lib/Alchemy/Phrasea/Core/Provider/FileServeServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/Provider/FileServeServiceProvider.php @@ -14,6 +14,7 @@ namespace Alchemy\Phrasea\Core\Provider; use Silex\Application; use Silex\ServiceProviderInterface; use Alchemy\Phrasea\Response\ServeFileResponseFactory; +use Alchemy\Phrasea\Core\Event\Subscriber\XSendFileSubscriber; class FileServeServiceProvider implements ServiceProviderInterface { @@ -22,6 +23,29 @@ class FileServeServiceProvider implements ServiceProviderInterface */ public function register(Application $app) { + $app['xsendfile.mapping'] = $app->share(function(Application $app) { + $mapping = array(); + + if (isset($app['phraseanet.configuration']['xsendfile']['mapping'])) { + $mapping = $app['phraseanet.configuration']['xsendfile']['mapping']; + } + + $mapping[] = array( + 'directory' => $app['root.path'] . '/tmp/download/', + 'mount-point' => '/download/', + ); + $mapping[] = array( + 'directory' => $app['root.path'] . '/tmp/lazaret/', + 'mount-point' => '/lazaret/', + ); + + return $mapping; + }); + + $app['phraseanet.xsendfile-mapping'] = $app->share(function($app) { + return new Mapping($app['xsendfile.mapping']); + }); + $app['phraseanet.file-serve'] = $app->share(function (Application $app) { return ServeFileResponseFactory::create($app); }); @@ -32,5 +56,6 @@ class FileServeServiceProvider implements ServiceProviderInterface */ public function boot(Application $app) { + $app['dispatcher']->addSubscriber(new XSendFileSubscriber($app)); } } diff --git a/lib/Alchemy/Phrasea/Core/Provider/XSendFileMappingServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/XSendFileMappingServiceProvider.php deleted file mode 100644 index 8bb02a820e..0000000000 --- a/lib/Alchemy/Phrasea/Core/Provider/XSendFileMappingServiceProvider.php +++ /dev/null @@ -1,49 +0,0 @@ -share(function(Application $app) { - $mapping = array(); - - if (isset($app['phraseanet.configuration']['xsendfile']['mapping'])) { - $mapping = $app['phraseanet.configuration']['xsendfile']['mapping']; - } - - $mapping[] = array( - 'directory' => $app['root.path'] . '/tmp/download/', - 'mount-point' => '/download/', - ); - $mapping[] = array( - 'directory' => $app['root.path'] . '/tmp/lazaret/', - 'mount-point' => '/lazaret/', - ); - - return $mapping; - }); - - $app['phraseanet.xsendfile-mapping'] = $app->share(function($app) { - return new Mapping($app['xsendfile.mapping']); - }); - } - - public function boot(Application $app) - { - } -} diff --git a/lib/Alchemy/Phrasea/Core/Version.php b/lib/Alchemy/Phrasea/Core/Version.php index cd3fd9f556..9cdcfb4982 100644 --- a/lib/Alchemy/Phrasea/Core/Version.php +++ b/lib/Alchemy/Phrasea/Core/Version.php @@ -18,7 +18,7 @@ namespace Alchemy\Phrasea\Core; */ class Version { - protected static $number = '3.8.0.a12'; + protected static $number = '3.8.0.a13'; protected static $name = 'Carnosaurus'; public static function getNumber() diff --git a/lib/classes/patch/3812.php b/lib/classes/patch/3813.php similarity index 94% rename from lib/classes/patch/3812.php rename to lib/classes/patch/3813.php index a257b96710..d55d86f470 100644 --- a/lib/classes/patch/3812.php +++ b/lib/classes/patch/3813.php @@ -11,10 +11,10 @@ use Alchemy\Phrasea\Application; -class patch_3812 implements patchInterface +class patch_3813 implements patchInterface { /** @var string */ - private $release = '3.8.0.a12'; + private $release = '3.8.0.a13'; /** @var array */ private $concern = array(base::APPLICATION_BOX); diff --git a/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-setup.yml b/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-setup.yml index 1fefa6341a..1e9a88ae35 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-setup.yml +++ b/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-setup.yml @@ -114,3 +114,9 @@ registration-fields: - name: geonameid required: true +xsendfile: + enable: false + mapping: + - + directory: '' + mount-point: '' diff --git a/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration.yml b/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration.yml index 1fefa6341a..1e9a88ae35 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration.yml +++ b/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration.yml @@ -114,3 +114,9 @@ registration-fields: - name: geonameid required: true +xsendfile: + enable: false + mapping: + - + directory: '' + mount-point: ''