/**
  * {@inheritdoc}
  */
 protected function doExecute(InputInterface $input, OutputInterface $output)
 {
     $paths = $this->extractPath($this->container->getApplicationBox());
     foreach ($paths as $path) {
         $this->container['filesystem']->mkdir($path);
     }
     $type = strtolower($input->getArgument('type'));
     $enabled = $input->getOption('enabled');
     $factory = new H264Factory($this->container['monolog'], true, $type, $this->computeMapping($paths));
     $mode = $factory->createMode(true);
     $currentConf = isset($this->container['phraseanet.configuration']['h264-pseudo-streaming']) ? $this->container['phraseanet.configuration']['h264-pseudo-streaming'] : [];
     $currentMapping = isset($currentConf['mapping']) && is_array($currentConf['mapping']) ? $currentConf['mapping'] : [];
     $conf = ['enabled' => $enabled, 'type' => $type, 'mapping' => $mode->getMapping()];
     if ($input->getOption('write')) {
         $output->write("Writing configuration ...");
         $this->container['phraseanet.configuration']['h264-pseudo-streaming'] = $conf;
         $output->writeln(" <info>OK</info>");
         $output->writeln("");
         $output->write("It is now strongly recommended to use <info>h264-pseudo-streaming: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(['h264-pseudo-streaming' => $conf], 4));
     }
     return 0;
 }
 /**
  * {@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);
     });
 }
Example #3
0
 /**
  * @dataProvider provideTypes
  */
 public function testFactoryType($type, $mapping, $classmode)
 {
     $logger = $this->getMock('Psr\\Log\\LoggerInterface');
     $factory = new H264Factory($logger, true, $type, $mapping);
     $this->assertInstanceOf($classmode, $factory->createMode());
 }