mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 23:13:15 +00:00
Improve Xsendfile tools, allow dump whenever the conf is disabled
This commit is contained in:
@@ -33,27 +33,26 @@ class XSendFileConfigurationDumper extends Command
|
||||
$output->writeln('');
|
||||
|
||||
if (!$this->container['phraseanet.xsendfile-factory']->isXSendFileModeEnabled()) {
|
||||
$output->writeln('XSendFile support is <error>disabled</error>');
|
||||
|
||||
return 1;
|
||||
$output->writeln('XSendFile support is <error>disabled</error>, enable it to use this feature.');
|
||||
$ret = 1;
|
||||
} else {
|
||||
$output->writeln('XSendFile support is <info>enabled</info>');
|
||||
$ret = 0;
|
||||
}
|
||||
|
||||
$output->writeln('XSendFile support is <info>enabled</info>');
|
||||
|
||||
try {
|
||||
$configuration = $this->container['phraseanet.xsendfile-factory']->getMode(true)->getVirtualHostConfiguration();
|
||||
$configuration = $this->container['phraseanet.xsendfile-factory']->getMode(true, true)->getVirtualHostConfiguration();
|
||||
$output->writeln('XSendFile configuration seems <info>OK</info>');
|
||||
$output->writeln($configuration);
|
||||
|
||||
return 0;
|
||||
} catch (RuntimeException $e) {
|
||||
$output->writeln('XSendFile configuration seems <error>invalid</error>');
|
||||
|
||||
return 1;
|
||||
$ret = 1;
|
||||
}
|
||||
|
||||
$output->writeln('');
|
||||
|
||||
return 0;
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
@@ -56,13 +56,15 @@ class XSendFileMappingGenerator extends Command
|
||||
$this->container['phraseanet.configuration']['xsendfile'] = $conf;
|
||||
$output->writeln(" <info>OK</info>");
|
||||
$output->writeln("");
|
||||
$output->write("It is now strongly recommended to use <info>xsendfile:dump-configuration</info> command to upgrade your virtual-host");
|
||||
$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(array('xsendfile' => $conf), 4));
|
||||
}
|
||||
|
||||
$output->writeln("");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -66,9 +66,9 @@ class XSendFileFactory
|
||||
*
|
||||
* @throws InvalidArgumentException if mode type is unknown
|
||||
*/
|
||||
public function getMode($throwException = false)
|
||||
public function getMode($throwException = false, $forceMode = false)
|
||||
{
|
||||
if (false === $this->enabled) {
|
||||
if (false === $this->enabled && true !== $forceMode) {
|
||||
return new NullMode();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user