Passed
Push — master ( a40db9...fb5987 )
by Julius
14:20 queued 12s
created
core/Command/Config/System/Base.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -26,53 +26,53 @@
 block discarded – undo
26 26
 
27 27
 abstract class Base extends \OC\Core\Command\Base {
28 28
 
29
-	/** @var SystemConfig */
30
-	protected $systemConfig;
29
+    /** @var SystemConfig */
30
+    protected $systemConfig;
31 31
 
32
-	/**
33
-	 * @param string $argumentName
34
-	 * @param CompletionContext $context
35
-	 * @return string[]
36
-	 */
37
-	public function completeArgumentValues($argumentName, CompletionContext $context) {
38
-		if ($argumentName === 'name') {
39
-			$words = $this->getPreviousNames($context, $context->getWordIndex());
40
-			if (empty($words)) {
41
-				$completions = $this->systemConfig->getKeys();
42
-			} else {
43
-				$key = array_shift($words);
44
-				$value = $this->systemConfig->getValue($key);
45
-				$completions = array_keys($value);
32
+    /**
33
+     * @param string $argumentName
34
+     * @param CompletionContext $context
35
+     * @return string[]
36
+     */
37
+    public function completeArgumentValues($argumentName, CompletionContext $context) {
38
+        if ($argumentName === 'name') {
39
+            $words = $this->getPreviousNames($context, $context->getWordIndex());
40
+            if (empty($words)) {
41
+                $completions = $this->systemConfig->getKeys();
42
+            } else {
43
+                $key = array_shift($words);
44
+                $value = $this->systemConfig->getValue($key);
45
+                $completions = array_keys($value);
46 46
 
47
-				while (!empty($words) && is_array($value)) {
48
-					$key = array_shift($words);
49
-					if (!isset($value[$key]) || !is_array($value[$key])) {
50
-						break;
51
-					}
47
+                while (!empty($words) && is_array($value)) {
48
+                    $key = array_shift($words);
49
+                    if (!isset($value[$key]) || !is_array($value[$key])) {
50
+                        break;
51
+                    }
52 52
 
53
-					$value = $value[$key];
54
-					$completions = array_keys($value);
55
-				}
56
-			}
53
+                    $value = $value[$key];
54
+                    $completions = array_keys($value);
55
+                }
56
+            }
57 57
 
58
-			return $completions;
59
-		}
60
-		return parent::completeArgumentValues($argumentName, $context);
61
-	}
58
+            return $completions;
59
+        }
60
+        return parent::completeArgumentValues($argumentName, $context);
61
+    }
62 62
 
63
-	/**
64
-	 * @param CompletionContext $context
65
-	 * @param int $currentIndex
66
-	 * @return string[]
67
-	 */
68
-	protected function getPreviousNames(CompletionContext $context, $currentIndex) {
69
-		$word = $context->getWordAtIndex($currentIndex - 1);
70
-		if ($word === $this->getName() || $currentIndex <= 0) {
71
-			return [];
72
-		}
63
+    /**
64
+     * @param CompletionContext $context
65
+     * @param int $currentIndex
66
+     * @return string[]
67
+     */
68
+    protected function getPreviousNames(CompletionContext $context, $currentIndex) {
69
+        $word = $context->getWordAtIndex($currentIndex - 1);
70
+        if ($word === $this->getName() || $currentIndex <= 0) {
71
+            return [];
72
+        }
73 73
 
74
-		$words = $this->getPreviousNames($context, $currentIndex - 1);
75
-		$words[] = $word;
76
-		return $words;
77
-	}
74
+        $words = $this->getPreviousNames($context, $currentIndex - 1);
75
+        $words[] = $word;
76
+        return $words;
77
+    }
78 78
 }
Please login to merge, or discard this patch.
core/Command/Config/System/SetConfig.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 			$this->systemConfig->setValue($configName, $configValue['value']);
98 98
 		}
99 99
 
100
-		$output->writeln('<info>System config value ' . implode(' => ', $configNames) . ' set to ' . $configValue['readable-value'] . '</info>');
100
+		$output->writeln('<info>System config value '.implode(' => ', $configNames).' set to '.$configValue['readable-value'].'</info>');
101 101
 		return 0;
102 102
 	}
103 103
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 				}
117 117
 				return [
118 118
 					'value' => (int) $value,
119
-					'readable-value' => 'integer ' . (int) $value,
119
+					'readable-value' => 'integer '.(int) $value,
120 120
 				];
121 121
 
122 122
 			case 'double':
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 				}
127 127
 				return [
128 128
 					'value' => (double) $value,
129
-					'readable-value' => 'double ' . (double) $value,
129
+					'readable-value' => 'double '.(double) $value,
130 130
 				];
131 131
 
132 132
 			case 'boolean':
@@ -136,13 +136,13 @@  discard block
 block discarded – undo
136 136
 					case 'true':
137 137
 						return [
138 138
 							'value' => true,
139
-							'readable-value' => 'boolean ' . $value,
139
+							'readable-value' => 'boolean '.$value,
140 140
 						];
141 141
 
142 142
 					case 'false':
143 143
 						return [
144 144
 							'value' => false,
145
-							'readable-value' => 'boolean ' . $value,
145
+							'readable-value' => 'boolean '.$value,
146 146
 						];
147 147
 
148 148
 					default:
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 				$value = (string) $value;
160 160
 				return [
161 161
 					'value' => $value,
162
-					'readable-value' => ($value === '') ? 'empty string' : 'string ' . $value,
162
+					'readable-value' => ($value === '') ? 'empty string' : 'string '.$value,
163 163
 				];
164 164
 
165 165
 			default:
Please login to merge, or discard this patch.
Indentation   +177 added lines, -177 removed lines patch added patch discarded remove patch
@@ -33,181 +33,181 @@
 block discarded – undo
33 33
 use Symfony\Component\Console\Output\OutputInterface;
34 34
 
35 35
 class SetConfig extends Base {
36
-	/** * @var SystemConfig */
37
-	protected $systemConfig;
38
-
39
-	/**
40
-	 * @param SystemConfig $systemConfig
41
-	 */
42
-	public function __construct(SystemConfig $systemConfig) {
43
-		parent::__construct();
44
-		$this->systemConfig = $systemConfig;
45
-	}
46
-
47
-	protected function configure() {
48
-		parent::configure();
49
-
50
-		$this
51
-			->setName('config:system:set')
52
-			->setDescription('Set a system config value')
53
-			->addArgument(
54
-				'name',
55
-				InputArgument::REQUIRED | InputArgument::IS_ARRAY,
56
-				'Name of the config parameter, specify multiple for array parameter'
57
-			)
58
-			->addOption(
59
-				'type',
60
-				null,
61
-				InputOption::VALUE_REQUIRED,
62
-				'Value type [string, integer, double, boolean]',
63
-				'string'
64
-			)
65
-			->addOption(
66
-				'value',
67
-				null,
68
-				InputOption::VALUE_REQUIRED,
69
-				'The new value of the config'
70
-			)
71
-			->addOption(
72
-				'update-only',
73
-				null,
74
-				InputOption::VALUE_NONE,
75
-				'Only updates the value, if it is not set before, it is not being added'
76
-			)
77
-		;
78
-	}
79
-
80
-	protected function execute(InputInterface $input, OutputInterface $output): int {
81
-		$configNames = $input->getArgument('name');
82
-		$configName = $configNames[0];
83
-		$configValue = $this->castValue($input->getOption('value'), $input->getOption('type'));
84
-		$updateOnly = $input->getOption('update-only');
85
-
86
-		if (count($configNames) > 1) {
87
-			$existingValue = $this->systemConfig->getValue($configName);
88
-
89
-			$newValue = $this->mergeArrayValue(
90
-				array_slice($configNames, 1), $existingValue, $configValue['value'], $updateOnly
91
-			);
92
-
93
-			$this->systemConfig->setValue($configName, $newValue);
94
-		} else {
95
-			if ($updateOnly && !in_array($configName, $this->systemConfig->getKeys(), true)) {
96
-				throw new \UnexpectedValueException('Config parameter does not exist');
97
-			}
98
-
99
-			$this->systemConfig->setValue($configName, $configValue['value']);
100
-		}
101
-
102
-		$output->writeln('<info>System config value ' . implode(' => ', $configNames) . ' set to ' . $configValue['readable-value'] . '</info>');
103
-		return 0;
104
-	}
105
-
106
-	/**
107
-	 * @param string $value
108
-	 * @param string $type
109
-	 * @return mixed
110
-	 * @throws \InvalidArgumentException
111
-	 */
112
-	protected function castValue($value, $type) {
113
-		switch ($type) {
114
-			case 'integer':
115
-			case 'int':
116
-				if (!is_numeric($value)) {
117
-					throw new \InvalidArgumentException('Non-numeric value specified');
118
-				}
119
-				return [
120
-					'value' => (int) $value,
121
-					'readable-value' => 'integer ' . (int) $value,
122
-				];
123
-
124
-			case 'double':
125
-			case 'float':
126
-				if (!is_numeric($value)) {
127
-					throw new \InvalidArgumentException('Non-numeric value specified');
128
-				}
129
-				return [
130
-					'value' => (double) $value,
131
-					'readable-value' => 'double ' . (double) $value,
132
-				];
133
-
134
-			case 'boolean':
135
-			case 'bool':
136
-				$value = strtolower($value);
137
-				switch ($value) {
138
-					case 'true':
139
-						return [
140
-							'value' => true,
141
-							'readable-value' => 'boolean ' . $value,
142
-						];
143
-
144
-					case 'false':
145
-						return [
146
-							'value' => false,
147
-							'readable-value' => 'boolean ' . $value,
148
-						];
149
-
150
-					default:
151
-						throw new \InvalidArgumentException('Unable to parse value as boolean');
152
-				}
153
-
154
-				// no break
155
-			case 'null':
156
-				return [
157
-					'value' => null,
158
-					'readable-value' => 'null',
159
-				];
160
-
161
-			case 'string':
162
-				$value = (string) $value;
163
-				return [
164
-					'value' => $value,
165
-					'readable-value' => ($value === '') ? 'empty string' : 'string ' . $value,
166
-				];
167
-
168
-			default:
169
-				throw new \InvalidArgumentException('Invalid type');
170
-		}
171
-	}
172
-
173
-	/**
174
-	 * @param array $configNames
175
-	 * @param mixed $existingValues
176
-	 * @param mixed $value
177
-	 * @param bool $updateOnly
178
-	 * @return array merged value
179
-	 * @throws \UnexpectedValueException
180
-	 */
181
-	protected function mergeArrayValue(array $configNames, $existingValues, $value, $updateOnly) {
182
-		$configName = array_shift($configNames);
183
-		if (!is_array($existingValues)) {
184
-			$existingValues = [];
185
-		}
186
-		if (!empty($configNames)) {
187
-			if (isset($existingValues[$configName])) {
188
-				$existingValue = $existingValues[$configName];
189
-			} else {
190
-				$existingValue = [];
191
-			}
192
-			$existingValues[$configName] = $this->mergeArrayValue($configNames, $existingValue, $value, $updateOnly);
193
-		} else {
194
-			if (!isset($existingValues[$configName]) && $updateOnly) {
195
-				throw new \UnexpectedValueException('Config parameter does not exist');
196
-			}
197
-			$existingValues[$configName] = $value;
198
-		}
199
-		return $existingValues;
200
-	}
201
-
202
-	/**
203
-	 * @param string $optionName
204
-	 * @param CompletionContext $context
205
-	 * @return string[]
206
-	 */
207
-	public function completeOptionValues($optionName, CompletionContext $context) {
208
-		if ($optionName === 'type') {
209
-			return ['string', 'integer', 'double', 'boolean'];
210
-		}
211
-		return parent::completeOptionValues($optionName, $context);
212
-	}
36
+    /** * @var SystemConfig */
37
+    protected $systemConfig;
38
+
39
+    /**
40
+     * @param SystemConfig $systemConfig
41
+     */
42
+    public function __construct(SystemConfig $systemConfig) {
43
+        parent::__construct();
44
+        $this->systemConfig = $systemConfig;
45
+    }
46
+
47
+    protected function configure() {
48
+        parent::configure();
49
+
50
+        $this
51
+            ->setName('config:system:set')
52
+            ->setDescription('Set a system config value')
53
+            ->addArgument(
54
+                'name',
55
+                InputArgument::REQUIRED | InputArgument::IS_ARRAY,
56
+                'Name of the config parameter, specify multiple for array parameter'
57
+            )
58
+            ->addOption(
59
+                'type',
60
+                null,
61
+                InputOption::VALUE_REQUIRED,
62
+                'Value type [string, integer, double, boolean]',
63
+                'string'
64
+            )
65
+            ->addOption(
66
+                'value',
67
+                null,
68
+                InputOption::VALUE_REQUIRED,
69
+                'The new value of the config'
70
+            )
71
+            ->addOption(
72
+                'update-only',
73
+                null,
74
+                InputOption::VALUE_NONE,
75
+                'Only updates the value, if it is not set before, it is not being added'
76
+            )
77
+        ;
78
+    }
79
+
80
+    protected function execute(InputInterface $input, OutputInterface $output): int {
81
+        $configNames = $input->getArgument('name');
82
+        $configName = $configNames[0];
83
+        $configValue = $this->castValue($input->getOption('value'), $input->getOption('type'));
84
+        $updateOnly = $input->getOption('update-only');
85
+
86
+        if (count($configNames) > 1) {
87
+            $existingValue = $this->systemConfig->getValue($configName);
88
+
89
+            $newValue = $this->mergeArrayValue(
90
+                array_slice($configNames, 1), $existingValue, $configValue['value'], $updateOnly
91
+            );
92
+
93
+            $this->systemConfig->setValue($configName, $newValue);
94
+        } else {
95
+            if ($updateOnly && !in_array($configName, $this->systemConfig->getKeys(), true)) {
96
+                throw new \UnexpectedValueException('Config parameter does not exist');
97
+            }
98
+
99
+            $this->systemConfig->setValue($configName, $configValue['value']);
100
+        }
101
+
102
+        $output->writeln('<info>System config value ' . implode(' => ', $configNames) . ' set to ' . $configValue['readable-value'] . '</info>');
103
+        return 0;
104
+    }
105
+
106
+    /**
107
+     * @param string $value
108
+     * @param string $type
109
+     * @return mixed
110
+     * @throws \InvalidArgumentException
111
+     */
112
+    protected function castValue($value, $type) {
113
+        switch ($type) {
114
+            case 'integer':
115
+            case 'int':
116
+                if (!is_numeric($value)) {
117
+                    throw new \InvalidArgumentException('Non-numeric value specified');
118
+                }
119
+                return [
120
+                    'value' => (int) $value,
121
+                    'readable-value' => 'integer ' . (int) $value,
122
+                ];
123
+
124
+            case 'double':
125
+            case 'float':
126
+                if (!is_numeric($value)) {
127
+                    throw new \InvalidArgumentException('Non-numeric value specified');
128
+                }
129
+                return [
130
+                    'value' => (double) $value,
131
+                    'readable-value' => 'double ' . (double) $value,
132
+                ];
133
+
134
+            case 'boolean':
135
+            case 'bool':
136
+                $value = strtolower($value);
137
+                switch ($value) {
138
+                    case 'true':
139
+                        return [
140
+                            'value' => true,
141
+                            'readable-value' => 'boolean ' . $value,
142
+                        ];
143
+
144
+                    case 'false':
145
+                        return [
146
+                            'value' => false,
147
+                            'readable-value' => 'boolean ' . $value,
148
+                        ];
149
+
150
+                    default:
151
+                        throw new \InvalidArgumentException('Unable to parse value as boolean');
152
+                }
153
+
154
+                // no break
155
+            case 'null':
156
+                return [
157
+                    'value' => null,
158
+                    'readable-value' => 'null',
159
+                ];
160
+
161
+            case 'string':
162
+                $value = (string) $value;
163
+                return [
164
+                    'value' => $value,
165
+                    'readable-value' => ($value === '') ? 'empty string' : 'string ' . $value,
166
+                ];
167
+
168
+            default:
169
+                throw new \InvalidArgumentException('Invalid type');
170
+        }
171
+    }
172
+
173
+    /**
174
+     * @param array $configNames
175
+     * @param mixed $existingValues
176
+     * @param mixed $value
177
+     * @param bool $updateOnly
178
+     * @return array merged value
179
+     * @throws \UnexpectedValueException
180
+     */
181
+    protected function mergeArrayValue(array $configNames, $existingValues, $value, $updateOnly) {
182
+        $configName = array_shift($configNames);
183
+        if (!is_array($existingValues)) {
184
+            $existingValues = [];
185
+        }
186
+        if (!empty($configNames)) {
187
+            if (isset($existingValues[$configName])) {
188
+                $existingValue = $existingValues[$configName];
189
+            } else {
190
+                $existingValue = [];
191
+            }
192
+            $existingValues[$configName] = $this->mergeArrayValue($configNames, $existingValue, $value, $updateOnly);
193
+        } else {
194
+            if (!isset($existingValues[$configName]) && $updateOnly) {
195
+                throw new \UnexpectedValueException('Config parameter does not exist');
196
+            }
197
+            $existingValues[$configName] = $value;
198
+        }
199
+        return $existingValues;
200
+    }
201
+
202
+    /**
203
+     * @param string $optionName
204
+     * @param CompletionContext $context
205
+     * @return string[]
206
+     */
207
+    public function completeOptionValues($optionName, CompletionContext $context) {
208
+        if ($optionName === 'type') {
209
+            return ['string', 'integer', 'double', 'boolean'];
210
+        }
211
+        return parent::completeOptionValues($optionName, $context);
212
+    }
213 213
 }
Please login to merge, or discard this patch.
core/Command/Config/App/DeleteConfig.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,12 +70,12 @@
 block discarded – undo
70 70
 		$configName = $input->getArgument('name');
71 71
 
72 72
 		if ($input->hasParameterOption('--error-if-not-exists') && !in_array($configName, $this->config->getAppKeys($appName))) {
73
-			$output->writeln('<error>Config ' . $configName . ' of app ' . $appName . ' could not be deleted because it did not exist</error>');
73
+			$output->writeln('<error>Config '.$configName.' of app '.$appName.' could not be deleted because it did not exist</error>');
74 74
 			return 1;
75 75
 		}
76 76
 
77 77
 		$this->config->deleteAppValue($appName, $configName);
78
-		$output->writeln('<info>Config value ' . $configName . ' of app ' . $appName . ' deleted</info>');
78
+		$output->writeln('<info>Config value '.$configName.' of app '.$appName.' deleted</info>');
79 79
 		return 0;
80 80
 	}
81 81
 }
Please login to merge, or discard this patch.
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -29,53 +29,53 @@
 block discarded – undo
29 29
 use Symfony\Component\Console\Output\OutputInterface;
30 30
 
31 31
 class DeleteConfig extends Base {
32
-	/** * @var IConfig */
33
-	protected $config;
32
+    /** * @var IConfig */
33
+    protected $config;
34 34
 
35
-	/**
36
-	 * @param IConfig $config
37
-	 */
38
-	public function __construct(IConfig $config) {
39
-		parent::__construct();
40
-		$this->config = $config;
41
-	}
35
+    /**
36
+     * @param IConfig $config
37
+     */
38
+    public function __construct(IConfig $config) {
39
+        parent::__construct();
40
+        $this->config = $config;
41
+    }
42 42
 
43
-	protected function configure() {
44
-		parent::configure();
43
+    protected function configure() {
44
+        parent::configure();
45 45
 
46
-		$this
47
-			->setName('config:app:delete')
48
-			->setDescription('Delete an app config value')
49
-			->addArgument(
50
-				'app',
51
-				InputArgument::REQUIRED,
52
-				'Name of the app'
53
-			)
54
-			->addArgument(
55
-				'name',
56
-				InputArgument::REQUIRED,
57
-				'Name of the config to delete'
58
-			)
59
-			->addOption(
60
-				'error-if-not-exists',
61
-				null,
62
-				InputOption::VALUE_NONE,
63
-				'Checks whether the config exists before deleting it'
64
-			)
65
-		;
66
-	}
46
+        $this
47
+            ->setName('config:app:delete')
48
+            ->setDescription('Delete an app config value')
49
+            ->addArgument(
50
+                'app',
51
+                InputArgument::REQUIRED,
52
+                'Name of the app'
53
+            )
54
+            ->addArgument(
55
+                'name',
56
+                InputArgument::REQUIRED,
57
+                'Name of the config to delete'
58
+            )
59
+            ->addOption(
60
+                'error-if-not-exists',
61
+                null,
62
+                InputOption::VALUE_NONE,
63
+                'Checks whether the config exists before deleting it'
64
+            )
65
+        ;
66
+    }
67 67
 
68
-	protected function execute(InputInterface $input, OutputInterface $output): int {
69
-		$appName = $input->getArgument('app');
70
-		$configName = $input->getArgument('name');
68
+    protected function execute(InputInterface $input, OutputInterface $output): int {
69
+        $appName = $input->getArgument('app');
70
+        $configName = $input->getArgument('name');
71 71
 
72
-		if ($input->hasParameterOption('--error-if-not-exists') && !in_array($configName, $this->config->getAppKeys($appName))) {
73
-			$output->writeln('<error>Config ' . $configName . ' of app ' . $appName . ' could not be deleted because it did not exist</error>');
74
-			return 1;
75
-		}
72
+        if ($input->hasParameterOption('--error-if-not-exists') && !in_array($configName, $this->config->getAppKeys($appName))) {
73
+            $output->writeln('<error>Config ' . $configName . ' of app ' . $appName . ' could not be deleted because it did not exist</error>');
74
+            return 1;
75
+        }
76 76
 
77
-		$this->config->deleteAppValue($appName, $configName);
78
-		$output->writeln('<info>Config value ' . $configName . ' of app ' . $appName . ' deleted</info>');
79
-		return 0;
80
-	}
77
+        $this->config->deleteAppValue($appName, $configName);
78
+        $output->writeln('<info>Config value ' . $configName . ' of app ' . $appName . ' deleted</info>');
79
+        return 0;
80
+    }
81 81
 }
Please login to merge, or discard this patch.
core/Command/Config/App/Base.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -26,23 +26,23 @@
 block discarded – undo
26 26
 
27 27
 abstract class Base extends \OC\Core\Command\Base {
28 28
 
29
-	/** * @var IConfig */
30
-	protected $config;
29
+    /** * @var IConfig */
30
+    protected $config;
31 31
 
32
-	/**
33
-	 * @param string $argumentName
34
-	 * @param CompletionContext $context
35
-	 * @return string[]
36
-	 */
37
-	public function completeArgumentValues($argumentName, CompletionContext $context) {
38
-		if ($argumentName === 'app') {
39
-			return \OC_App::getAllApps();
40
-		}
32
+    /**
33
+     * @param string $argumentName
34
+     * @param CompletionContext $context
35
+     * @return string[]
36
+     */
37
+    public function completeArgumentValues($argumentName, CompletionContext $context) {
38
+        if ($argumentName === 'app') {
39
+            return \OC_App::getAllApps();
40
+        }
41 41
 
42
-		if ($argumentName === 'name') {
43
-			$appName = $context->getWordAtIndex($context->getWordIndex() - 1);
44
-			return $this->config->getAppKeys($appName);
45
-		}
46
-		return [];
47
-	}
42
+        if ($argumentName === 'name') {
43
+            $appName = $context->getWordAtIndex($context->getWordIndex() - 1);
44
+            return $this->config->getAppKeys($appName);
45
+        }
46
+        return [];
47
+    }
48 48
 }
Please login to merge, or discard this patch.
core/Command/Config/App/SetConfig.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -76,14 +76,14 @@
 block discarded – undo
76 76
 		$configName = $input->getArgument('name');
77 77
 
78 78
 		if (!in_array($configName, $this->config->getAppKeys($appName)) && $input->hasParameterOption('--update-only')) {
79
-			$output->writeln('<comment>Config value ' . $configName . ' for app ' . $appName . ' not updated, as it has not been set before.</comment>');
79
+			$output->writeln('<comment>Config value '.$configName.' for app '.$appName.' not updated, as it has not been set before.</comment>');
80 80
 			return 1;
81 81
 		}
82 82
 
83 83
 		$configValue = $input->getOption('value');
84 84
 		$this->config->setAppValue($appName, $configName, $configValue);
85 85
 
86
-		$output->writeln('<info>Config value ' . $configName . ' for app ' . $appName . ' set to ' . $configValue . '</info>');
86
+		$output->writeln('<info>Config value '.$configName.' for app '.$appName.' set to '.$configValue.'</info>');
87 87
 		return 0;
88 88
 	}
89 89
 }
Please login to merge, or discard this patch.
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -29,61 +29,61 @@
 block discarded – undo
29 29
 use Symfony\Component\Console\Output\OutputInterface;
30 30
 
31 31
 class SetConfig extends Base {
32
-	/** * @var IConfig */
33
-	protected $config;
32
+    /** * @var IConfig */
33
+    protected $config;
34 34
 
35
-	/**
36
-	 * @param IConfig $config
37
-	 */
38
-	public function __construct(IConfig $config) {
39
-		parent::__construct();
40
-		$this->config = $config;
41
-	}
35
+    /**
36
+     * @param IConfig $config
37
+     */
38
+    public function __construct(IConfig $config) {
39
+        parent::__construct();
40
+        $this->config = $config;
41
+    }
42 42
 
43
-	protected function configure() {
44
-		parent::configure();
43
+    protected function configure() {
44
+        parent::configure();
45 45
 
46
-		$this
47
-			->setName('config:app:set')
48
-			->setDescription('Set an app config value')
49
-			->addArgument(
50
-				'app',
51
-				InputArgument::REQUIRED,
52
-				'Name of the app'
53
-			)
54
-			->addArgument(
55
-				'name',
56
-				InputArgument::REQUIRED,
57
-				'Name of the config to set'
58
-			)
59
-			->addOption(
60
-				'value',
61
-				null,
62
-				InputOption::VALUE_REQUIRED,
63
-				'The new value of the config'
64
-			)
65
-			->addOption(
66
-				'update-only',
67
-				null,
68
-				InputOption::VALUE_NONE,
69
-				'Only updates the value, if it is not set before, it is not being added'
70
-			)
71
-		;
72
-	}
46
+        $this
47
+            ->setName('config:app:set')
48
+            ->setDescription('Set an app config value')
49
+            ->addArgument(
50
+                'app',
51
+                InputArgument::REQUIRED,
52
+                'Name of the app'
53
+            )
54
+            ->addArgument(
55
+                'name',
56
+                InputArgument::REQUIRED,
57
+                'Name of the config to set'
58
+            )
59
+            ->addOption(
60
+                'value',
61
+                null,
62
+                InputOption::VALUE_REQUIRED,
63
+                'The new value of the config'
64
+            )
65
+            ->addOption(
66
+                'update-only',
67
+                null,
68
+                InputOption::VALUE_NONE,
69
+                'Only updates the value, if it is not set before, it is not being added'
70
+            )
71
+        ;
72
+    }
73 73
 
74
-	protected function execute(InputInterface $input, OutputInterface $output): int {
75
-		$appName = $input->getArgument('app');
76
-		$configName = $input->getArgument('name');
74
+    protected function execute(InputInterface $input, OutputInterface $output): int {
75
+        $appName = $input->getArgument('app');
76
+        $configName = $input->getArgument('name');
77 77
 
78
-		if (!in_array($configName, $this->config->getAppKeys($appName)) && $input->hasParameterOption('--update-only')) {
79
-			$output->writeln('<comment>Config value ' . $configName . ' for app ' . $appName . ' not updated, as it has not been set before.</comment>');
80
-			return 1;
81
-		}
78
+        if (!in_array($configName, $this->config->getAppKeys($appName)) && $input->hasParameterOption('--update-only')) {
79
+            $output->writeln('<comment>Config value ' . $configName . ' for app ' . $appName . ' not updated, as it has not been set before.</comment>');
80
+            return 1;
81
+        }
82 82
 
83
-		$configValue = $input->getOption('value');
84
-		$this->config->setAppValue($appName, $configName, $configValue);
83
+        $configValue = $input->getOption('value');
84
+        $this->config->setAppValue($appName, $configName, $configValue);
85 85
 
86
-		$output->writeln('<info>Config value ' . $configName . ' for app ' . $appName . ' set to ' . $configValue . '</info>');
87
-		return 0;
88
-	}
86
+        $output->writeln('<info>Config value ' . $configName . ' for app ' . $appName . ' set to ' . $configValue . '</info>');
87
+        return 0;
88
+    }
89 89
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Command/Delete.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
 		try {
69 69
 			$mount = $this->globalService->getStorage($mountId);
70 70
 		} catch (NotFoundException $e) {
71
-			$output->writeln('<error>Mount with id "' . $mountId . ' not found, check "occ files_external:list" to get available mounts"</error>');
71
+			$output->writeln('<error>Mount with id "'.$mountId.' not found, check "occ files_external:list" to get available mounts"</error>');
72 72
 			return 404;
73 73
 		}
74 74
 
Please login to merge, or discard this patch.
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -39,77 +39,77 @@
 block discarded – undo
39 39
 use Symfony\Component\Console\Question\ConfirmationQuestion;
40 40
 
41 41
 class Delete extends Base {
42
-	/**
43
-	 * @var GlobalStoragesService
44
-	 */
45
-	protected $globalService;
42
+    /**
43
+     * @var GlobalStoragesService
44
+     */
45
+    protected $globalService;
46 46
 
47
-	/**
48
-	 * @var UserStoragesService
49
-	 */
50
-	protected $userService;
47
+    /**
48
+     * @var UserStoragesService
49
+     */
50
+    protected $userService;
51 51
 
52
-	/**
53
-	 * @var IUserSession
54
-	 */
55
-	protected $userSession;
52
+    /**
53
+     * @var IUserSession
54
+     */
55
+    protected $userSession;
56 56
 
57
-	/**
58
-	 * @var IUserManager
59
-	 */
60
-	protected $userManager;
57
+    /**
58
+     * @var IUserManager
59
+     */
60
+    protected $userManager;
61 61
 
62
-	public function __construct(GlobalStoragesService $globalService, UserStoragesService $userService, IUserSession $userSession, IUserManager $userManager) {
63
-		parent::__construct();
64
-		$this->globalService = $globalService;
65
-		$this->userService = $userService;
66
-		$this->userSession = $userSession;
67
-		$this->userManager = $userManager;
68
-	}
62
+    public function __construct(GlobalStoragesService $globalService, UserStoragesService $userService, IUserSession $userSession, IUserManager $userManager) {
63
+        parent::__construct();
64
+        $this->globalService = $globalService;
65
+        $this->userService = $userService;
66
+        $this->userSession = $userSession;
67
+        $this->userManager = $userManager;
68
+    }
69 69
 
70
-	protected function configure() {
71
-		$this
72
-			->setName('files_external:delete')
73
-			->setDescription('Delete an external mount')
74
-			->addArgument(
75
-				'mount_id',
76
-				InputArgument::REQUIRED,
77
-				'The id of the mount to edit'
78
-			)->addOption(
79
-				'yes',
80
-				'y',
81
-				InputOption::VALUE_NONE,
82
-				'Skip confirmation'
83
-			);
84
-		parent::configure();
85
-	}
70
+    protected function configure() {
71
+        $this
72
+            ->setName('files_external:delete')
73
+            ->setDescription('Delete an external mount')
74
+            ->addArgument(
75
+                'mount_id',
76
+                InputArgument::REQUIRED,
77
+                'The id of the mount to edit'
78
+            )->addOption(
79
+                'yes',
80
+                'y',
81
+                InputOption::VALUE_NONE,
82
+                'Skip confirmation'
83
+            );
84
+        parent::configure();
85
+    }
86 86
 
87
-	protected function execute(InputInterface $input, OutputInterface $output): int {
88
-		$mountId = $input->getArgument('mount_id');
89
-		try {
90
-			$mount = $this->globalService->getStorage($mountId);
91
-		} catch (NotFoundException $e) {
92
-			$output->writeln('<error>Mount with id "' . $mountId . ' not found, check "occ files_external:list" to get available mounts"</error>');
93
-			return 404;
94
-		}
87
+    protected function execute(InputInterface $input, OutputInterface $output): int {
88
+        $mountId = $input->getArgument('mount_id');
89
+        try {
90
+            $mount = $this->globalService->getStorage($mountId);
91
+        } catch (NotFoundException $e) {
92
+            $output->writeln('<error>Mount with id "' . $mountId . ' not found, check "occ files_external:list" to get available mounts"</error>');
93
+            return 404;
94
+        }
95 95
 
96
-		$noConfirm = $input->getOption('yes');
96
+        $noConfirm = $input->getOption('yes');
97 97
 
98
-		if (!$noConfirm) {
99
-			$listCommand = new ListCommand($this->globalService, $this->userService, $this->userSession, $this->userManager);
100
-			$listInput = new ArrayInput([], $listCommand->getDefinition());
101
-			$listInput->setOption('output', $input->getOption('output'));
102
-			$listCommand->listMounts(null, [$mount], $listInput, $output);
98
+        if (!$noConfirm) {
99
+            $listCommand = new ListCommand($this->globalService, $this->userService, $this->userSession, $this->userManager);
100
+            $listInput = new ArrayInput([], $listCommand->getDefinition());
101
+            $listInput->setOption('output', $input->getOption('output'));
102
+            $listCommand->listMounts(null, [$mount], $listInput, $output);
103 103
 
104
-			$questionHelper = $this->getHelper('question');
105
-			$question = new ConfirmationQuestion('Delete this mount? [y/N] ', false);
104
+            $questionHelper = $this->getHelper('question');
105
+            $question = new ConfirmationQuestion('Delete this mount? [y/N] ', false);
106 106
 
107
-			if (!$questionHelper->ask($input, $output, $question)) {
108
-				return 1;
109
-			}
110
-		}
107
+            if (!$questionHelper->ask($input, $output, $question)) {
108
+                return 1;
109
+            }
110
+        }
111 111
 
112
-		$this->globalService->removeStorage($mountId);
113
-		return 0;
114
-	}
112
+        $this->globalService->removeStorage($mountId);
113
+        return 0;
114
+    }
115 115
 }
Please login to merge, or discard this patch.
lib/public/Contacts/ContactsMenu/ILinkAction.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,15 +29,15 @@
 block discarded – undo
29 29
  */
30 30
 interface ILinkAction extends IAction {
31 31
 
32
-	/**
33
-	 * @since 12.0
34
-	 * @param string $href the target URL of the action
35
-	 */
36
-	public function setHref($href);
32
+    /**
33
+     * @since 12.0
34
+     * @param string $href the target URL of the action
35
+     */
36
+    public function setHref($href);
37 37
 
38
-	/**
39
-	 * @since 12.0
40
-	 * @return string
41
-	 */
42
-	public function getHref();
38
+    /**
39
+     * @since 12.0
40
+     * @return string
41
+     */
42
+    public function getHref();
43 43
 }
Please login to merge, or discard this patch.
lib/private/Repair/RepairInvalidShares.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
 		$updatedEntries = $builder->execute();
73 73
 		if ($updatedEntries > 0) {
74
-			$out->info('Fixed file share permissions for ' . $updatedEntries . ' shares');
74
+			$out->info('Fixed file share permissions for '.$updatedEntries.' shares');
75 75
 		}
76 76
 	}
77 77
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 		}
108 108
 
109 109
 		if ($deletedEntries) {
110
-			$out->info('Removed ' . $deletedEntries . ' shares where the parent did not exist');
110
+			$out->info('Removed '.$deletedEntries.' shares where the parent did not exist');
111 111
 		}
112 112
 	}
113 113
 
Please login to merge, or discard this patch.
Indentation   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -33,89 +33,89 @@
 block discarded – undo
33 33
  * Repairs shares with invalid data
34 34
  */
35 35
 class RepairInvalidShares implements IRepairStep {
36
-	public const CHUNK_SIZE = 200;
37
-
38
-	/** @var \OCP\IConfig */
39
-	protected $config;
40
-
41
-	/** @var \OCP\IDBConnection */
42
-	protected $connection;
43
-
44
-	/**
45
-	 * @param \OCP\IConfig $config
46
-	 * @param \OCP\IDBConnection $connection
47
-	 */
48
-	public function __construct($config, $connection) {
49
-		$this->connection = $connection;
50
-		$this->config = $config;
51
-	}
52
-
53
-	public function getName() {
54
-		return 'Repair invalid shares';
55
-	}
56
-
57
-	/**
58
-	 * Adjust file share permissions
59
-	 */
60
-	private function adjustFileSharePermissions(IOutput $out) {
61
-		$mask = \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE;
62
-		$builder = $this->connection->getQueryBuilder();
63
-
64
-		$permsFunc = $builder->expr()->bitwiseAnd('permissions', $mask);
65
-		$builder
66
-			->update('share')
67
-			->set('permissions', $permsFunc)
68
-			->where($builder->expr()->eq('item_type', $builder->expr()->literal('file')))
69
-			->andWhere($builder->expr()->neq('permissions', $permsFunc));
70
-
71
-		$updatedEntries = $builder->execute();
72
-		if ($updatedEntries > 0) {
73
-			$out->info('Fixed file share permissions for ' . $updatedEntries . ' shares');
74
-		}
75
-	}
76
-
77
-	/**
78
-	 * Remove shares where the parent share does not exist anymore
79
-	 */
80
-	private function removeSharesNonExistingParent(IOutput $out) {
81
-		$deletedEntries = 0;
82
-
83
-		$query = $this->connection->getQueryBuilder();
84
-		$query->select('s1.parent')
85
-			->from('share', 's1')
86
-			->where($query->expr()->isNotNull('s1.parent'))
87
-				->andWhere($query->expr()->isNull('s2.id'))
88
-			->leftJoin('s1', 'share', 's2', $query->expr()->eq('s1.parent', 's2.id'))
89
-			->groupBy('s1.parent')
90
-			->setMaxResults(self::CHUNK_SIZE);
91
-
92
-		$deleteQuery = $this->connection->getQueryBuilder();
93
-		$deleteQuery->delete('share')
94
-			->where($deleteQuery->expr()->eq('parent', $deleteQuery->createParameter('parent')));
95
-
96
-		$deletedInLastChunk = self::CHUNK_SIZE;
97
-		while ($deletedInLastChunk === self::CHUNK_SIZE) {
98
-			$deletedInLastChunk = 0;
99
-			$result = $query->execute();
100
-			while ($row = $result->fetch()) {
101
-				$deletedInLastChunk++;
102
-				$deletedEntries += $deleteQuery->setParameter('parent', (int) $row['parent'])
103
-					->execute();
104
-			}
105
-			$result->closeCursor();
106
-		}
107
-
108
-		if ($deletedEntries) {
109
-			$out->info('Removed ' . $deletedEntries . ' shares where the parent did not exist');
110
-		}
111
-	}
112
-
113
-	public function run(IOutput $out) {
114
-		$ocVersionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0');
115
-		if (version_compare($ocVersionFromBeforeUpdate, '12.0.0.11', '<')) {
116
-			$this->adjustFileSharePermissions($out);
117
-		}
118
-
119
-		$this->removeSharesNonExistingParent($out);
120
-	}
36
+    public const CHUNK_SIZE = 200;
37
+
38
+    /** @var \OCP\IConfig */
39
+    protected $config;
40
+
41
+    /** @var \OCP\IDBConnection */
42
+    protected $connection;
43
+
44
+    /**
45
+     * @param \OCP\IConfig $config
46
+     * @param \OCP\IDBConnection $connection
47
+     */
48
+    public function __construct($config, $connection) {
49
+        $this->connection = $connection;
50
+        $this->config = $config;
51
+    }
52
+
53
+    public function getName() {
54
+        return 'Repair invalid shares';
55
+    }
56
+
57
+    /**
58
+     * Adjust file share permissions
59
+     */
60
+    private function adjustFileSharePermissions(IOutput $out) {
61
+        $mask = \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE;
62
+        $builder = $this->connection->getQueryBuilder();
63
+
64
+        $permsFunc = $builder->expr()->bitwiseAnd('permissions', $mask);
65
+        $builder
66
+            ->update('share')
67
+            ->set('permissions', $permsFunc)
68
+            ->where($builder->expr()->eq('item_type', $builder->expr()->literal('file')))
69
+            ->andWhere($builder->expr()->neq('permissions', $permsFunc));
70
+
71
+        $updatedEntries = $builder->execute();
72
+        if ($updatedEntries > 0) {
73
+            $out->info('Fixed file share permissions for ' . $updatedEntries . ' shares');
74
+        }
75
+    }
76
+
77
+    /**
78
+     * Remove shares where the parent share does not exist anymore
79
+     */
80
+    private function removeSharesNonExistingParent(IOutput $out) {
81
+        $deletedEntries = 0;
82
+
83
+        $query = $this->connection->getQueryBuilder();
84
+        $query->select('s1.parent')
85
+            ->from('share', 's1')
86
+            ->where($query->expr()->isNotNull('s1.parent'))
87
+                ->andWhere($query->expr()->isNull('s2.id'))
88
+            ->leftJoin('s1', 'share', 's2', $query->expr()->eq('s1.parent', 's2.id'))
89
+            ->groupBy('s1.parent')
90
+            ->setMaxResults(self::CHUNK_SIZE);
91
+
92
+        $deleteQuery = $this->connection->getQueryBuilder();
93
+        $deleteQuery->delete('share')
94
+            ->where($deleteQuery->expr()->eq('parent', $deleteQuery->createParameter('parent')));
95
+
96
+        $deletedInLastChunk = self::CHUNK_SIZE;
97
+        while ($deletedInLastChunk === self::CHUNK_SIZE) {
98
+            $deletedInLastChunk = 0;
99
+            $result = $query->execute();
100
+            while ($row = $result->fetch()) {
101
+                $deletedInLastChunk++;
102
+                $deletedEntries += $deleteQuery->setParameter('parent', (int) $row['parent'])
103
+                    ->execute();
104
+            }
105
+            $result->closeCursor();
106
+        }
107
+
108
+        if ($deletedEntries) {
109
+            $out->info('Removed ' . $deletedEntries . ' shares where the parent did not exist');
110
+        }
111
+    }
112
+
113
+    public function run(IOutput $out) {
114
+        $ocVersionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0');
115
+        if (version_compare($ocVersionFromBeforeUpdate, '12.0.0.11', '<')) {
116
+            $this->adjustFileSharePermissions($out);
117
+        }
118
+
119
+        $this->removeSharesNonExistingParent($out);
120
+    }
121 121
 }
Please login to merge, or discard this patch.
apps/dav/appinfo/v2/remote.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
  */
22 22
 // no php execution timeout for webdav
23 23
 if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
24
-	@set_time_limit(0);
24
+    @set_time_limit(0);
25 25
 }
26 26
 ignore_user_abort(true);
27 27
 
Please login to merge, or discard this patch.