mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Explicitly set HTTP cache to public when delivering thumbnail
This commit is contained in:

committed by
Romain Neutron

parent
01a36ee9f7
commit
0ab66c095f
@@ -76,6 +76,7 @@ use Alchemy\Phrasea\Core\PhraseaExceptionHandler;
|
|||||||
use Alchemy\Phrasea\Core\Event\Subscriber\LogoutSubscriber;
|
use Alchemy\Phrasea\Core\Event\Subscriber\LogoutSubscriber;
|
||||||
use Alchemy\Phrasea\Core\Event\Subscriber\PhraseaLocaleSubscriber;
|
use Alchemy\Phrasea\Core\Event\Subscriber\PhraseaLocaleSubscriber;
|
||||||
use Alchemy\Phrasea\Core\Event\Subscriber\MaintenanceSubscriber;
|
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\AuthenticationManagerServiceProvider;
|
||||||
use Alchemy\Phrasea\Core\Provider\BrowserServiceProvider;
|
use Alchemy\Phrasea\Core\Provider\BrowserServiceProvider;
|
||||||
use Alchemy\Phrasea\Core\Provider\BorderManagerServiceProvider;
|
use Alchemy\Phrasea\Core\Provider\BorderManagerServiceProvider;
|
||||||
@@ -412,6 +413,7 @@ class Application extends SilexApplication
|
|||||||
$dispatcher->addSubscriber(new LogoutSubscriber());
|
$dispatcher->addSubscriber(new LogoutSubscriber());
|
||||||
$dispatcher->addSubscriber(new PhraseaLocaleSubscriber($app));
|
$dispatcher->addSubscriber(new PhraseaLocaleSubscriber($app));
|
||||||
$dispatcher->addSubscriber(new MaintenanceSubscriber($app));
|
$dispatcher->addSubscriber(new MaintenanceSubscriber($app));
|
||||||
|
$dispatcher->addSubscriber(new XSendFileSuscriber($app));
|
||||||
|
|
||||||
return $dispatcher;
|
return $dispatcher;
|
||||||
})
|
})
|
||||||
|
@@ -24,7 +24,7 @@ class XSendFileMappingNginxDumper extends Command
|
|||||||
{
|
{
|
||||||
parent::__construct('xsendfile:dump-nginx');
|
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');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -71,6 +71,7 @@ abstract class AbstractDelivery implements ControllerProviderInterface
|
|||||||
|
|
||||||
$response->setMaxAge($expiration);
|
$response->setMaxAge($expiration);
|
||||||
$response->setSharedMaxAge($expiration);
|
$response->setSharedMaxAge($expiration);
|
||||||
|
$response->setPublic();
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|
||||||
|
@@ -20,7 +20,7 @@ class Mapping
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $mapping
|
* @param array $mapping
|
||||||
* @throws \InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
public function __construct(array $mapping)
|
public function __construct(array $mapping)
|
||||||
{
|
{
|
||||||
@@ -49,6 +49,12 @@ class Mapping
|
|||||||
return $this->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())
|
public static function create(Application $app, array $mapping = array())
|
||||||
{
|
{
|
||||||
if (isset($app['phraseanet.configuration']['xsendfile']['mapping'])) {
|
if (isset($app['phraseanet.configuration']['xsendfile']['mapping'])) {
|
||||||
@@ -80,11 +86,11 @@ class Mapping
|
|||||||
{
|
{
|
||||||
foreach($mapping as $entry) {
|
foreach($mapping as $entry) {
|
||||||
if (!is_array($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'])) {
|
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"');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user