/** * {@inheritdoc} */ protected function doExecute(InputInterface $input, OutputInterface $output) { $paths = $this->extractPath($this->container['phraseanet.appbox']); foreach ($paths as $path) { $this->container['filesystem']->mkdir($path); } $type = strtolower($input->getArgument('type')); $enabled = $input->getOption('enabled'); $factory = new XSendFileFactory($this->container['monolog'], true, $type, $this->computeMapping($paths)); $mode = $factory->getMode(true); $conf = ['enabled' => $enabled, 'type' => $type, 'mapping' => $mode->getMapping()]; if ($input->getOption('write')) { $output->write("Writing configuration ..."); $this->container['conf']->set('xsendfile', $conf); $output->writeln(" <info>OK</info>"); $output->writeln(""); $output->writeln("It is now strongly recommended to use <info>xsendfile:dump-configuration</info> command to upgrade your virtual-host"); } else { $output->writeln("Configuration will <info>not</info> be written, use <info>--write</info> option to write it"); $output->writeln(""); $output->writeln(Yaml::dump(['xsendfile' => $conf], 4)); } $output->writeln(""); return 0; }
public function testInvalidMappingDoesNotThrowsAnExceptionByDefault() { $logger = $this->getMock('Psr\\Log\\LoggerInterface'); $logger->expects($this->once())->method('error')->with($this->isType('string')); $factory = new XSendFileFactory($logger, true, 'nginx', []); $this->assertInstanceOf('Alchemy\\Phrasea\\Http\\XSendFile\\NginxMode', $factory->getMode()); }
/** * {@inheritDoc} */ public function register(Application $app) { $app['phraseanet.xsendfile-factory'] = $app->share(function ($app) { return XSendFileFactory::create($app); }); $app['phraseanet.file-serve'] = $app->share(function (Application $app) { return ServeFileResponseFactory::create($app); }); }
/** * {@inheritDoc} */ public function register(Application $app) { $app['phraseanet.xsendfile-factory'] = $app->share(function ($app) { return XSendFileFactory::create($app); }); $app['phraseanet.h264-factory'] = $app->share(function ($app) { return H264Factory::create($app); }); $app['phraseanet.h264'] = $app->share(function ($app) { return $app['phraseanet.h264-factory']->createMode(false); }); $app['phraseanet.static-file'] = $app->share(function (Application $app) { return new StaticMode(SymLinker::create($app)); }); $app['phraseanet.file-serve'] = $app->share(function (Application $app) { return ServeFileResponseFactory::create($app); }); }