Group Filesystem related service providers

This commit is contained in:
Benoît Burnichon
2016-02-03 14:31:22 +01:00
parent 8899c719fb
commit 58b80bf08a
4 changed files with 11 additions and 27 deletions

View File

@@ -68,13 +68,13 @@ use Alchemy\Phrasea\Core\Provider\SerializerServiceProvider;
use Alchemy\Phrasea\Core\Provider\StatusServiceProvider; use Alchemy\Phrasea\Core\Provider\StatusServiceProvider;
use Alchemy\Phrasea\Core\Provider\SubdefServiceProvider; use Alchemy\Phrasea\Core\Provider\SubdefServiceProvider;
use Alchemy\Phrasea\Core\Provider\TasksServiceProvider; use Alchemy\Phrasea\Core\Provider\TasksServiceProvider;
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\WebhookServiceProvider; use Alchemy\Phrasea\Core\Provider\WebhookServiceProvider;
use Alchemy\Phrasea\Core\Provider\ZippyServiceProvider; use Alchemy\Phrasea\Core\Provider\ZippyServiceProvider;
use Alchemy\Phrasea\Core\Provider\WebProfilerServiceProvider as PhraseaWebProfilerServiceProvider; use Alchemy\Phrasea\Core\Provider\WebProfilerServiceProvider as PhraseaWebProfilerServiceProvider;
use Alchemy\Phrasea\Exception\InvalidArgumentException; use Alchemy\Phrasea\Exception\InvalidArgumentException;
use Alchemy\Phrasea\Filesystem\FilesystemServiceProvider;
use Alchemy\Phrasea\Form\Extension\HelpTypeExtension; use Alchemy\Phrasea\Form\Extension\HelpTypeExtension;
use Alchemy\Phrasea\Media\DatafilesResolver; use Alchemy\Phrasea\Media\DatafilesResolver;
use Alchemy\Phrasea\Media\MediaAccessorResolver; use Alchemy\Phrasea\Media\MediaAccessorResolver;
@@ -86,7 +86,6 @@ use MediaVorus\MediaVorus;
use Monolog\Handler\RotatingFileHandler; use Monolog\Handler\RotatingFileHandler;
use Monolog\Logger; use Monolog\Logger;
use Neutron\ReCaptcha\ReCaptchaServiceProvider; use Neutron\ReCaptcha\ReCaptchaServiceProvider;
use Neutron\Silex\Provider\FilesystemServiceProvider;
use Silex\Application as SilexApplication; use Silex\Application as SilexApplication;
use Silex\Application\TranslationTrait; use Silex\Application\TranslationTrait;
use Silex\Application\UrlGeneratorTrait; use Silex\Application\UrlGeneratorTrait;
@@ -161,7 +160,6 @@ class Application extends SilexApplication
$this->register(new MonologServiceProvider()); $this->register(new MonologServiceProvider());
$this->setupMonolog(); $this->setupMonolog();
$this->register(new FilesystemServiceProvider()); $this->register(new FilesystemServiceProvider());
$this->register(new TemporaryFilesystemServiceProvider());
$this->register(new CacheServiceProvider()); $this->register(new CacheServiceProvider());
$this->register(new CacheConnectionServiceProvider()); $this->register(new CacheConnectionServiceProvider());
$this->register(new PhraseanetServiceProvider()); $this->register(new PhraseanetServiceProvider());

View File

@@ -10,7 +10,6 @@
namespace Alchemy\Phrasea\Application\Helper; namespace Alchemy\Phrasea\Application\Helper;
use Neutron\TemporaryFilesystem\Manager; use Neutron\TemporaryFilesystem\Manager;
use Neutron\TemporaryFilesystem\TemporaryFilesystemInterface;
use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Filesystem\Filesystem;
trait FilesystemAware trait FilesystemAware

View File

@@ -1,6 +1,5 @@
<?php <?php
/**
/*
* This file is part of Phraseanet * This file is part of Phraseanet
* *
* (c) 2005-2016 Alchemy * (c) 2005-2016 Alchemy
@@ -9,17 +8,22 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace Alchemy\Phrasea\Core\Provider; namespace Alchemy\Phrasea\Filesystem;
use Neutron\TemporaryFilesystem\TemporaryFilesystem;
use Neutron\TemporaryFilesystem\Manager; use Neutron\TemporaryFilesystem\Manager;
use Neutron\TemporaryFilesystem\TemporaryFilesystem;
use Silex\Application; use Silex\Application;
use Silex\ServiceProviderInterface; use Silex\ServiceProviderInterface;
use Symfony\Component\Filesystem\Filesystem;
class TemporaryFilesystemServiceProvider implements ServiceProviderInterface class FilesystemServiceProvider implements ServiceProviderInterface
{ {
public function register(Application $app) public function register(Application $app)
{ {
$app['filesystem'] = $app->share(function () {
new Filesystem();
});
$app['temporary-filesystem.temporary-fs'] = $app->share(function (Application $app) { $app['temporary-filesystem.temporary-fs'] = $app->share(function (Application $app) {
return new TemporaryFilesystem($app['filesystem']); return new TemporaryFilesystem($app['filesystem']);
}); });
@@ -30,5 +34,6 @@ class TemporaryFilesystemServiceProvider implements ServiceProviderInterface
public function boot(Application $app) public function boot(Application $app)
{ {
// no-op
} }
} }

View File

@@ -1,18 +0,0 @@
<?php
namespace Alchemy\Tests\Phrasea\Core\Provider;
/**
* @group functional
* @group legacy
* @covers Alchemy\Phrasea\Core\Provider\TemporaryFilesystemServiceProvider
*/
class TemporaryFilesystemServiceProviderTest extends ServiceProviderTestCase
{
public function provideServiceDescription()
{
return [
['Alchemy\Phrasea\Core\Provider\TemporaryFilesystemServiceProvider', 'temporary-filesystem', 'Neutron\TemporaryFilesystem\TemporaryFilesystemInterface'],
];
}
}