Move crossdomain generator command to bin/setup

This commit is contained in:
Nicolas Le Goff
2014-09-05 18:08:36 +02:00
parent 74a32e1ee4
commit 8189010d9b
3 changed files with 10 additions and 6 deletions

View File

@@ -17,7 +17,6 @@ namespace KonsoleKommander;
* @link www.phraseanet.com * @link www.phraseanet.com
*/ */
use Alchemy\Phrasea\Command\Plugin\ListPlugin; use Alchemy\Phrasea\Command\Plugin\ListPlugin;
use Alchemy\Phrasea\Command\Setup\CrossDomainGenerator;
use Alchemy\Phrasea\Command\Setup\H264ConfigurationDumper; use Alchemy\Phrasea\Command\Setup\H264ConfigurationDumper;
use Alchemy\Phrasea\Command\Setup\H264MappingGenerator; use Alchemy\Phrasea\Command\Setup\H264MappingGenerator;
use Alchemy\Phrasea\Core\Version; use Alchemy\Phrasea\Core\Version;
@@ -105,7 +104,6 @@ $cli->command(new H264ConfigurationDumper());
$cli->command(new H264MappingGenerator()); $cli->command(new H264MappingGenerator());
$cli->command(new XSendFileConfigurationDumper()); $cli->command(new XSendFileConfigurationDumper());
$cli->command(new XSendFileMappingGenerator()); $cli->command(new XSendFileMappingGenerator());
$cli->command(new CrossDomainGenerator());
$cli->loadPlugins(); $cli->loadPlugins();

View File

@@ -19,6 +19,7 @@ namespace KonsoleKommander;
use Alchemy\Phrasea\Core\Version; use Alchemy\Phrasea\Core\Version;
use Alchemy\Phrasea\Command\UpgradeDBDatas; use Alchemy\Phrasea\Command\UpgradeDBDatas;
use Alchemy\Phrasea\Command\Setup\Install; use Alchemy\Phrasea\Command\Setup\Install;
use Alchemy\Phrasea\Command\Setup\CrossDomainGenerator;
use Alchemy\Phrasea\Command\Setup\PluginsReset; use Alchemy\Phrasea\Command\Setup\PluginsReset;
use Alchemy\Phrasea\Command\Plugin\ListPlugin; use Alchemy\Phrasea\Command\Plugin\ListPlugin;
use Alchemy\Phrasea\Command\Plugin\AddPlugin; use Alchemy\Phrasea\Command\Plugin\AddPlugin;
@@ -69,5 +70,6 @@ $app->command(new RemovePlugin());
$app->command(new PluginsReset()); $app->command(new PluginsReset());
$app->command(new CheckEnvironment('check:system')); $app->command(new CheckEnvironment('check:system'));
$app->command(new Install('system:install')); $app->command(new Install('system:install'));
$app->command(new CrossDomainGenerator());
exit(is_int($app->run()) ? : 1); exit(is_int($app->run()) ? : 1);

View File

@@ -15,6 +15,7 @@ use Alchemy\Phrasea\Command\Command;
use Alchemy\Phrasea\Utilities\CrossDomainDumper; use Alchemy\Phrasea\Utilities\CrossDomainDumper;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Yaml\Yaml;
class CrossDomainGenerator extends Command class CrossDomainGenerator extends Command
{ {
@@ -30,13 +31,16 @@ class CrossDomainGenerator extends Command
*/ */
protected function doExecute(InputInterface $input, OutputInterface $output) protected function doExecute(InputInterface $input, OutputInterface $output)
{ {
if ($this->container['phraseanet.configuration-tester']->isInstalled()) {
$configuration = $this->container['phraseanet.configuration']['crossdomain']; $configuration = $this->container['phraseanet.configuration']['crossdomain'];
} else {
$default = Yaml::parse($this->container['root.path'].'/lib/conf.d/configuration.yml');
$configuration = $default['crossdomain'];
}
$dumper = new CrossDomainDumper(); $dumper = new CrossDomainDumper();
$xml = $dumper->dump($configuration); $xml = $dumper->dump($configuration);
$output->writeln("Generating crossdomain.xml");
$output->writeln($xml);
$this->container['filesystem']->dumpFile($this->container['root.path'].'/www/crossdomain.xml', $xml); $this->container['filesystem']->dumpFile($this->container['root.path'].'/www/crossdomain.xml', $xml);