aboutsummaryrefslogtreecommitdiffstats
path: root/core/Command/Encryption/SetDefaultModule.php
diff options
context:
space:
mode:
authorRuben Homs <ruben@homs.codes>2018-10-29 15:36:16 +0100
committerRuben Homs <ruben@homs.codes>2019-05-21 09:24:50 +0200
commit98047e8c1cd8c741f4a3d63b970f7e15fa76c128 (patch)
treef9058ccf218d466a04da8f64bb803ee92f4d556d /core/Command/Encryption/SetDefaultModule.php
parent50dbdeea46b3891fad9793899ddcdcf20586f2d7 (diff)
downloadnextcloud-server-98047e8c1cd8c741f4a3d63b970f7e15fa76c128.tar.gz
nextcloud-server-98047e8c1cd8c741f4a3d63b970f7e15fa76c128.zip
Stop decryption when maintenance mode is enabled, fixes #8311
Signed-off-by: Ruben Homs <ruben@homs.codes>
Diffstat (limited to 'core/Command/Encryption/SetDefaultModule.php')
-rw-r--r--core/Command/Encryption/SetDefaultModule.php18
1 files changed, 17 insertions, 1 deletions
diff --git a/core/Command/Encryption/SetDefaultModule.php b/core/Command/Encryption/SetDefaultModule.php
index 1a008c7724a..3399bd45b25 100644
--- a/core/Command/Encryption/SetDefaultModule.php
+++ b/core/Command/Encryption/SetDefaultModule.php
@@ -24,6 +24,7 @@ namespace OC\Core\Command\Encryption;
use OCP\Encryption\IManager;
+use OCP\IConfig;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
@@ -33,12 +34,20 @@ class SetDefaultModule extends Command {
/** @var IManager */
protected $encryptionManager;
+ /** @var IConfig */
+ protected $config;
+
/**
* @param IManager $encryptionManager
+ * @param IConfig $config
*/
- public function __construct(IManager $encryptionManager) {
+ public function __construct(
+ IManager $encryptionManager,
+ IConfig $config
+ ) {
parent::__construct();
$this->encryptionManager = $encryptionManager;
+ $this->config = $config;
}
protected function configure() {
@@ -56,6 +65,13 @@ class SetDefaultModule extends Command {
}
protected function execute(InputInterface $input, OutputInterface $output) {
+ $isMaintenanceModeEnabled = $this->config->getSystemValue('maintenance', false);
+ if ($isMaintenanceModeEnabled) {
+ $output->writeln("Maintenance mode must be disabled when setting default module,");
+ $output->writeln("in order to load the relevant encryption modules correctly.");
+ return;
+ }
+
$moduleId = $input->getArgument('module');
if ($moduleId === $this->encryptionManager->getDefaultEncryptionModuleId()) {