Disable.php 1021 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OC\Core\Command\Encryption;
  8. use OCP\IConfig;
  9. use Symfony\Component\Console\Command\Command;
  10. use Symfony\Component\Console\Input\InputInterface;
  11. use Symfony\Component\Console\Output\OutputInterface;
  12. class Disable extends Command {
  13. public function __construct(
  14. protected IConfig $config,
  15. ) {
  16. parent::__construct();
  17. }
  18. protected function configure() {
  19. $this
  20. ->setName('encryption:disable')
  21. ->setDescription('Disable encryption')
  22. ;
  23. }
  24. protected function execute(InputInterface $input, OutputInterface $output): int {
  25. if ($this->config->getAppValue('core', 'encryption_enabled', 'no') !== 'yes') {
  26. $output->writeln('Encryption is already disabled');
  27. } else {
  28. $this->config->setAppValue('core', 'encryption_enabled', 'no');
  29. $output->writeln('<info>Encryption disabled</info>');
  30. }
  31. return 0;
  32. }
  33. }