UpdateHtaccess.php 936 B

123456789101112131415161718192021222324252627282930
  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\Maintenance;
  8. use Symfony\Component\Console\Command\Command;
  9. use Symfony\Component\Console\Input\InputInterface;
  10. use Symfony\Component\Console\Output\OutputInterface;
  11. class UpdateHtaccess extends Command {
  12. protected function configure() {
  13. $this
  14. ->setName('maintenance:update:htaccess')
  15. ->setDescription('Updates the .htaccess file');
  16. }
  17. protected function execute(InputInterface $input, OutputInterface $output): int {
  18. if (\OC\Setup::updateHtaccess()) {
  19. $output->writeln('.htaccess has been updated');
  20. return 0;
  21. } else {
  22. $output->writeln('<error>Error updating .htaccess file, not enough permissions, not enough free space or "overwrite.cli.url" set to an invalid URL?</error>');
  23. return 1;
  24. }
  25. }
  26. }