Adress last comment

This commit is contained in:
Nicolas Le Goff
2013-06-27 14:02:31 +02:00
committed by Romain Neutron
parent 2ea0f3af41
commit b5dbd37740
11 changed files with 48 additions and 67 deletions

View File

@@ -1,4 +1,4 @@
<?php X<?php
/* /*
* This file is part of Phraseanet * This file is part of Phraseanet
@@ -76,7 +76,6 @@ 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\XSendFileSubscriber;
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;
@@ -100,7 +99,6 @@ use Alchemy\Phrasea\Core\Provider\TaskManagerServiceProvider;
use Alchemy\Phrasea\Core\Provider\TemporaryFilesystemServiceProvider; use Alchemy\Phrasea\Core\Provider\TemporaryFilesystemServiceProvider;
use Alchemy\Phrasea\Core\Provider\TokensServiceProvider; use Alchemy\Phrasea\Core\Provider\TokensServiceProvider;
use Alchemy\Phrasea\Core\Provider\UnicodeServiceProvider; use Alchemy\Phrasea\Core\Provider\UnicodeServiceProvider;
use Alchemy\Phrasea\Core\Provider\XSendFileMappingServiceProvider;
use Alchemy\Phrasea\Exception\InvalidArgumentException; use Alchemy\Phrasea\Exception\InvalidArgumentException;
use Alchemy\Phrasea\Twig\JSUniqueID; use Alchemy\Phrasea\Twig\JSUniqueID;
use Alchemy\Phrasea\Twig\Camelize; use Alchemy\Phrasea\Twig\Camelize;
@@ -306,9 +304,7 @@ class Application extends SilexApplication
$this->setupUrlGenerator(); $this->setupUrlGenerator();
$this->register(new UnicodeServiceProvider()); $this->register(new UnicodeServiceProvider());
$this->register(new ValidatorServiceProvider()); $this->register(new ValidatorServiceProvider());
$this->register(new XPDFServiceProvider()); $this->register(new XPDFServiceProvider());
$this->register(new XSendFileMappingServiceProvider());
$this->register(new FileServeServiceProvider()); $this->register(new FileServeServiceProvider());
$this['phraseanet.exception_handler'] = $this->share(function ($app) { $this['phraseanet.exception_handler'] = $this->share(function ($app) {
@@ -348,7 +344,6 @@ class Application extends SilexApplication
$transport->setPassword($options['password']); $transport->setPassword($options['password']);
$transport->setAuthMode($options['auth_mode']); $transport->setAuthMode($options['auth_mode']);
} }
} else { } else {
$transport = new \Swift_Transport_MailTransport( $transport = new \Swift_Transport_MailTransport(
new \Swift_Transport_SimpleMailInvoker(), new \Swift_Transport_SimpleMailInvoker(),
@@ -363,7 +358,6 @@ class Application extends SilexApplication
if ($app['phraseanet.registry']->get('GV_imagine_driver') != '') { if ($app['phraseanet.registry']->get('GV_imagine_driver') != '') {
return $app['phraseanet.registry']->get('GV_imagine_driver'); return $app['phraseanet.registry']->get('GV_imagine_driver');
} }
if (class_exists('\Gmagick')) { if (class_exists('\Gmagick')) {
return 'gmagick'; return 'gmagick';
} }
@@ -408,7 +402,6 @@ 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 XSendFileSubscriber($app));
return $dispatcher; return $dispatcher;
}) })

View File

@@ -38,7 +38,7 @@ class XSendFileMappingNginxDumper extends Command
foreach ($this->container['phraseanet.xsendfile-mapping']->getMapping() as $entry) { foreach ($this->container['phraseanet.xsendfile-mapping']->getMapping() as $entry) {
$output->writeln(' location ' . $mapper->sanitizeMountPoint($entry['mount-point']) . ' {'); $output->writeln(' location ' . $mapper->sanitizeMountPoint($entry['mount-point']) . ' {');
$output->writeln(' internal;'); $output->writeln(' internal;');
$output->writeln(' alias ' . $mapper->sanitizePath($entry['directory'])); $output->writeln(' alias ' . $mapper->sanitizePath($entry['directory']) . ';');
$output->writeln(' }'); $output->writeln(' }');
$output->writeln(''); $output->writeln('');
} }

View File

@@ -12,7 +12,7 @@
namespace Alchemy\Phrasea\Controller; namespace Alchemy\Phrasea\Controller;
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Response\ServeFileResponseFactory; use Alchemy\Phrasea\Response\DeliverDataInterface;
use Silex\ControllerProviderInterface; use Silex\ControllerProviderInterface;
use Symfony\Component\HttpFoundation\Request; 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(); $response->setPrivate();
/* @var $response \Symfony\Component\HttpFoundation\Response */ /* @var $response \Symfony\Component\HttpFoundation\Response */

View File

@@ -11,7 +11,7 @@
namespace Alchemy\Phrasea\Controller\Prod; namespace Alchemy\Phrasea\Controller\Prod;
use Alchemy\Phrasea\Response\ServeFileResponseFactory; use Alchemy\Phrasea\Response\DeliverDataInterface;
use Silex\Application; use Silex\Application;
use Silex\ControllerProviderInterface; use Silex\ControllerProviderInterface;
use Symfony\Component\HttpFoundation\Request; 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);
} }
/** /**

View File

@@ -14,7 +14,7 @@ namespace Alchemy\Phrasea\Controller\Prod;
use Entities\LazaretFile; use Entities\LazaretFile;
use Alchemy\Phrasea\Border; use Alchemy\Phrasea\Border;
use Alchemy\Phrasea\Border\Attribute\AttributeInterface; use Alchemy\Phrasea\Border\Attribute\AttributeInterface;
use Alchemy\Phrasea\Response\ServeFileResponseFactory; use Alchemy\Phrasea\Response\DeliverDataInterface;
use Silex\Application; use Silex\Application;
use Silex\ControllerProviderInterface; use Silex\ControllerProviderInterface;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
@@ -522,7 +522,7 @@ class Lazaret implements ControllerProviderInterface
$lazaretThumbFileName = $app['root.path'] . '/tmp/lazaret/' . $lazaretFile->getThumbFilename(); $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');
} }
/** /**

View File

@@ -14,6 +14,7 @@ namespace Alchemy\Phrasea\Core\Provider;
use Silex\Application; use Silex\Application;
use Silex\ServiceProviderInterface; use Silex\ServiceProviderInterface;
use Alchemy\Phrasea\Response\ServeFileResponseFactory; use Alchemy\Phrasea\Response\ServeFileResponseFactory;
use Alchemy\Phrasea\Core\Event\Subscriber\XSendFileSubscriber;
class FileServeServiceProvider implements ServiceProviderInterface class FileServeServiceProvider implements ServiceProviderInterface
{ {
@@ -22,6 +23,29 @@ class FileServeServiceProvider implements ServiceProviderInterface
*/ */
public function register(Application $app) 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) { $app['phraseanet.file-serve'] = $app->share(function (Application $app) {
return ServeFileResponseFactory::create($app); return ServeFileResponseFactory::create($app);
}); });
@@ -32,5 +56,6 @@ class FileServeServiceProvider implements ServiceProviderInterface
*/ */
public function boot(Application $app) public function boot(Application $app)
{ {
$app['dispatcher']->addSubscriber(new XSendFileSubscriber($app));
} }
} }

View File

@@ -1,49 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Core\Provider;
use Alchemy\Phrasea\XSendFile\Mapping;
use Silex\Application;
use Silex\ServiceProviderInterface;
class XSendFileMappingServiceProvider 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']);
});
}
public function boot(Application $app)
{
}
}

View File

@@ -18,7 +18,7 @@ namespace Alchemy\Phrasea\Core;
*/ */
class Version class Version
{ {
protected static $number = '3.8.0.a12'; protected static $number = '3.8.0.a13';
protected static $name = 'Carnosaurus'; protected static $name = 'Carnosaurus';
public static function getNumber() public static function getNumber()

View File

@@ -11,10 +11,10 @@
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
class patch_3812 implements patchInterface class patch_3813 implements patchInterface
{ {
/** @var string */ /** @var string */
private $release = '3.8.0.a12'; private $release = '3.8.0.a13';
/** @var array */ /** @var array */
private $concern = array(base::APPLICATION_BOX); private $concern = array(base::APPLICATION_BOX);

View File

@@ -114,3 +114,9 @@ registration-fields:
- -
name: geonameid name: geonameid
required: true required: true
xsendfile:
enable: false
mapping:
-
directory: ''
mount-point: ''

View File

@@ -114,3 +114,9 @@ registration-fields:
- -
name: geonameid name: geonameid
required: true required: true
xsendfile:
enable: false
mapping:
-
directory: ''
mount-point: ''