mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
Fix latest merge
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
namespace Alchemy\Phrasea\Border;
|
namespace Alchemy\Phrasea\Border;
|
||||||
|
|
||||||
use Alchemy\Phrasea\Core\Configuration\Configuration;
|
use Alchemy\Phrasea\Core\Configuration\Configuration;
|
||||||
|
use Alchemy\Phrasea\Core\Configuration\PropertyAccess;
|
||||||
use MediaVorus\Utils\AudioMimeTypeGuesser;
|
use MediaVorus\Utils\AudioMimeTypeGuesser;
|
||||||
use MediaVorus\Utils\PostScriptMimeTypeGuesser;
|
use MediaVorus\Utils\PostScriptMimeTypeGuesser;
|
||||||
use MediaVorus\Utils\RawImageMimeTypeGuesser;
|
use MediaVorus\Utils\RawImageMimeTypeGuesser;
|
||||||
@@ -21,11 +22,14 @@ use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser;
|
|||||||
|
|
||||||
class MimeGuesserConfiguration
|
class MimeGuesserConfiguration
|
||||||
{
|
{
|
||||||
|
/** @var PropertyAccess */
|
||||||
private $conf;
|
private $conf;
|
||||||
|
private $store;
|
||||||
|
|
||||||
public function __construct(Configuration $conf)
|
public function __construct(PropertyAccess $conf, Configuration $store)
|
||||||
{
|
{
|
||||||
$this->conf = $conf;
|
$this->conf = $conf;
|
||||||
|
$this->store = $store;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,12 +45,8 @@ class MimeGuesserConfiguration
|
|||||||
$guesser->register(new AudioMimeTypeGuesser());
|
$guesser->register(new AudioMimeTypeGuesser());
|
||||||
$guesser->register(new VideoMimeTypeGuesser());
|
$guesser->register(new VideoMimeTypeGuesser());
|
||||||
|
|
||||||
if ($this->conf->isSetup()) {
|
if ($this->store->isSetup()) {
|
||||||
$conf = $this->conf->getConfig();
|
$guesser->register(new CustomExtensionGuesser($this->conf->get(['border-manager', 'extension-mapping'], [])));
|
||||||
|
|
||||||
if (isset($conf['border-manager']['extension-mapping']) && is_array($conf['border-manager']['extension-mapping'])) {
|
|
||||||
$guesser->register(new CustomExtensionGuesser($conf['border-manager']['extension-mapping']));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -100,7 +100,7 @@ class BorderManagerServiceProvider implements ServiceProviderInterface
|
|||||||
});
|
});
|
||||||
|
|
||||||
$app['border-manager.mime-guesser-configuration'] = $app->share(function (Application $app) {
|
$app['border-manager.mime-guesser-configuration'] = $app->share(function (Application $app) {
|
||||||
return new MimeGuesserConfiguration($app['phraseanet.configuration']);
|
return new MimeGuesserConfiguration($app['conf'], $app['configuration.store']);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -4,13 +4,13 @@ namespace Alchemy\Tests\Phrasea\Border;
|
|||||||
|
|
||||||
use Alchemy\Phrasea\Border\CustomExtensionGuesser;
|
use Alchemy\Phrasea\Border\CustomExtensionGuesser;
|
||||||
|
|
||||||
class CustomExtensionGuesserTest extends \PhraseanetPHPUnitAbstract
|
class CustomExtensionGuesserTest extends \PhraseanetTestCase
|
||||||
{
|
{
|
||||||
public function testGuess()
|
public function testGuess()
|
||||||
{
|
{
|
||||||
$conf = array(
|
$conf = [
|
||||||
'mpeg' => 'video/x-romain-neutron',
|
'mpeg' => 'video/x-romain-neutron',
|
||||||
);
|
];
|
||||||
|
|
||||||
$guesser = new CustomExtensionGuesser($conf);
|
$guesser = new CustomExtensionGuesser($conf);
|
||||||
$this->assertNull($guesser->guess(__FILE__));
|
$this->assertNull($guesser->guess(__FILE__));
|
||||||
|
Reference in New Issue
Block a user