addOption('write', 'w', null, 'Writes the configuration')
->addOption('enabled', 'e', null, 'Set the enable toggle to `true`')
->addArgument('type', InputArgument::REQUIRED, 'The configuration type, either `nginx` or `apache`')
->setDescription('Generates Phraseanet Static file configuration');
}
/**
* {@inheritdoc}
*/
protected function doExecute(InputInterface $input, OutputInterface $output)
{
$enabled = $input->getOption('enabled');
$type = strtolower($input->getArgument('type'));
$factory = new StaticFileFactory($this->container['monolog'], true, $type, $this->container['phraseanet.thumb-symlinker']);
$mode = $factory->getMode(true);
$conf = array(
'enabled' => $enabled,
'type' => $type,
'mapping' => $mode->getMapping(),
);
if ($input->getOption('write')) {
$output->write("Writing configuration ...");
$this->container['phraseanet.configuration']['static-file'] = $conf;
$output->writeln(" OK");
$output->writeln("");
$output->write("It is now strongly recommended to use static-file:dump-configuration command to upgrade your virtual-host");
} else {
$output->writeln("Configuration will not be written, use --write option to write it");
$output->writeln("");
$output->writeln(Yaml::dump(array('static-file' => $conf), 4));
}
return 0;
}
}