Explicitly set HTTP cache to public when delivering thumbnail

This commit is contained in:
Nicolas Le Goff
2013-06-26 16:57:52 +02:00
committed by Romain Neutron
parent 01a36ee9f7
commit 0ab66c095f
4 changed files with 13 additions and 4 deletions

View File

@@ -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;
})

View File

@@ -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');
}
/**

View File

@@ -71,6 +71,7 @@ abstract class AbstractDelivery implements ControllerProviderInterface
$response->setMaxAge($expiration);
$response->setSharedMaxAge($expiration);
$response->setPublic();
}
} catch (\Exception $e) {

View File

@@ -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"');
}
}
}