summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2015-04-20 11:11:52 +0200
committerJoas Schilling <nickvergessen@owncloud.com>2015-04-27 11:03:51 +0200
commitd600955a51a9536ac9ebfa7198ef963679153740 (patch)
tree3ff846f2b2e049de80c36bd2721bfa58eebb64a5 /core
parent4e97228cde0016439b4cad9b118fae7380fb0874 (diff)
downloadnextcloud-server-d600955a51a9536ac9ebfa7198ef963679153740.tar.gz
nextcloud-server-d600955a51a9536ac9ebfa7198ef963679153740.zip
Make getDefaultModuleId public and get module protected
Diffstat (limited to 'core')
-rw-r--r--core/command/encryption/listmodules.php34
-rw-r--r--core/command/encryption/setdefaultmodule.php11
2 files changed, 14 insertions, 31 deletions
diff --git a/core/command/encryption/listmodules.php b/core/command/encryption/listmodules.php
index d3fdb2d3b00..a3de26b608c 100644
--- a/core/command/encryption/listmodules.php
+++ b/core/command/encryption/listmodules.php
@@ -49,16 +49,12 @@ class ListModules extends Base {
protected function execute(InputInterface $input, OutputInterface $output) {
$encryptionModules = $this->encryptionManager->getEncryptionModules();
- $defaultEncryptionModuleId = '';
- try {
- $defaultEncryptionModule = $this->encryptionManager->getDefaultEncryptionModule();
- $defaultEncryptionModuleId = $defaultEncryptionModule->getId();
- } catch (\Exception $e) {}
+ $defaultEncryptionModuleId = $this->encryptionManager->getDefaultEncryptionModuleId();
$encModules = array();
foreach ($encryptionModules as $module) {
- $encModules[$module->getId()]['displayName'] = $module->getDisplayName();
- $encModules[$module->getId()]['default'] .= $module->getId() === $defaultEncryptionModuleId;
+ $encModules[$module['id']]['displayName'] = $module['displayName'];
+ $encModules[$module['id']]['default'] .= $module['id'] === $defaultEncryptionModuleId;
}
$this->writeModuleList($input, $output, $encModules);
}
@@ -69,20 +65,16 @@ class ListModules extends Base {
* @param array $items
*/
protected function writeModuleList(InputInterface $input, OutputInterface $output, $items) {
- switch ($input->getOption('output')) {
- case 'plain':
- array_walk($items, function(&$item) {
- if (!$item['default']) {
- $item = $item['displayName'];
- } else {
- $item = $item['displayName'] . ' [default*]';
- }
- });
- // no break;
-
- default:
- parent::writeArrayInOutputFormat($input, $output, $items);
- break;
+ if ($input->getOption('output') === 'plain') {
+ array_walk($items, function(&$item) {
+ if (!$item['default']) {
+ $item = $item['displayName'];
+ } else {
+ $item = $item['displayName'] . ' [default*]';
+ }
+ });
}
+
+ parent::writeArrayInOutputFormat($input, $output, $items);
}
}
diff --git a/core/command/encryption/setdefaultmodule.php b/core/command/encryption/setdefaultmodule.php
index fb82e876c99..f33762ef49a 100644
--- a/core/command/encryption/setdefaultmodule.php
+++ b/core/command/encryption/setdefaultmodule.php
@@ -56,22 +56,13 @@ class SetDefaultModule extends Command {
protected function execute(InputInterface $input, OutputInterface $output) {
$moduleId = $input->getArgument('module');
- $currentDefaultModuleId = '';
- try {
- $currentDefaultModule = $this->encryptionManager->getDefaultEncryptionModule();
- $currentDefaultModuleId = $currentDefaultModule->getId();
- } catch (\Exception $e) {}
- if ($moduleId === $currentDefaultModuleId) {
+ if ($moduleId === $this->encryptionManager->getDefaultEncryptionModuleId()) {
$output->writeln('"' . $moduleId . '"" is already the default module');
} else if ($this->encryptionManager->setDefaultEncryptionModule($moduleId)) {
$output->writeln('Set default module to "' . $moduleId . '"');
} else {
$output->writeln('The specified module "' . $moduleId . '" does not exist');
}
-
- if ($moduleId === $currentDefaultModuleId) {
- }
-
}
}