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 XsendfileMapping($app['xsendfile.mapping']); }); $app['phraseanet.file-serve'] = $app->share(function (Application $app) { return ServeFileResponseFactory::create($app); }); $app['dispatcher'] = $app->share( $app->extend('dispatcher', function($dispatcher, Application $app){ $dispatcher->addSubscriber(new XSendFileSubscriber($app)); return $dispatcher; }) ); } /** * {@inheritDoc} */ public function boot(Application $app) { } }