aboutsummaryrefslogtreecommitdiffstats
path: root/core/Command/Maintenance/UpdateHtaccess.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/Command/Maintenance/UpdateHtaccess.php')
-rw-r--r--core/Command/Maintenance/UpdateHtaccess.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/core/Command/Maintenance/UpdateHtaccess.php b/core/Command/Maintenance/UpdateHtaccess.php
new file mode 100644
index 00000000000..eeff3bf8c62
--- /dev/null
+++ b/core/Command/Maintenance/UpdateHtaccess.php
@@ -0,0 +1,31 @@
+<?php
+
+/**
+ * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+namespace OC\Core\Command\Maintenance;
+
+use OC\Setup;
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+
+class UpdateHtaccess extends Command {
+ protected function configure() {
+ $this
+ ->setName('maintenance:update:htaccess')
+ ->setDescription('Updates the .htaccess file');
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output): int {
+ if (Setup::updateHtaccess()) {
+ $output->writeln('.htaccess has been updated');
+ return 0;
+ } else {
+ $output->writeln('<error>Error updating .htaccess file, not enough permissions, not enough free space or "overwrite.cli.url" set to an invalid URL?</error>');
+ return 1;
+ }
+ }
+}