[Pkg-owncloud-commits] [owncloud] 113/239: Add occ command to enable and disable single user mode

David Prévot taffit at moszumanska.debian.org
Fri Nov 29 01:32:26 UTC 2013


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit a324c09e6cd9d9199642666505f3d77f87478883
Author: Robin Appelman <icewind at owncloud.com>
Date:   Mon Nov 25 15:27:05 2013 +0100

    Add occ command to enable and disable single user mode
---
 core/command/maintenance/singleuser.php | 51 +++++++++++++++++++++++++++++++++
 core/register_command.php               |  1 +
 2 files changed, 52 insertions(+)

diff --git a/core/command/maintenance/singleuser.php b/core/command/maintenance/singleuser.php
new file mode 100644
index 0000000..f9a1bbc
--- /dev/null
+++ b/core/command/maintenance/singleuser.php
@@ -0,0 +1,51 @@
+<?php
+/**
+ * Copyright (c) 2013 Robin Appelman <icewind at 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');
+			}
+		}
+	}
+}
diff --git a/core/register_command.php b/core/register_command.php
index cfea1a6..2f351b6 100644
--- a/core/register_command.php
+++ b/core/register_command.php
@@ -10,3 +10,4 @@
 $application->add(new OC\Core\Command\Status);
 $application->add(new OC\Core\Command\Db\GenerateChangeScript());
 $application->add(new OC\Core\Command\Upgrade());
+$application->add(new OC\Core\Command\Maintenance\SingleUser());

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list