Passed
Push — master ( 0c0397...46bfe3 )
by Roeland
21:08 queued 10:02
created
core/Command/Background/Base.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -37,39 +37,39 @@
 block discarded – undo
37 37
  * Subclasses will override the getMode() function to specify the mode to configure.
38 38
  */
39 39
 abstract class Base extends Command {
40
-	abstract protected function getMode();
40
+    abstract protected function getMode();
41 41
 
42
-	/**
43
-	 * @var \OCP\IConfig
44
-	 */
45
-	protected $config;
42
+    /**
43
+     * @var \OCP\IConfig
44
+     */
45
+    protected $config;
46 46
 
47
-	/**
48
-	 * @param \OCP\IConfig $config
49
-	 */
50
-	public function __construct(IConfig $config) {
51
-		$this->config = $config;
52
-		parent::__construct();
53
-	}
47
+    /**
48
+     * @param \OCP\IConfig $config
49
+     */
50
+    public function __construct(IConfig $config) {
51
+        $this->config = $config;
52
+        parent::__construct();
53
+    }
54 54
 
55
-	protected function configure() {
56
-		$mode = $this->getMode();
57
-		$this
58
-			->setName("background:$mode")
59
-			->setDescription("Use $mode to run background jobs");
60
-	}
55
+    protected function configure() {
56
+        $mode = $this->getMode();
57
+        $this
58
+            ->setName("background:$mode")
59
+            ->setDescription("Use $mode to run background jobs");
60
+    }
61 61
 
62
-	/**
63
-	 * Executing this command will set the background job mode for owncloud.
64
-	 * The mode to set is specified by the concrete sub class by implementing the
65
-	 * getMode() function.
66
-	 *
67
-	 * @param InputInterface $input
68
-	 * @param OutputInterface $output
69
-	 */
70
-	protected function execute(InputInterface $input, OutputInterface $output) {
71
-		$mode = $this->getMode();
72
-		$this->config->setAppValue('core', 'backgroundjobs_mode', $mode);
73
-		$output->writeln("Set mode for background jobs to '$mode'");
74
-	}
62
+    /**
63
+     * Executing this command will set the background job mode for owncloud.
64
+     * The mode to set is specified by the concrete sub class by implementing the
65
+     * getMode() function.
66
+     *
67
+     * @param InputInterface $input
68
+     * @param OutputInterface $output
69
+     */
70
+    protected function execute(InputInterface $input, OutputInterface $output) {
71
+        $mode = $this->getMode();
72
+        $this->config->setAppValue('core', 'backgroundjobs_mode', $mode);
73
+        $output->writeln("Set mode for background jobs to '$mode'");
74
+    }
75 75
 }
Please login to merge, or discard this patch.
core/Command/Background/Cron.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
 namespace OC\Core\Command\Background;
27 27
 
28 28
 class Cron extends Base {
29
-	protected function getMode() {
30
-		return 'cron';
31
-	}
29
+    protected function getMode() {
30
+        return 'cron';
31
+    }
32 32
 }
Please login to merge, or discard this patch.
core/Command/Background/WebCron.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
 namespace OC\Core\Command\Background;
27 27
 
28 28
 class WebCron extends Base {
29
-	protected function getMode() {
30
-		return 'webcron';
31
-	}
29
+    protected function getMode() {
30
+        return 'webcron';
31
+    }
32 32
 }
Please login to merge, or discard this patch.
core/Command/Config/System/GetConfig.php 1 patch
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -29,72 +29,72 @@
 block discarded – undo
29 29
 use Symfony\Component\Console\Output\OutputInterface;
30 30
 
31 31
 class GetConfig extends Base {
32
-	/** * @var SystemConfig */
33
-	protected $systemConfig;
32
+    /** * @var SystemConfig */
33
+    protected $systemConfig;
34 34
 
35
-	/**
36
-	 * @param SystemConfig $systemConfig
37
-	 */
38
-	public function __construct(SystemConfig $systemConfig) {
39
-		parent::__construct();
40
-		$this->systemConfig = $systemConfig;
41
-	}
35
+    /**
36
+     * @param SystemConfig $systemConfig
37
+     */
38
+    public function __construct(SystemConfig $systemConfig) {
39
+        parent::__construct();
40
+        $this->systemConfig = $systemConfig;
41
+    }
42 42
 
43
-	protected function configure() {
44
-		parent::configure();
43
+    protected function configure() {
44
+        parent::configure();
45 45
 
46
-		$this
47
-			->setName('config:system:get')
48
-			->setDescription('Get a system config value')
49
-			->addArgument(
50
-				'name',
51
-				InputArgument::REQUIRED | InputArgument::IS_ARRAY,
52
-				'Name of the config to get, specify multiple for array parameter'
53
-			)
54
-			->addOption(
55
-				'default-value',
56
-				null,
57
-				InputOption::VALUE_OPTIONAL,
58
-				'If no default value is set and the config does not exist, the command will exit with 1'
59
-			)
60
-		;
61
-	}
46
+        $this
47
+            ->setName('config:system:get')
48
+            ->setDescription('Get a system config value')
49
+            ->addArgument(
50
+                'name',
51
+                InputArgument::REQUIRED | InputArgument::IS_ARRAY,
52
+                'Name of the config to get, specify multiple for array parameter'
53
+            )
54
+            ->addOption(
55
+                'default-value',
56
+                null,
57
+                InputOption::VALUE_OPTIONAL,
58
+                'If no default value is set and the config does not exist, the command will exit with 1'
59
+            )
60
+        ;
61
+    }
62 62
 
63
-	/**
64
-	 * Executes the current command.
65
-	 *
66
-	 * @param InputInterface  $input  An InputInterface instance
67
-	 * @param OutputInterface $output An OutputInterface instance
68
-	 * @return null|int null or 0 if everything went fine, or an error code
69
-	 */
70
-	protected function execute(InputInterface $input, OutputInterface $output) {
71
-		$configNames = $input->getArgument('name');
72
-		$configName = array_shift($configNames);
73
-		$defaultValue = $input->getOption('default-value');
63
+    /**
64
+     * Executes the current command.
65
+     *
66
+     * @param InputInterface  $input  An InputInterface instance
67
+     * @param OutputInterface $output An OutputInterface instance
68
+     * @return null|int null or 0 if everything went fine, or an error code
69
+     */
70
+    protected function execute(InputInterface $input, OutputInterface $output) {
71
+        $configNames = $input->getArgument('name');
72
+        $configName = array_shift($configNames);
73
+        $defaultValue = $input->getOption('default-value');
74 74
 
75
-		if (!in_array($configName, $this->systemConfig->getKeys()) && !$input->hasParameterOption('--default-value')) {
76
-			return 1;
77
-		}
75
+        if (!in_array($configName, $this->systemConfig->getKeys()) && !$input->hasParameterOption('--default-value')) {
76
+            return 1;
77
+        }
78 78
 
79
-		if (!in_array($configName, $this->systemConfig->getKeys())) {
80
-			$configValue = $defaultValue;
81
-		} else {
82
-			$configValue = $this->systemConfig->getValue($configName);
83
-			if (!empty($configNames)) {
84
-				foreach ($configNames as $configName) {
85
-					if (isset($configValue[$configName])) {
86
-						$configValue = $configValue[$configName];
87
-					} elseif (!$input->hasParameterOption('--default-value')) {
88
-						return 1;
89
-					} else {
90
-						$configValue = $defaultValue;
91
-						break;
92
-					}
93
-				}
94
-			}
95
-		}
79
+        if (!in_array($configName, $this->systemConfig->getKeys())) {
80
+            $configValue = $defaultValue;
81
+        } else {
82
+            $configValue = $this->systemConfig->getValue($configName);
83
+            if (!empty($configNames)) {
84
+                foreach ($configNames as $configName) {
85
+                    if (isset($configValue[$configName])) {
86
+                        $configValue = $configValue[$configName];
87
+                    } elseif (!$input->hasParameterOption('--default-value')) {
88
+                        return 1;
89
+                    } else {
90
+                        $configValue = $defaultValue;
91
+                        break;
92
+                    }
93
+                }
94
+            }
95
+        }
96 96
 
97
-		$this->writeMixedInOutputFormat($input, $output, $configValue);
98
-		return 0;
99
-	}
97
+        $this->writeMixedInOutputFormat($input, $output, $configValue);
98
+        return 0;
99
+    }
100 100
 }
Please login to merge, or discard this patch.
core/Command/Status.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -28,23 +28,23 @@
 block discarded – undo
28 28
 use Symfony\Component\Console\Output\OutputInterface;
29 29
 
30 30
 class Status extends Base {
31
-	protected function configure() {
32
-		parent::configure();
31
+    protected function configure() {
32
+        parent::configure();
33 33
 
34
-		$this
35
-			->setName('status')
36
-			->setDescription('show some status information')
37
-		;
38
-	}
34
+        $this
35
+            ->setName('status')
36
+            ->setDescription('show some status information')
37
+        ;
38
+    }
39 39
 
40
-	protected function execute(InputInterface $input, OutputInterface $output) {
41
-		$values = [
42
-			'installed' => (bool) \OC::$server->getConfig()->getSystemValue('installed', false),
43
-			'version' => implode('.', \OCP\Util::getVersion()),
44
-			'versionstring' => \OC_Util::getVersionString(),
45
-			'edition' => '',
46
-		];
40
+    protected function execute(InputInterface $input, OutputInterface $output) {
41
+        $values = [
42
+            'installed' => (bool) \OC::$server->getConfig()->getSystemValue('installed', false),
43
+            'version' => implode('.', \OCP\Util::getVersion()),
44
+            'versionstring' => \OC_Util::getVersionString(),
45
+            'edition' => '',
46
+        ];
47 47
 
48
-		$this->writeArrayInOutputFormat($input, $output, $values);
49
-	}
48
+        $this->writeArrayInOutputFormat($input, $output, $values);
49
+    }
50 50
 }
Please login to merge, or discard this patch.
core/Command/User/Report.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -32,56 +32,56 @@
 block discarded – undo
32 32
 use Symfony\Component\Console\Output\OutputInterface;
33 33
 
34 34
 class Report extends Command {
35
-	/** @var IUserManager */
36
-	protected $userManager;
35
+    /** @var IUserManager */
36
+    protected $userManager;
37 37
 
38
-	/**
39
-	 * @param IUserManager $userManager
40
-	 */
41
-	public function __construct(IUserManager $userManager) {
42
-		$this->userManager = $userManager;
43
-		parent::__construct();
44
-	}
38
+    /**
39
+     * @param IUserManager $userManager
40
+     */
41
+    public function __construct(IUserManager $userManager) {
42
+        $this->userManager = $userManager;
43
+        parent::__construct();
44
+    }
45 45
 
46
-	protected function configure() {
47
-		$this
48
-			->setName('user:report')
49
-			->setDescription('shows how many users have access');
50
-	}
46
+    protected function configure() {
47
+        $this
48
+            ->setName('user:report')
49
+            ->setDescription('shows how many users have access');
50
+    }
51 51
 
52
-	protected function execute(InputInterface $input, OutputInterface $output) {
53
-		$table = new Table($output);
54
-		$table->setHeaders(['User Report', '']);
55
-		$userCountArray = $this->countUsers();
56
-		if (!empty($userCountArray)) {
57
-			$total = 0;
58
-			$rows = [];
59
-			foreach ($userCountArray as $classname => $users) {
60
-				$total += $users;
61
-				$rows[] = [$classname, $users];
62
-			}
52
+    protected function execute(InputInterface $input, OutputInterface $output) {
53
+        $table = new Table($output);
54
+        $table->setHeaders(['User Report', '']);
55
+        $userCountArray = $this->countUsers();
56
+        if (!empty($userCountArray)) {
57
+            $total = 0;
58
+            $rows = [];
59
+            foreach ($userCountArray as $classname => $users) {
60
+                $total += $users;
61
+                $rows[] = [$classname, $users];
62
+            }
63 63
 
64
-			$rows[] = [' '];
65
-			$rows[] = ['total users', $total];
66
-		} else {
67
-			$rows[] = ['No backend enabled that supports user counting', ''];
68
-		}
64
+            $rows[] = [' '];
65
+            $rows[] = ['total users', $total];
66
+        } else {
67
+            $rows[] = ['No backend enabled that supports user counting', ''];
68
+        }
69 69
 
70
-		$userDirectoryCount = $this->countUserDirectories();
71
-		$rows[] = [' '];
72
-		$rows[] = ['user directories', $userDirectoryCount];
70
+        $userDirectoryCount = $this->countUserDirectories();
71
+        $rows[] = [' '];
72
+        $rows[] = ['user directories', $userDirectoryCount];
73 73
 
74
-		$table->setRows($rows);
75
-		$table->render();
76
-	}
74
+        $table->setRows($rows);
75
+        $table->render();
76
+    }
77 77
 
78
-	private function countUsers() {
79
-		return $this->userManager->countUsers();
80
-	}
78
+    private function countUsers() {
79
+        return $this->userManager->countUsers();
80
+    }
81 81
 
82
-	private function countUserDirectories() {
83
-		$dataview = new \OC\Files\View('/');
84
-		$userDirectories = $dataview->getDirectoryContent('/', 'httpd/unix-directory');
85
-		return count($userDirectories);
86
-	}
82
+    private function countUserDirectories() {
83
+        $dataview = new \OC\Files\View('/');
84
+        $userDirectories = $dataview->getDirectoryContent('/', 'httpd/unix-directory');
85
+        return count($userDirectories);
86
+    }
87 87
 }
Please login to merge, or discard this patch.
core/Command/Check.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -28,35 +28,35 @@
 block discarded – undo
28 28
 use Symfony\Component\Console\Output\OutputInterface;
29 29
 
30 30
 class Check extends Base {
31
-	/**
32
-	 * @var SystemConfig
33
-	 */
34
-	private $config;
31
+    /**
32
+     * @var SystemConfig
33
+     */
34
+    private $config;
35 35
 
36
-	public function __construct(SystemConfig $config) {
37
-		parent::__construct();
38
-		$this->config = $config;
39
-	}
36
+    public function __construct(SystemConfig $config) {
37
+        parent::__construct();
38
+        $this->config = $config;
39
+    }
40 40
 
41
-	protected function configure() {
42
-		parent::configure();
41
+    protected function configure() {
42
+        parent::configure();
43 43
 
44
-		$this
45
-			->setName('check')
46
-			->setDescription('check dependencies of the server environment')
47
-		;
48
-	}
44
+        $this
45
+            ->setName('check')
46
+            ->setDescription('check dependencies of the server environment')
47
+        ;
48
+    }
49 49
 
50
-	protected function execute(InputInterface $input, OutputInterface $output) {
51
-		$errors = \OC_Util::checkServer($this->config);
52
-		if (!empty($errors)) {
53
-			$errors = array_map(function ($item) {
54
-				return (string) $item['error'];
55
-			}, $errors);
50
+    protected function execute(InputInterface $input, OutputInterface $output) {
51
+        $errors = \OC_Util::checkServer($this->config);
52
+        if (!empty($errors)) {
53
+            $errors = array_map(function ($item) {
54
+                return (string) $item['error'];
55
+            }, $errors);
56 56
 
57
-			$this->writeArrayInOutputFormat($input, $output, $errors);
58
-			return 1;
59
-		}
60
-		return 0;
61
-	}
57
+            $this->writeArrayInOutputFormat($input, $output, $errors);
58
+            return 1;
59
+        }
60
+        return 0;
61
+    }
62 62
 }
Please login to merge, or discard this patch.
core/Command/Encryption/ShowKeyStorageRoot.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -30,29 +30,29 @@
 block discarded – undo
30 30
 
31 31
 class ShowKeyStorageRoot extends Command {
32 32
 
33
-	/** @var Util  */
34
-	protected $util;
35
-
36
-	/**
37
-	 * @param Util $util
38
-	 */
39
-	public function __construct(Util $util) {
40
-		parent::__construct();
41
-		$this->util = $util;
42
-	}
43
-
44
-	protected function configure() {
45
-		parent::configure();
46
-		$this
47
-			->setName('encryption:show-key-storage-root')
48
-			->setDescription('Show current key storage root');
49
-	}
50
-
51
-	protected function execute(InputInterface $input, OutputInterface $output) {
52
-		$currentRoot = $this->util->getKeyStorageRoot();
53
-
54
-		$rootDescription = $currentRoot !== '' ? $currentRoot : 'default storage location (data/)';
55
-
56
-		$output->writeln("Current key storage root:  <info>$rootDescription</info>");
57
-	}
33
+    /** @var Util  */
34
+    protected $util;
35
+
36
+    /**
37
+     * @param Util $util
38
+     */
39
+    public function __construct(Util $util) {
40
+        parent::__construct();
41
+        $this->util = $util;
42
+    }
43
+
44
+    protected function configure() {
45
+        parent::configure();
46
+        $this
47
+            ->setName('encryption:show-key-storage-root')
48
+            ->setDescription('Show current key storage root');
49
+    }
50
+
51
+    protected function execute(InputInterface $input, OutputInterface $output) {
52
+        $currentRoot = $this->util->getKeyStorageRoot();
53
+
54
+        $rootDescription = $currentRoot !== '' ? $currentRoot : 'default storage location (data/)';
55
+
56
+        $output->writeln("Current key storage root:  <info>$rootDescription</info>");
57
+    }
58 58
 }
Please login to merge, or discard this patch.
core/Command/Encryption/Enable.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -29,51 +29,51 @@
 block discarded – undo
29 29
 use Symfony\Component\Console\Output\OutputInterface;
30 30
 
31 31
 class Enable extends Command {
32
-	/** @var IConfig */
33
-	protected $config;
32
+    /** @var IConfig */
33
+    protected $config;
34 34
 
35
-	/** @var IManager */
36
-	protected $encryptionManager;
35
+    /** @var IManager */
36
+    protected $encryptionManager;
37 37
 
38
-	/**
39
-	 * @param IConfig $config
40
-	 * @param IManager $encryptionManager
41
-	 */
42
-	public function __construct(IConfig $config, IManager $encryptionManager) {
43
-		parent::__construct();
38
+    /**
39
+     * @param IConfig $config
40
+     * @param IManager $encryptionManager
41
+     */
42
+    public function __construct(IConfig $config, IManager $encryptionManager) {
43
+        parent::__construct();
44 44
 
45
-		$this->encryptionManager = $encryptionManager;
46
-		$this->config = $config;
47
-	}
45
+        $this->encryptionManager = $encryptionManager;
46
+        $this->config = $config;
47
+    }
48 48
 
49
-	protected function configure() {
50
-		$this
51
-			->setName('encryption:enable')
52
-			->setDescription('Enable encryption')
53
-		;
54
-	}
49
+    protected function configure() {
50
+        $this
51
+            ->setName('encryption:enable')
52
+            ->setDescription('Enable encryption')
53
+        ;
54
+    }
55 55
 
56
-	protected function execute(InputInterface $input, OutputInterface $output) {
57
-		if ($this->config->getAppValue('core', 'encryption_enabled', 'no') === 'yes') {
58
-			$output->writeln('Encryption is already enabled');
59
-		} else {
60
-			$this->config->setAppValue('core', 'encryption_enabled', 'yes');
61
-			$output->writeln('<info>Encryption enabled</info>');
62
-		}
63
-		$output->writeln('');
56
+    protected function execute(InputInterface $input, OutputInterface $output) {
57
+        if ($this->config->getAppValue('core', 'encryption_enabled', 'no') === 'yes') {
58
+            $output->writeln('Encryption is already enabled');
59
+        } else {
60
+            $this->config->setAppValue('core', 'encryption_enabled', 'yes');
61
+            $output->writeln('<info>Encryption enabled</info>');
62
+        }
63
+        $output->writeln('');
64 64
 
65
-		$modules = $this->encryptionManager->getEncryptionModules();
66
-		if (empty($modules)) {
67
-			$output->writeln('<error>No encryption module is loaded</error>');
68
-		} else {
69
-			$defaultModule = $this->config->getAppValue('core', 'default_encryption_module', null);
70
-			if ($defaultModule === null) {
71
-				$output->writeln('<error>No default module is set</error>');
72
-			} elseif (!isset($modules[$defaultModule])) {
73
-				$output->writeln('<error>The current default module does not exist: ' . $defaultModule . '</error>');
74
-			} else {
75
-				$output->writeln('Default module: ' . $defaultModule);
76
-			}
77
-		}
78
-	}
65
+        $modules = $this->encryptionManager->getEncryptionModules();
66
+        if (empty($modules)) {
67
+            $output->writeln('<error>No encryption module is loaded</error>');
68
+        } else {
69
+            $defaultModule = $this->config->getAppValue('core', 'default_encryption_module', null);
70
+            if ($defaultModule === null) {
71
+                $output->writeln('<error>No default module is set</error>');
72
+            } elseif (!isset($modules[$defaultModule])) {
73
+                $output->writeln('<error>The current default module does not exist: ' . $defaultModule . '</error>');
74
+            } else {
75
+                $output->writeln('Default module: ' . $defaultModule);
76
+            }
77
+        }
78
+    }
79 79
 }
Please login to merge, or discard this patch.