summaryrefslogtreecommitdiffstats
path: root/core/command
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-05-07 12:03:30 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2015-05-07 12:03:30 +0200
commit234429895485c1003cad7e001e7ba88ec13343f5 (patch)
treeaeba0084f5f0ecd5977bdd6a9a7b79dcbbc0d479 /core/command
parent12b24ee567349faa7991b0a86d45e42b67daf43e (diff)
parent10144bd7f5b88e4437cb5be4c05c4a3652a80b1c (diff)
downloadnextcloud-server-234429895485c1003cad7e001e7ba88ec13343f5.tar.gz
nextcloud-server-234429895485c1003cad7e001e7ba88ec13343f5.zip
Merge pull request #16035 from owncloud/issue-15975-occ-encryption-enable-warning-no-module
Display a message when there is a problem with the default module
Diffstat (limited to 'core/command')
-rw-r--r--core/command/encryption/disable.php2
-rw-r--r--core/command/encryption/enable.php26
2 files changed, 24 insertions, 4 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);
+ }
+ }
}
}