summaryrefslogtreecommitdiffstats
path: root/core/command
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2013-11-25 15:27:05 +0100
committerRobin Appelman <icewind@owncloud.com>2013-11-25 15:27:05 +0100
commita324c09e6cd9d9199642666505f3d77f87478883 (patch)
tree5266b264566d877d33addaf54069ebc3c6d743e7 /core/command
parent71c1327691225a0a517aa3929a48743f95b177d0 (diff)
downloadnextcloud-server-a324c09e6cd9d9199642666505f3d77f87478883.tar.gz
nextcloud-server-a324c09e6cd9d9199642666505f3d77f87478883.zip
Add occ command to enable and disable single user mode
Diffstat (limited to 'core/command')
-rw-r--r--core/command/maintenance/singleuser.php51
1 files changed, 51 insertions, 0 deletions
diff --git a/core/command/maintenance/singleuser.php b/core/command/maintenance/singleuser.php
new file mode 100644
index 00000000000..f9a1bbcaca6
--- /dev/null
+++ b/core/command/maintenance/singleuser.php
@@ -0,0 +1,51 @@
+<?php
+/**
+ * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Core\Command\Maintenance;
+
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+class SingleUser extends Command {
+
+ protected function configure() {
+ $this
+ ->setName('maintenance:singleuser')
+ ->setDescription('set single user mode')
+ ->addOption(
+ 'on',
+ null,
+ InputOption::VALUE_NONE,
+ 'enable single user mode'
+ )
+ ->addOption(
+ 'off',
+ null,
+ InputOption::VALUE_NONE,
+ 'disable single user mode'
+ );
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output) {
+ if ($input->getOption('on')) {
+ \OC_Config::setValue('singleuser', true);
+ $output->writeln('Single user mode enabled');
+ } elseif ($input->getOption('off')) {
+ \OC_Config::setValue('singleuser', false);
+ $output->writeln('Single user mode disabled');
+ } else {
+ if (\OC_Config::getValue('singleuser', false)) {
+ $output->writeln('Single user mode is currently enabled');
+ } else {
+ $output->writeln('Single user mode is currently disabled');
+ }
+ }
+ }
+}