diff --git a/lib/Alchemy/Phrasea/Application.php b/lib/Alchemy/Phrasea/Application.php index ed1bf00209..42c8bd7564 100644 --- a/lib/Alchemy/Phrasea/Application.php +++ b/lib/Alchemy/Phrasea/Application.php @@ -76,6 +76,7 @@ use Alchemy\Phrasea\Core\PhraseaExceptionHandler; use Alchemy\Phrasea\Core\Event\Subscriber\LogoutSubscriber; use Alchemy\Phrasea\Core\Event\Subscriber\PhraseaLocaleSubscriber; use Alchemy\Phrasea\Core\Event\Subscriber\MaintenanceSubscriber; +use Alchemy\Phrasea\Core\Event\Subscriber\XSendFileSuscriber; use Alchemy\Phrasea\Core\Provider\AuthenticationManagerServiceProvider; use Alchemy\Phrasea\Core\Provider\BrowserServiceProvider; use Alchemy\Phrasea\Core\Provider\BorderManagerServiceProvider; @@ -412,6 +413,7 @@ class Application extends SilexApplication $dispatcher->addSubscriber(new LogoutSubscriber()); $dispatcher->addSubscriber(new PhraseaLocaleSubscriber($app)); $dispatcher->addSubscriber(new MaintenanceSubscriber($app)); + $dispatcher->addSubscriber(new XSendFileSuscriber($app)); return $dispatcher; }) diff --git a/lib/Alchemy/Phrasea/Command/Setup/XSendFileMappingNginxDumper.php b/lib/Alchemy/Phrasea/Command/Setup/XSendFileMappingNginxDumper.php index 91ffca120d..479d7ce9d9 100644 --- a/lib/Alchemy/Phrasea/Command/Setup/XSendFileMappingNginxDumper.php +++ b/lib/Alchemy/Phrasea/Command/Setup/XSendFileMappingNginxDumper.php @@ -24,7 +24,7 @@ class XSendFileMappingNginxDumper extends Command { parent::__construct('xsendfile:dump-nginx'); - $this->setDescription('Dump xsendfile mapping for Nginx and Apache web server'); + $this->setDescription('Dump xsendfile mapping for Nginx web server'); } /** diff --git a/lib/Alchemy/Phrasea/Controller/AbstractDelivery.php b/lib/Alchemy/Phrasea/Controller/AbstractDelivery.php index 57a9711491..3c8b54b903 100644 --- a/lib/Alchemy/Phrasea/Controller/AbstractDelivery.php +++ b/lib/Alchemy/Phrasea/Controller/AbstractDelivery.php @@ -71,6 +71,7 @@ abstract class AbstractDelivery implements ControllerProviderInterface $response->setMaxAge($expiration); $response->setSharedMaxAge($expiration); + $response->setPublic(); } } catch (\Exception $e) { diff --git a/lib/Alchemy/Phrasea/XSendFile/Mapping.php b/lib/Alchemy/Phrasea/XSendFile/Mapping.php index 882a82fc04..2ec0e34ebd 100644 --- a/lib/Alchemy/Phrasea/XSendFile/Mapping.php +++ b/lib/Alchemy/Phrasea/XSendFile/Mapping.php @@ -20,7 +20,7 @@ class Mapping /** * @param array $mapping - * @throws \InvalidArgumentException + * @throws InvalidArgumentException */ public function __construct(array $mapping) { @@ -49,6 +49,12 @@ class Mapping return $this->mapping; } + /** + * @param \Alchemy\Phrasea\Application $app + * @param array $mapping + * @return \Alchemy\Phrasea\XSendFile\Mapping + * @throws InvalidArgumentException + */ public static function create(Application $app, array $mapping = array()) { if (isset($app['phraseanet.configuration']['xsendfile']['mapping'])) { @@ -80,11 +86,11 @@ class Mapping { foreach($mapping as $entry) { if (!is_array($entry)) { - throw new \InvalidArgumentException('XSendFile mapping entry must be an array'); + throw new InvalidArgumentException('XSendFile mapping entry must be an array'); } if (!isset($entry['directory']) && !isset($entry['mount-point'])) { - throw new \InvalidArgumentException('XSendFile mapping entry must contain at least two keys "directory" and "mounbt-point"'); + throw new InvalidArgumentException('XSendFile mapping entry must contain at least two keys "directory" and "mounbt-point"'); } } }