diff options
author | Joas Schilling <nickvergessen@owncloud.com> | 2015-05-04 12:36:50 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@owncloud.com> | 2015-05-04 12:36:50 +0200 |
commit | 10144bd7f5b88e4437cb5be4c05c4a3652a80b1c (patch) | |
tree | 47c155b1ba21a3f1ecb5dbf2b20c1c5496dd6995 /core | |
parent | 17fedc80dac7acd3d85f1f132455e94d4fd920c6 (diff) | |
download | nextcloud-server-10144bd7f5b88e4437cb5be4c05c4a3652a80b1c.tar.gz nextcloud-server-10144bd7f5b88e4437cb5be4c05c4a3652a80b1c.zip |
Display a message when there is a problem with the default module
Diffstat (limited to 'core')
-rw-r--r-- | core/command/encryption/disable.php | 2 | ||||
-rw-r--r-- | core/command/encryption/enable.php | 26 | ||||
-rw-r--r-- | core/register_command.php | 2 |
3 files changed, 25 insertions, 5 deletions
diff --git a/core/command/encryption/disable.php b/core/command/encryption/disable.php index b5fce5cbd90..e3c0b8d7489 100644 --- a/core/command/encryption/disable.php +++ b/core/command/encryption/disable.php @@ -50,7 +50,7 @@ class Disable extends Command { $output->writeln('Encryption is already disabled'); } else { $this->config->setAppValue('core', 'encryption_enabled', 'no'); - $output->writeln('Encryption disabled'); + $output->writeln('<info>Encryption disabled</info>'); } } } diff --git a/core/command/encryption/enable.php b/core/command/encryption/enable.php index 0b403f86a68..b615a7f4f85 100644 --- a/core/command/encryption/enable.php +++ b/core/command/encryption/enable.php @@ -21,6 +21,7 @@ namespace OC\Core\Command\Encryption; +use OCP\Encryption\IManager; use OCP\IConfig; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; @@ -30,11 +31,17 @@ class Enable extends Command { /** @var IConfig */ protected $config; + /** @var IManager */ + protected $encryptionManager; + /** * @param IConfig $config + * @param IManager $encryptionManager */ - public function __construct(IConfig $config) { + public function __construct(IConfig $config, IManager $encryptionManager) { parent::__construct(); + + $this->encryptionManager = $encryptionManager; $this->config = $config; } @@ -50,9 +57,22 @@ class Enable extends Command { $output->writeln('Encryption is already enabled'); } else { $this->config->setAppValue('core', 'encryption_enabled', 'yes'); - $output->writeln('Encryption enabled'); + $output->writeln('<info>Encryption enabled</info>'); } + $output->writeln(''); - $output->writeln('Default module: ' . $this->config->getAppValue('core', 'default_encryption_module', 'OC_DEFAULT_MODULE')); + $modules = $this->encryptionManager->getEncryptionModules(); + if (empty($modules)) { + $output->writeln('<error>No encryption module is loaded</error>'); + } else { + $defaultModule = $this->config->getAppValue('core', 'default_encryption_module', null); + if ($defaultModule === null) { + $output->writeln('<error>No default module is set</error>'); + } else if (!isset($modules[$defaultModule])) { + $output->writeln('<error>The current default module does not exist: ' . $defaultModule . '</error>'); + } else { + $output->writeln('Default module: ' . $defaultModule); + } + } } } diff --git a/core/register_command.php b/core/register_command.php index b9c722860c1..8d18b04bb32 100644 --- a/core/register_command.php +++ b/core/register_command.php @@ -51,7 +51,7 @@ if (\OC::$server->getConfig()->getSystemValue('installed', false)) { $application->add(new OC\Core\Command\Background\WebCron(\OC::$server->getConfig())); $application->add(new OC\Core\Command\Background\Ajax(\OC::$server->getConfig())); $application->add(new OC\Core\Command\Encryption\Disable(\OC::$server->getConfig())); - $application->add(new OC\Core\Command\Encryption\Enable(\OC::$server->getConfig())); + $application->add(new OC\Core\Command\Encryption\Enable(\OC::$server->getConfig(), \OC::$server->getEncryptionManager())); $application->add(new OC\Core\Command\Encryption\ListModules(\OC::$server->getEncryptionManager())); $application->add(new OC\Core\Command\Encryption\SetDefaultModule(\OC::$server->getEncryptionManager())); } else { |