Passed
Push — master ( d5b0f8...0e5749 )
by Julius
19:08 queued 14s
created
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.
lib/private/Share20/ProviderFactory.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 		}
215 215
 
216 216
 		if ($provider === null) {
217
-			throw new ProviderException('No provider with id .' . $id . ' found.');
217
+			throw new ProviderException('No provider with id .'.$id.' found.');
218 218
 		}
219 219
 
220 220
 		return $provider;
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 
242 242
 
243 243
 		if ($provider === null) {
244
-			throw new ProviderException('No share provider for share type ' . $shareType);
244
+			throw new ProviderException('No share provider for share type '.$shareType);
245 245
 		}
246 246
 
247 247
 		return $provider;
Please login to merge, or discard this patch.
Indentation   +298 added lines, -298 removed lines patch added patch discarded remove patch
@@ -55,311 +55,311 @@
 block discarded – undo
55 55
  */
56 56
 class ProviderFactory implements IProviderFactory {
57 57
 
58
-	/** @var IServerContainer */
59
-	private $serverContainer;
60
-	/** @var DefaultShareProvider */
61
-	private $defaultProvider = null;
62
-	/** @var FederatedShareProvider */
63
-	private $federatedProvider = null;
64
-	/** @var  ShareByMailProvider */
65
-	private $shareByMailProvider;
66
-	/** @var  \OCA\Circles\ShareByCircleProvider */
67
-	private $shareByCircleProvider = null;
68
-	/** @var bool */
69
-	private $circlesAreNotAvailable = false;
70
-	/** @var \OCA\Talk\Share\RoomShareProvider */
71
-	private $roomShareProvider = null;
72
-
73
-	private $registeredShareProviders = [];
74
-
75
-	private $shareProviders = [];
76
-
77
-	/**
78
-	 * IProviderFactory constructor.
79
-	 *
80
-	 * @param IServerContainer $serverContainer
81
-	 */
82
-	public function __construct(IServerContainer $serverContainer) {
83
-		$this->serverContainer = $serverContainer;
84
-	}
85
-
86
-	public function registerProvider(string $shareProviderClass): void {
87
-		$this->registeredShareProviders[] = $shareProviderClass;
88
-	}
89
-
90
-	/**
91
-	 * Create the default share provider.
92
-	 *
93
-	 * @return DefaultShareProvider
94
-	 */
95
-	protected function defaultShareProvider() {
96
-		if ($this->defaultProvider === null) {
97
-			$this->defaultProvider = new DefaultShareProvider(
98
-				$this->serverContainer->getDatabaseConnection(),
99
-				$this->serverContainer->getUserManager(),
100
-				$this->serverContainer->getGroupManager(),
101
-				$this->serverContainer->getLazyRootFolder(),
102
-				$this->serverContainer->getMailer(),
103
-				$this->serverContainer->query(Defaults::class),
104
-				$this->serverContainer->getL10NFactory(),
105
-				$this->serverContainer->getURLGenerator(),
106
-				$this->serverContainer->getConfig()
107
-			);
108
-		}
109
-
110
-		return $this->defaultProvider;
111
-	}
112
-
113
-	/**
114
-	 * Create the federated share provider
115
-	 *
116
-	 * @return FederatedShareProvider
117
-	 */
118
-	protected function federatedShareProvider() {
119
-		if ($this->federatedProvider === null) {
120
-			/*
58
+    /** @var IServerContainer */
59
+    private $serverContainer;
60
+    /** @var DefaultShareProvider */
61
+    private $defaultProvider = null;
62
+    /** @var FederatedShareProvider */
63
+    private $federatedProvider = null;
64
+    /** @var  ShareByMailProvider */
65
+    private $shareByMailProvider;
66
+    /** @var  \OCA\Circles\ShareByCircleProvider */
67
+    private $shareByCircleProvider = null;
68
+    /** @var bool */
69
+    private $circlesAreNotAvailable = false;
70
+    /** @var \OCA\Talk\Share\RoomShareProvider */
71
+    private $roomShareProvider = null;
72
+
73
+    private $registeredShareProviders = [];
74
+
75
+    private $shareProviders = [];
76
+
77
+    /**
78
+     * IProviderFactory constructor.
79
+     *
80
+     * @param IServerContainer $serverContainer
81
+     */
82
+    public function __construct(IServerContainer $serverContainer) {
83
+        $this->serverContainer = $serverContainer;
84
+    }
85
+
86
+    public function registerProvider(string $shareProviderClass): void {
87
+        $this->registeredShareProviders[] = $shareProviderClass;
88
+    }
89
+
90
+    /**
91
+     * Create the default share provider.
92
+     *
93
+     * @return DefaultShareProvider
94
+     */
95
+    protected function defaultShareProvider() {
96
+        if ($this->defaultProvider === null) {
97
+            $this->defaultProvider = new DefaultShareProvider(
98
+                $this->serverContainer->getDatabaseConnection(),
99
+                $this->serverContainer->getUserManager(),
100
+                $this->serverContainer->getGroupManager(),
101
+                $this->serverContainer->getLazyRootFolder(),
102
+                $this->serverContainer->getMailer(),
103
+                $this->serverContainer->query(Defaults::class),
104
+                $this->serverContainer->getL10NFactory(),
105
+                $this->serverContainer->getURLGenerator(),
106
+                $this->serverContainer->getConfig()
107
+            );
108
+        }
109
+
110
+        return $this->defaultProvider;
111
+    }
112
+
113
+    /**
114
+     * Create the federated share provider
115
+     *
116
+     * @return FederatedShareProvider
117
+     */
118
+    protected function federatedShareProvider() {
119
+        if ($this->federatedProvider === null) {
120
+            /*
121 121
 			 * Check if the app is enabled
122 122
 			 */
123
-			$appManager = $this->serverContainer->getAppManager();
124
-			if (!$appManager->isEnabledForUser('federatedfilesharing')) {
125
-				return null;
126
-			}
123
+            $appManager = $this->serverContainer->getAppManager();
124
+            if (!$appManager->isEnabledForUser('federatedfilesharing')) {
125
+                return null;
126
+            }
127 127
 
128
-			/*
128
+            /*
129 129
 			 * TODO: add factory to federated sharing app
130 130
 			 */
131
-			$l = $this->serverContainer->getL10N('federatedfilesharing');
132
-			$addressHandler = new AddressHandler(
133
-				$this->serverContainer->getURLGenerator(),
134
-				$l,
135
-				$this->serverContainer->getCloudIdManager()
136
-			);
137
-			$notifications = new Notifications(
138
-				$addressHandler,
139
-				$this->serverContainer->getHTTPClientService(),
140
-				$this->serverContainer->query(\OCP\OCS\IDiscoveryService::class),
141
-				$this->serverContainer->getLogger(),
142
-				$this->serverContainer->getJobList(),
143
-				\OC::$server->getCloudFederationProviderManager(),
144
-				\OC::$server->getCloudFederationFactory(),
145
-				$this->serverContainer->query(IEventDispatcher::class)
146
-			);
147
-			$tokenHandler = new TokenHandler(
148
-				$this->serverContainer->getSecureRandom()
149
-			);
150
-
151
-			$this->federatedProvider = new FederatedShareProvider(
152
-				$this->serverContainer->getDatabaseConnection(),
153
-				$addressHandler,
154
-				$notifications,
155
-				$tokenHandler,
156
-				$l,
157
-				$this->serverContainer->getLogger(),
158
-				$this->serverContainer->getLazyRootFolder(),
159
-				$this->serverContainer->getConfig(),
160
-				$this->serverContainer->getUserManager(),
161
-				$this->serverContainer->getCloudIdManager(),
162
-				$this->serverContainer->getGlobalScaleConfig(),
163
-				$this->serverContainer->getCloudFederationProviderManager()
164
-			);
165
-		}
166
-
167
-		return $this->federatedProvider;
168
-	}
169
-
170
-	/**
171
-	 * Create the federated share provider
172
-	 *
173
-	 * @return ShareByMailProvider
174
-	 */
175
-	protected function getShareByMailProvider() {
176
-		if ($this->shareByMailProvider === null) {
177
-			/*
131
+            $l = $this->serverContainer->getL10N('federatedfilesharing');
132
+            $addressHandler = new AddressHandler(
133
+                $this->serverContainer->getURLGenerator(),
134
+                $l,
135
+                $this->serverContainer->getCloudIdManager()
136
+            );
137
+            $notifications = new Notifications(
138
+                $addressHandler,
139
+                $this->serverContainer->getHTTPClientService(),
140
+                $this->serverContainer->query(\OCP\OCS\IDiscoveryService::class),
141
+                $this->serverContainer->getLogger(),
142
+                $this->serverContainer->getJobList(),
143
+                \OC::$server->getCloudFederationProviderManager(),
144
+                \OC::$server->getCloudFederationFactory(),
145
+                $this->serverContainer->query(IEventDispatcher::class)
146
+            );
147
+            $tokenHandler = new TokenHandler(
148
+                $this->serverContainer->getSecureRandom()
149
+            );
150
+
151
+            $this->federatedProvider = new FederatedShareProvider(
152
+                $this->serverContainer->getDatabaseConnection(),
153
+                $addressHandler,
154
+                $notifications,
155
+                $tokenHandler,
156
+                $l,
157
+                $this->serverContainer->getLogger(),
158
+                $this->serverContainer->getLazyRootFolder(),
159
+                $this->serverContainer->getConfig(),
160
+                $this->serverContainer->getUserManager(),
161
+                $this->serverContainer->getCloudIdManager(),
162
+                $this->serverContainer->getGlobalScaleConfig(),
163
+                $this->serverContainer->getCloudFederationProviderManager()
164
+            );
165
+        }
166
+
167
+        return $this->federatedProvider;
168
+    }
169
+
170
+    /**
171
+     * Create the federated share provider
172
+     *
173
+     * @return ShareByMailProvider
174
+     */
175
+    protected function getShareByMailProvider() {
176
+        if ($this->shareByMailProvider === null) {
177
+            /*
178 178
 			 * Check if the app is enabled
179 179
 			 */
180
-			$appManager = $this->serverContainer->getAppManager();
181
-			if (!$appManager->isEnabledForUser('sharebymail')) {
182
-				return null;
183
-			}
184
-
185
-			$settingsManager = new SettingsManager($this->serverContainer->getConfig());
186
-
187
-			$this->shareByMailProvider = new ShareByMailProvider(
188
-				$this->serverContainer->getDatabaseConnection(),
189
-				$this->serverContainer->getSecureRandom(),
190
-				$this->serverContainer->getUserManager(),
191
-				$this->serverContainer->getLazyRootFolder(),
192
-				$this->serverContainer->getL10N('sharebymail'),
193
-				$this->serverContainer->getLogger(),
194
-				$this->serverContainer->getMailer(),
195
-				$this->serverContainer->getURLGenerator(),
196
-				$this->serverContainer->getActivityManager(),
197
-				$settingsManager,
198
-				$this->serverContainer->query(Defaults::class),
199
-				$this->serverContainer->getHasher(),
200
-				$this->serverContainer->get(IEventDispatcher::class),
201
-				$this->serverContainer->get(IManager::class)
202
-			);
203
-		}
204
-
205
-		return $this->shareByMailProvider;
206
-	}
207
-
208
-
209
-	/**
210
-	 * Create the circle share provider
211
-	 *
212
-	 * @return FederatedShareProvider
213
-	 *
214
-	 * @suppress PhanUndeclaredClassMethod
215
-	 */
216
-	protected function getShareByCircleProvider() {
217
-		if ($this->circlesAreNotAvailable) {
218
-			return null;
219
-		}
220
-
221
-		if (!$this->serverContainer->getAppManager()->isEnabledForUser('circles') ||
222
-			!class_exists('\OCA\Circles\ShareByCircleProvider')
223
-		) {
224
-			$this->circlesAreNotAvailable = true;
225
-			return null;
226
-		}
227
-
228
-		if ($this->shareByCircleProvider === null) {
229
-			$this->shareByCircleProvider = new \OCA\Circles\ShareByCircleProvider(
230
-				$this->serverContainer->getDatabaseConnection(),
231
-				$this->serverContainer->getSecureRandom(),
232
-				$this->serverContainer->getUserManager(),
233
-				$this->serverContainer->getLazyRootFolder(),
234
-				$this->serverContainer->getL10N('circles'),
235
-				$this->serverContainer->getLogger(),
236
-				$this->serverContainer->getURLGenerator()
237
-			);
238
-		}
239
-
240
-		return $this->shareByCircleProvider;
241
-	}
242
-
243
-	/**
244
-	 * Create the room share provider
245
-	 *
246
-	 * @return RoomShareProvider
247
-	 */
248
-	protected function getRoomShareProvider() {
249
-		if ($this->roomShareProvider === null) {
250
-			/*
180
+            $appManager = $this->serverContainer->getAppManager();
181
+            if (!$appManager->isEnabledForUser('sharebymail')) {
182
+                return null;
183
+            }
184
+
185
+            $settingsManager = new SettingsManager($this->serverContainer->getConfig());
186
+
187
+            $this->shareByMailProvider = new ShareByMailProvider(
188
+                $this->serverContainer->getDatabaseConnection(),
189
+                $this->serverContainer->getSecureRandom(),
190
+                $this->serverContainer->getUserManager(),
191
+                $this->serverContainer->getLazyRootFolder(),
192
+                $this->serverContainer->getL10N('sharebymail'),
193
+                $this->serverContainer->getLogger(),
194
+                $this->serverContainer->getMailer(),
195
+                $this->serverContainer->getURLGenerator(),
196
+                $this->serverContainer->getActivityManager(),
197
+                $settingsManager,
198
+                $this->serverContainer->query(Defaults::class),
199
+                $this->serverContainer->getHasher(),
200
+                $this->serverContainer->get(IEventDispatcher::class),
201
+                $this->serverContainer->get(IManager::class)
202
+            );
203
+        }
204
+
205
+        return $this->shareByMailProvider;
206
+    }
207
+
208
+
209
+    /**
210
+     * Create the circle share provider
211
+     *
212
+     * @return FederatedShareProvider
213
+     *
214
+     * @suppress PhanUndeclaredClassMethod
215
+     */
216
+    protected function getShareByCircleProvider() {
217
+        if ($this->circlesAreNotAvailable) {
218
+            return null;
219
+        }
220
+
221
+        if (!$this->serverContainer->getAppManager()->isEnabledForUser('circles') ||
222
+            !class_exists('\OCA\Circles\ShareByCircleProvider')
223
+        ) {
224
+            $this->circlesAreNotAvailable = true;
225
+            return null;
226
+        }
227
+
228
+        if ($this->shareByCircleProvider === null) {
229
+            $this->shareByCircleProvider = new \OCA\Circles\ShareByCircleProvider(
230
+                $this->serverContainer->getDatabaseConnection(),
231
+                $this->serverContainer->getSecureRandom(),
232
+                $this->serverContainer->getUserManager(),
233
+                $this->serverContainer->getLazyRootFolder(),
234
+                $this->serverContainer->getL10N('circles'),
235
+                $this->serverContainer->getLogger(),
236
+                $this->serverContainer->getURLGenerator()
237
+            );
238
+        }
239
+
240
+        return $this->shareByCircleProvider;
241
+    }
242
+
243
+    /**
244
+     * Create the room share provider
245
+     *
246
+     * @return RoomShareProvider
247
+     */
248
+    protected function getRoomShareProvider() {
249
+        if ($this->roomShareProvider === null) {
250
+            /*
251 251
 			 * Check if the app is enabled
252 252
 			 */
253
-			$appManager = $this->serverContainer->getAppManager();
254
-			if (!$appManager->isEnabledForUser('spreed')) {
255
-				return null;
256
-			}
257
-
258
-			try {
259
-				$this->roomShareProvider = $this->serverContainer->query('\OCA\Talk\Share\RoomShareProvider');
260
-			} catch (\OCP\AppFramework\QueryException $e) {
261
-				return null;
262
-			}
263
-		}
264
-
265
-		return $this->roomShareProvider;
266
-	}
267
-
268
-	/**
269
-	 * @inheritdoc
270
-	 */
271
-	public function getProvider($id) {
272
-		$provider = null;
273
-		if (isset($this->shareProviders[$id])) {
274
-			return $this->shareProviders[$id];
275
-		}
276
-
277
-		if ($id === 'ocinternal') {
278
-			$provider = $this->defaultShareProvider();
279
-		} elseif ($id === 'ocFederatedSharing') {
280
-			$provider = $this->federatedShareProvider();
281
-		} elseif ($id === 'ocMailShare') {
282
-			$provider = $this->getShareByMailProvider();
283
-		} elseif ($id === 'ocCircleShare') {
284
-			$provider = $this->getShareByCircleProvider();
285
-		} elseif ($id === 'ocRoomShare') {
286
-			$provider = $this->getRoomShareProvider();
287
-		}
288
-
289
-		foreach ($this->registeredShareProviders as $shareProvider) {
290
-			/** @var IShareProvider $instance */
291
-			$instance = $this->serverContainer->get($shareProvider);
292
-			$this->shareProviders[$instance->identifier()] = $instance;
293
-		}
294
-
295
-		if (isset($this->shareProviders[$id])) {
296
-			$provider = $this->shareProviders[$id];
297
-		}
298
-
299
-		if ($provider === null) {
300
-			throw new ProviderException('No provider with id .' . $id . ' found.');
301
-		}
302
-
303
-		return $provider;
304
-	}
305
-
306
-	/**
307
-	 * @inheritdoc
308
-	 */
309
-	public function getProviderForType($shareType) {
310
-		$provider = null;
311
-
312
-		if ($shareType === IShare::TYPE_USER ||
313
-			$shareType === IShare::TYPE_GROUP ||
314
-			$shareType === IShare::TYPE_LINK
315
-		) {
316
-			$provider = $this->defaultShareProvider();
317
-		} elseif ($shareType === IShare::TYPE_REMOTE || $shareType === IShare::TYPE_REMOTE_GROUP) {
318
-			$provider = $this->federatedShareProvider();
319
-		} elseif ($shareType === IShare::TYPE_EMAIL) {
320
-			$provider = $this->getShareByMailProvider();
321
-		} elseif ($shareType === IShare::TYPE_CIRCLE) {
322
-			$provider = $this->getShareByCircleProvider();
323
-		} elseif ($shareType === IShare::TYPE_ROOM) {
324
-			$provider = $this->getRoomShareProvider();
325
-		} elseif ($shareType === IShare::TYPE_DECK) {
326
-			$provider = $this->getProvider('deck');
327
-		}
328
-
329
-
330
-		if ($provider === null) {
331
-			throw new ProviderException('No share provider for share type ' . $shareType);
332
-		}
333
-
334
-		return $provider;
335
-	}
336
-
337
-	public function getAllProviders() {
338
-		$shares = [$this->defaultShareProvider(), $this->federatedShareProvider()];
339
-		$shareByMail = $this->getShareByMailProvider();
340
-		if ($shareByMail !== null) {
341
-			$shares[] = $shareByMail;
342
-		}
343
-		$shareByCircle = $this->getShareByCircleProvider();
344
-		if ($shareByCircle !== null) {
345
-			$shares[] = $shareByCircle;
346
-		}
347
-		$roomShare = $this->getRoomShareProvider();
348
-		if ($roomShare !== null) {
349
-			$shares[] = $roomShare;
350
-		}
351
-
352
-		foreach ($this->registeredShareProviders as $shareProvider) {
353
-			/** @var IShareProvider $instance */
354
-			$instance = $this->serverContainer->get($shareProvider);
355
-			if (!isset($this->shareProviders[$instance->identifier()])) {
356
-				$this->shareProviders[$instance->identifier()] = $instance;
357
-			}
358
-			$shares[] = $this->shareProviders[$instance->identifier()];
359
-		}
360
-
361
-
362
-
363
-		return $shares;
364
-	}
253
+            $appManager = $this->serverContainer->getAppManager();
254
+            if (!$appManager->isEnabledForUser('spreed')) {
255
+                return null;
256
+            }
257
+
258
+            try {
259
+                $this->roomShareProvider = $this->serverContainer->query('\OCA\Talk\Share\RoomShareProvider');
260
+            } catch (\OCP\AppFramework\QueryException $e) {
261
+                return null;
262
+            }
263
+        }
264
+
265
+        return $this->roomShareProvider;
266
+    }
267
+
268
+    /**
269
+     * @inheritdoc
270
+     */
271
+    public function getProvider($id) {
272
+        $provider = null;
273
+        if (isset($this->shareProviders[$id])) {
274
+            return $this->shareProviders[$id];
275
+        }
276
+
277
+        if ($id === 'ocinternal') {
278
+            $provider = $this->defaultShareProvider();
279
+        } elseif ($id === 'ocFederatedSharing') {
280
+            $provider = $this->federatedShareProvider();
281
+        } elseif ($id === 'ocMailShare') {
282
+            $provider = $this->getShareByMailProvider();
283
+        } elseif ($id === 'ocCircleShare') {
284
+            $provider = $this->getShareByCircleProvider();
285
+        } elseif ($id === 'ocRoomShare') {
286
+            $provider = $this->getRoomShareProvider();
287
+        }
288
+
289
+        foreach ($this->registeredShareProviders as $shareProvider) {
290
+            /** @var IShareProvider $instance */
291
+            $instance = $this->serverContainer->get($shareProvider);
292
+            $this->shareProviders[$instance->identifier()] = $instance;
293
+        }
294
+
295
+        if (isset($this->shareProviders[$id])) {
296
+            $provider = $this->shareProviders[$id];
297
+        }
298
+
299
+        if ($provider === null) {
300
+            throw new ProviderException('No provider with id .' . $id . ' found.');
301
+        }
302
+
303
+        return $provider;
304
+    }
305
+
306
+    /**
307
+     * @inheritdoc
308
+     */
309
+    public function getProviderForType($shareType) {
310
+        $provider = null;
311
+
312
+        if ($shareType === IShare::TYPE_USER ||
313
+            $shareType === IShare::TYPE_GROUP ||
314
+            $shareType === IShare::TYPE_LINK
315
+        ) {
316
+            $provider = $this->defaultShareProvider();
317
+        } elseif ($shareType === IShare::TYPE_REMOTE || $shareType === IShare::TYPE_REMOTE_GROUP) {
318
+            $provider = $this->federatedShareProvider();
319
+        } elseif ($shareType === IShare::TYPE_EMAIL) {
320
+            $provider = $this->getShareByMailProvider();
321
+        } elseif ($shareType === IShare::TYPE_CIRCLE) {
322
+            $provider = $this->getShareByCircleProvider();
323
+        } elseif ($shareType === IShare::TYPE_ROOM) {
324
+            $provider = $this->getRoomShareProvider();
325
+        } elseif ($shareType === IShare::TYPE_DECK) {
326
+            $provider = $this->getProvider('deck');
327
+        }
328
+
329
+
330
+        if ($provider === null) {
331
+            throw new ProviderException('No share provider for share type ' . $shareType);
332
+        }
333
+
334
+        return $provider;
335
+    }
336
+
337
+    public function getAllProviders() {
338
+        $shares = [$this->defaultShareProvider(), $this->federatedShareProvider()];
339
+        $shareByMail = $this->getShareByMailProvider();
340
+        if ($shareByMail !== null) {
341
+            $shares[] = $shareByMail;
342
+        }
343
+        $shareByCircle = $this->getShareByCircleProvider();
344
+        if ($shareByCircle !== null) {
345
+            $shares[] = $shareByCircle;
346
+        }
347
+        $roomShare = $this->getRoomShareProvider();
348
+        if ($roomShare !== null) {
349
+            $shares[] = $roomShare;
350
+        }
351
+
352
+        foreach ($this->registeredShareProviders as $shareProvider) {
353
+            /** @var IShareProvider $instance */
354
+            $instance = $this->serverContainer->get($shareProvider);
355
+            if (!isset($this->shareProviders[$instance->identifier()])) {
356
+                $this->shareProviders[$instance->identifier()] = $instance;
357
+            }
358
+            $shares[] = $this->shareProviders[$instance->identifier()];
359
+        }
360
+
361
+
362
+
363
+        return $shares;
364
+    }
365 365
 }
Please login to merge, or discard this patch.