mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
Allow API to be used with WebProfiler
This commit is contained in:
@@ -28,6 +28,8 @@ use Alchemy\Phrasea\Core\Provider\JsonSchemaServiceProvider;
|
|||||||
use Monolog\Logger;
|
use Monolog\Logger;
|
||||||
use Monolog\Processor\WebProcessor;
|
use Monolog\Processor\WebProcessor;
|
||||||
use Silex\Application as SilexApplication;
|
use Silex\Application as SilexApplication;
|
||||||
|
use Silex\Provider\WebProfilerServiceProvider;
|
||||||
|
use Sorien\Provider\DoctrineProfilerServiceProvider;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
@@ -125,6 +127,20 @@ return call_user_func(function ($environment = PhraseaApplication::ENV_PROD) {
|
|||||||
$app->mount($app['controller.media_accessor.route_prefix'], new MediaAccessor());
|
$app->mount($app['controller.media_accessor.route_prefix'], new MediaAccessor());
|
||||||
$app->mount('/include/minify/', new Minifier());
|
$app->mount('/include/minify/', new Minifier());
|
||||||
|
|
||||||
|
if (PhraseaApplication::ENV_DEV === $app->getEnvironment()) {
|
||||||
|
$app->register($p = new WebProfilerServiceProvider(), [
|
||||||
|
'profiler.cache_dir' => $app['cache.path'].'/profiler',
|
||||||
|
]);
|
||||||
|
$app->mount('/_profiler', $p);
|
||||||
|
|
||||||
|
if ($app['phraseanet.configuration-tester']->isInstalled()) {
|
||||||
|
$app->register(new DoctrineProfilerServiceProvider());
|
||||||
|
$app['db'] = $app->share(function (PhraseaApplication $app) {
|
||||||
|
return $app['orm.em']->getConnection();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$app['dispatcher'] = $app->share($app->extend('dispatcher', function ($dispatcher, PhraseaApplication $app) {
|
$app['dispatcher'] = $app->share($app->extend('dispatcher', function ($dispatcher, PhraseaApplication $app) {
|
||||||
$dispatcher->addSubscriber(new ApiOauth2ErrorsSubscriber($app['phraseanet.exception_handler'], $app['translator']));
|
$dispatcher->addSubscriber(new ApiOauth2ErrorsSubscriber($app['phraseanet.exception_handler'], $app['translator']));
|
||||||
|
|
||||||
|
@@ -18,7 +18,7 @@ error_reporting(0);
|
|||||||
|
|
||||||
ErrorHandler::register();
|
ErrorHandler::register();
|
||||||
|
|
||||||
$environment = Application::ENV_PROD;
|
$environment = getenv('APP_ENV') ?: Application::ENV_PROD;
|
||||||
$app = require __DIR__ . '/../lib/Alchemy/Phrasea/Application/Api.php';
|
$app = require __DIR__ . '/../lib/Alchemy/Phrasea/Application/Api.php';
|
||||||
|
|
||||||
$app->run();
|
$app->run();
|
||||||
|
Reference in New Issue
Block a user