@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @return IMemcache |
134 | 134 | */ |
135 | 135 | public function createLocking(string $prefix = ''): IMemcache { |
136 | - return new $this->lockingCacheClass($this->globalPrefix . '/' . $prefix); |
|
136 | + return new $this->lockingCacheClass($this->globalPrefix.'/'.$prefix); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @return ICache |
144 | 144 | */ |
145 | 145 | public function createDistributed(string $prefix = ''): ICache { |
146 | - return new $this->distributedCacheClass($this->globalPrefix . '/' . $prefix); |
|
146 | + return new $this->distributedCacheClass($this->globalPrefix.'/'.$prefix); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @return ICache |
154 | 154 | */ |
155 | 155 | public function createLocal(string $prefix = ''): ICache { |
156 | - return new $this->localCacheClass($this->globalPrefix . '/' . $prefix); |
|
156 | + return new $this->localCacheClass($this->globalPrefix.'/'.$prefix); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | if (!($node instanceof File)) { |
173 | 173 | return new JSONResponse(['data' => ['message' => $this->l->t('Please select a file.')]]); |
174 | 174 | } |
175 | - if ($node->getSize() > 20*1024*1024) { |
|
175 | + if ($node->getSize() > 20 * 1024 * 1024) { |
|
176 | 176 | return new JSONResponse( |
177 | 177 | ['data' => ['message' => $this->l->t('File is too big')]], |
178 | 178 | Http::STATUS_BAD_REQUEST |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | is_uploaded_file($files['tmp_name'][0]) && |
201 | 201 | !\OC\Files\Filesystem::isFileBlacklisted($files['tmp_name'][0]) |
202 | 202 | ) { |
203 | - if ($files['size'][0] > 20*1024*1024) { |
|
203 | + if ($files['size'][0] > 20 * 1024 * 1024) { |
|
204 | 204 | return new JSONResponse( |
205 | 205 | ['data' => ['message' => $this->l->t('File is too big')]], |
206 | 206 | Http::STATUS_BAD_REQUEST |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | Http::STATUS_OK, |
293 | 293 | ['Content-Type' => $image->mimeType()]); |
294 | 294 | |
295 | - $resp->setETag((string)crc32($image->data())); |
|
295 | + $resp->setETag((string) crc32($image->data())); |
|
296 | 296 | $resp->cacheFor(0); |
297 | 297 | $resp->setLastModified(new \DateTime('now', new \DateTimeZone('GMT'))); |
298 | 298 | return $resp; |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | |
326 | 326 | $image = new \OC_Image(); |
327 | 327 | $image->loadFromData($tmpAvatar); |
328 | - $image->crop($crop['x'], $crop['y'], (int)round($crop['w']), (int)round($crop['h'])); |
|
328 | + $image->crop($crop['x'], $crop['y'], (int) round($crop['w']), (int) round($crop['h'])); |
|
329 | 329 | try { |
330 | 330 | $avatar = $this->avatarManager->getAvatar($this->userId); |
331 | 331 | $avatar->set($image); |
@@ -151,7 +151,7 @@ |
||
151 | 151 | |
152 | 152 | public function takeOutCurrentUser(array &$users) { |
153 | 153 | $currentUser = $this->userSession->getUser(); |
154 | - if(!is_null($currentUser)) { |
|
154 | + if (!is_null($currentUser)) { |
|
155 | 155 | if (isset($users[$currentUser->getUID()])) { |
156 | 156 | unset($users[$currentUser->getUID()]); |
157 | 157 | } |
@@ -33,8 +33,8 @@ |
||
33 | 33 | /** |
34 | 34 | * @since 14.0.0 |
35 | 35 | */ |
36 | - const EVENT_SUCCESS = self::class . '::success'; |
|
37 | - const EVENT_FAILED = self::class . '::failed'; |
|
36 | + const EVENT_SUCCESS = self::class.'::success'; |
|
37 | + const EVENT_FAILED = self::class.'::failed'; |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Get unique identifier of this 2FA provider |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | $storedPassword = $share->getPassword(); |
151 | 151 | $authenticated = $this->session->get('public_link_authenticated') === $share->getId() || |
152 | 152 | $this->shareManager->checkPassword($share, $password); |
153 | - if (!empty($storedPassword) && !$authenticated ) { |
|
153 | + if (!empty($storedPassword) && !$authenticated) { |
|
154 | 154 | $response = new JSONResponse( |
155 | 155 | ['message' => 'No permission to access the share'], |
156 | 156 | Http::STATUS_BAD_REQUEST |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | $httpClient = $this->clientService->newClient(); |
199 | 199 | |
200 | 200 | try { |
201 | - $response = $httpClient->post($remote . '/index.php/apps/federatedfilesharing/createFederatedShare', |
|
201 | + $response = $httpClient->post($remote.'/index.php/apps/federatedfilesharing/createFederatedShare', |
|
202 | 202 | [ |
203 | 203 | 'body' => |
204 | 204 | [ |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | $client = $this->httpClientService->newClient(); |
231 | 231 | try { |
232 | 232 | $result = $client->get( |
233 | - $url . '/status.php', |
|
233 | + $url.'/status.php', |
|
234 | 234 | [ |
235 | 235 | 'timeout' => 3, |
236 | 236 | 'connect_timeout' => 3, |
@@ -286,6 +286,6 @@ discard block |
||
286 | 286 | |
287 | 287 | } |
288 | 288 | |
289 | - return 'https://' . $url; |
|
289 | + return 'https://'.$url; |
|
290 | 290 | } |
291 | 291 | } |
@@ -72,17 +72,17 @@ discard block |
||
72 | 72 | } |
73 | 73 | |
74 | 74 | protected function getStorageConfigFromDBMount(array $mount) { |
75 | - $applicableUsers = array_filter($mount['applicable'], function ($applicable) { |
|
75 | + $applicableUsers = array_filter($mount['applicable'], function($applicable) { |
|
76 | 76 | return $applicable['type'] === DBConfigService::APPLICABLE_TYPE_USER; |
77 | 77 | }); |
78 | - $applicableUsers = array_map(function ($applicable) { |
|
78 | + $applicableUsers = array_map(function($applicable) { |
|
79 | 79 | return $applicable['value']; |
80 | 80 | }, $applicableUsers); |
81 | 81 | |
82 | - $applicableGroups = array_filter($mount['applicable'], function ($applicable) { |
|
82 | + $applicableGroups = array_filter($mount['applicable'], function($applicable) { |
|
83 | 83 | return $applicable['type'] === DBConfigService::APPLICABLE_TYPE_GROUP; |
84 | 84 | }); |
85 | - $applicableGroups = array_map(function ($applicable) { |
|
85 | + $applicableGroups = array_map(function($applicable) { |
|
86 | 86 | return $applicable['value']; |
87 | 87 | }, $applicableGroups); |
88 | 88 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $mount['priority'] |
99 | 99 | ); |
100 | 100 | $config->setType($mount['type']); |
101 | - $config->setId((int)$mount['mount_id']); |
|
101 | + $config->setId((int) $mount['mount_id']); |
|
102 | 102 | return $config; |
103 | 103 | } catch (\UnexpectedValueException $e) { |
104 | 104 | // don't die if a storage backend doesn't exist |
@@ -126,11 +126,11 @@ discard block |
||
126 | 126 | protected function readConfig() { |
127 | 127 | $mounts = $this->readDBConfig(); |
128 | 128 | $configs = array_map([$this, 'getStorageConfigFromDBMount'], $mounts); |
129 | - $configs = array_filter($configs, function ($config) { |
|
129 | + $configs = array_filter($configs, function($config) { |
|
130 | 130 | return $config instanceof StorageConfig; |
131 | 131 | }); |
132 | 132 | |
133 | - $keys = array_map(function (StorageConfig $config) { |
|
133 | + $keys = array_map(function(StorageConfig $config) { |
|
134 | 134 | return $config->getId(); |
135 | 135 | }, $configs); |
136 | 136 | |
@@ -149,14 +149,14 @@ discard block |
||
149 | 149 | $mount = $this->dbConfig->getMountById($id); |
150 | 150 | |
151 | 151 | if (!is_array($mount)) { |
152 | - throw new NotFoundException('Storage with ID "' . $id . '" not found'); |
|
152 | + throw new NotFoundException('Storage with ID "'.$id.'" not found'); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | $config = $this->getStorageConfigFromDBMount($mount); |
156 | 156 | if ($this->isApplicable($config)) { |
157 | 157 | return $config; |
158 | 158 | } else { |
159 | - throw new NotFoundException('Storage with ID "' . $id . '" not found'); |
|
159 | + throw new NotFoundException('Storage with ID "'.$id.'" not found'); |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
@@ -379,13 +379,13 @@ discard block |
||
379 | 379 | $existingMount = $this->dbConfig->getMountById($id); |
380 | 380 | |
381 | 381 | if (!is_array($existingMount)) { |
382 | - throw new NotFoundException('Storage with ID "' . $id . '" not found while updating storage'); |
|
382 | + throw new NotFoundException('Storage with ID "'.$id.'" not found while updating storage'); |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | $oldStorage = $this->getStorageConfigFromDBMount($existingMount); |
386 | 386 | |
387 | 387 | if ($oldStorage->getBackend() instanceof InvalidBackend) { |
388 | - throw new NotFoundException('Storage with id "' . $id . '" cannot be edited due to missing backend'); |
|
388 | + throw new NotFoundException('Storage with id "'.$id.'" cannot be edited due to missing backend'); |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | $removedUsers = array_diff($oldStorage->getApplicableUsers(), $updatedStorage->getApplicableUsers()); |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | $existingMount = $this->dbConfig->getMountById($id); |
463 | 463 | |
464 | 464 | if (!is_array($existingMount)) { |
465 | - throw new NotFoundException('Storage with ID "' . $id . '" not found'); |
|
465 | + throw new NotFoundException('Storage with ID "'.$id.'" not found'); |
|
466 | 466 | } |
467 | 467 | |
468 | 468 | $this->dbConfig->removeMount($id); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | protected function execute(InputInterface $input, OutputInterface $output) { |
90 | 90 | |
91 | - if(Util::needUpgrade()) { |
|
91 | + if (Util::needUpgrade()) { |
|
92 | 92 | if (OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) { |
93 | 93 | // Prepend each line with a little timestamp |
94 | 94 | $timestampFormatter = new TimestampFormatter($this->config, $output->getFormatter()); |
@@ -110,10 +110,10 @@ discard block |
||
110 | 110 | if ($event instanceof GenericEvent) { |
111 | 111 | $message = $event->getSubject(); |
112 | 112 | if (OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) { |
113 | - $output->writeln(' Checking table ' . $message); |
|
113 | + $output->writeln(' Checking table '.$message); |
|
114 | 114 | } else { |
115 | 115 | if (strlen($message) > 60) { |
116 | - $message = substr($message, 0, 57) . '...'; |
|
116 | + $message = substr($message, 0, 57).'...'; |
|
117 | 117 | } |
118 | 118 | $progress->setMessage($message); |
119 | 119 | if ($event[0] === 1) { |
@@ -154,20 +154,20 @@ discard block |
||
154 | 154 | $output->writeln(''); |
155 | 155 | break; |
156 | 156 | case '\OC\Repair::step': |
157 | - if(OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) { |
|
158 | - $output->writeln('<info>Repair step: ' . $event->getArgument(0) . '</info>'); |
|
157 | + if (OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) { |
|
158 | + $output->writeln('<info>Repair step: '.$event->getArgument(0).'</info>'); |
|
159 | 159 | } |
160 | 160 | break; |
161 | 161 | case '\OC\Repair::info': |
162 | - if(OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) { |
|
163 | - $output->writeln('<info>Repair info: ' . $event->getArgument(0) . '</info>'); |
|
162 | + if (OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) { |
|
163 | + $output->writeln('<info>Repair info: '.$event->getArgument(0).'</info>'); |
|
164 | 164 | } |
165 | 165 | break; |
166 | 166 | case '\OC\Repair::warning': |
167 | - $output->writeln('<error>Repair warning: ' . $event->getArgument(0) . '</error>'); |
|
167 | + $output->writeln('<error>Repair warning: '.$event->getArgument(0).'</error>'); |
|
168 | 168 | break; |
169 | 169 | case '\OC\Repair::error': |
170 | - $output->writeln('<error>Repair error: ' . $event->getArgument(0) . '</error>'); |
|
170 | + $output->writeln('<error>Repair error: '.$event->getArgument(0).'</error>'); |
|
171 | 171 | break; |
172 | 172 | } |
173 | 173 | }; |
@@ -183,17 +183,17 @@ discard block |
||
183 | 183 | $dispatcher->addListener('\OC\Repair::error', $repairListener); |
184 | 184 | |
185 | 185 | |
186 | - $updater->listen('\OC\Updater', 'maintenanceEnabled', function () use($output) { |
|
186 | + $updater->listen('\OC\Updater', 'maintenanceEnabled', function() use($output) { |
|
187 | 187 | $output->writeln('<info>Turned on maintenance mode</info>'); |
188 | 188 | }); |
189 | - $updater->listen('\OC\Updater', 'maintenanceDisabled', function () use($output) { |
|
189 | + $updater->listen('\OC\Updater', 'maintenanceDisabled', function() use($output) { |
|
190 | 190 | $output->writeln('<info>Turned off maintenance mode</info>'); |
191 | 191 | }); |
192 | - $updater->listen('\OC\Updater', 'maintenanceActive', function () use($output) { |
|
192 | + $updater->listen('\OC\Updater', 'maintenanceActive', function() use($output) { |
|
193 | 193 | $output->writeln('<info>Maintenance mode is kept active</info>'); |
194 | 194 | }); |
195 | 195 | $updater->listen('\OC\Updater', 'updateEnd', |
196 | - function ($success) use($output, $self) { |
|
196 | + function($success) use($output, $self) { |
|
197 | 197 | if ($success) { |
198 | 198 | $message = "<info>Update successful</info>"; |
199 | 199 | } else { |
@@ -201,58 +201,58 @@ discard block |
||
201 | 201 | } |
202 | 202 | $output->writeln($message); |
203 | 203 | }); |
204 | - $updater->listen('\OC\Updater', 'dbUpgradeBefore', function () use($output) { |
|
204 | + $updater->listen('\OC\Updater', 'dbUpgradeBefore', function() use($output) { |
|
205 | 205 | $output->writeln('<info>Updating database schema</info>'); |
206 | 206 | }); |
207 | - $updater->listen('\OC\Updater', 'dbUpgrade', function () use($output) { |
|
207 | + $updater->listen('\OC\Updater', 'dbUpgrade', function() use($output) { |
|
208 | 208 | $output->writeln('<info>Updated database</info>'); |
209 | 209 | }); |
210 | - $updater->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function () use($output) { |
|
210 | + $updater->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function() use($output) { |
|
211 | 211 | $output->writeln('<info>Checking whether the database schema can be updated (this can take a long time depending on the database size)</info>'); |
212 | 212 | }); |
213 | - $updater->listen('\OC\Updater', 'dbSimulateUpgrade', function () use($output) { |
|
213 | + $updater->listen('\OC\Updater', 'dbSimulateUpgrade', function() use($output) { |
|
214 | 214 | $output->writeln('<info>Checked database schema update</info>'); |
215 | 215 | }); |
216 | - $updater->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use($output) { |
|
217 | - $output->writeln('<comment>Disabled incompatible app: ' . $app . '</comment>'); |
|
216 | + $updater->listen('\OC\Updater', 'incompatibleAppDisabled', function($app) use($output) { |
|
217 | + $output->writeln('<comment>Disabled incompatible app: '.$app.'</comment>'); |
|
218 | 218 | }); |
219 | - $updater->listen('\OC\Updater', 'checkAppStoreAppBefore', function ($app) use($output) { |
|
220 | - $output->writeln('<info>Checking for update of app ' . $app . ' in appstore</info>'); |
|
219 | + $updater->listen('\OC\Updater', 'checkAppStoreAppBefore', function($app) use($output) { |
|
220 | + $output->writeln('<info>Checking for update of app '.$app.' in appstore</info>'); |
|
221 | 221 | }); |
222 | - $updater->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use($output) { |
|
223 | - $output->writeln('<info>Update app ' . $app . ' from appstore</info>'); |
|
222 | + $updater->listen('\OC\Updater', 'upgradeAppStoreApp', function($app) use($output) { |
|
223 | + $output->writeln('<info>Update app '.$app.' from appstore</info>'); |
|
224 | 224 | }); |
225 | - $updater->listen('\OC\Updater', 'checkAppStoreApp', function ($app) use($output) { |
|
226 | - $output->writeln('<info>Checked for update of app "' . $app . '" in appstore </info>'); |
|
225 | + $updater->listen('\OC\Updater', 'checkAppStoreApp', function($app) use($output) { |
|
226 | + $output->writeln('<info>Checked for update of app "'.$app.'" in appstore </info>'); |
|
227 | 227 | }); |
228 | - $updater->listen('\OC\Updater', 'appUpgradeCheckBefore', function () use ($output) { |
|
228 | + $updater->listen('\OC\Updater', 'appUpgradeCheckBefore', function() use ($output) { |
|
229 | 229 | $output->writeln('<info>Checking updates of apps</info>'); |
230 | 230 | }); |
231 | - $updater->listen('\OC\Updater', 'appSimulateUpdate', function ($app) use ($output) { |
|
231 | + $updater->listen('\OC\Updater', 'appSimulateUpdate', function($app) use ($output) { |
|
232 | 232 | $output->writeln("<info>Checking whether the database schema for <$app> can be updated (this can take a long time depending on the database size)</info>"); |
233 | 233 | }); |
234 | - $updater->listen('\OC\Updater', 'appUpgradeCheck', function () use ($output) { |
|
234 | + $updater->listen('\OC\Updater', 'appUpgradeCheck', function() use ($output) { |
|
235 | 235 | $output->writeln('<info>Checked database schema update for apps</info>'); |
236 | 236 | }); |
237 | - $updater->listen('\OC\Updater', 'appUpgradeStarted', function ($app, $version) use ($output) { |
|
237 | + $updater->listen('\OC\Updater', 'appUpgradeStarted', function($app, $version) use ($output) { |
|
238 | 238 | $output->writeln("<info>Updating <$app> ...</info>"); |
239 | 239 | }); |
240 | - $updater->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($output) { |
|
240 | + $updater->listen('\OC\Updater', 'appUpgrade', function($app, $version) use ($output) { |
|
241 | 241 | $output->writeln("<info>Updated <$app> to $version</info>"); |
242 | 242 | }); |
243 | - $updater->listen('\OC\Updater', 'failure', function ($message) use($output, $self) { |
|
243 | + $updater->listen('\OC\Updater', 'failure', function($message) use($output, $self) { |
|
244 | 244 | $output->writeln("<error>$message</error>"); |
245 | 245 | }); |
246 | - $updater->listen('\OC\Updater', 'setDebugLogLevel', function ($logLevel, $logLevelName) use($output) { |
|
246 | + $updater->listen('\OC\Updater', 'setDebugLogLevel', function($logLevel, $logLevelName) use($output) { |
|
247 | 247 | $output->writeln("<info>Set log level to debug</info>"); |
248 | 248 | }); |
249 | - $updater->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use($output) { |
|
249 | + $updater->listen('\OC\Updater', 'resetLogLevel', function($logLevel, $logLevelName) use($output) { |
|
250 | 250 | $output->writeln("<info>Reset log level</info>"); |
251 | 251 | }); |
252 | - $updater->listen('\OC\Updater', 'startCheckCodeIntegrity', function () use($output) { |
|
252 | + $updater->listen('\OC\Updater', 'startCheckCodeIntegrity', function() use($output) { |
|
253 | 253 | $output->writeln("<info>Starting code integrity check...</info>"); |
254 | 254 | }); |
255 | - $updater->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function () use($output) { |
|
255 | + $updater->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function() use($output) { |
|
256 | 256 | $output->writeln("<info>Finished code integrity check</info>"); |
257 | 257 | }); |
258 | 258 | |
@@ -260,12 +260,12 @@ discard block |
||
260 | 260 | |
261 | 261 | $this->postUpgradeCheck($input, $output); |
262 | 262 | |
263 | - if(!$success) { |
|
263 | + if (!$success) { |
|
264 | 264 | return self::ERROR_FAILURE; |
265 | 265 | } |
266 | 266 | |
267 | 267 | return self::ERROR_SUCCESS; |
268 | - } else if($this->config->getSystemValue('maintenance', false)) { |
|
268 | + } else if ($this->config->getSystemValue('maintenance', false)) { |
|
269 | 269 | //Possible scenario: Nextcloud core is updated but an app failed |
270 | 270 | $output->writeln('<warning>Nextcloud is in maintenance mode</warning>'); |
271 | 271 | $output->write('<comment>Maybe an upgrade is already in process. Please check the ' |
@@ -290,8 +290,8 @@ discard block |
||
290 | 290 | $trustedDomains = $this->config->getSystemValue('trusted_domains', array()); |
291 | 291 | if (empty($trustedDomains)) { |
292 | 292 | $output->write( |
293 | - '<warning>The setting "trusted_domains" could not be ' . |
|
294 | - 'set automatically by the upgrade script, ' . |
|
293 | + '<warning>The setting "trusted_domains" could not be '. |
|
294 | + 'set automatically by the upgrade script, '. |
|
295 | 295 | 'please set it manually</warning>' |
296 | 296 | ); |
297 | 297 | } |
@@ -201,7 +201,7 @@ |
||
201 | 201 | */ |
202 | 202 | public function update($id, array $scope) { |
203 | 203 | try { |
204 | - $token = $this->tokenProvider->getTokenById((string)$id); |
|
204 | + $token = $this->tokenProvider->getTokenById((string) $id); |
|
205 | 205 | if ($token->getUID() !== $this->uid) { |
206 | 206 | throw new InvalidTokenException('User mismatch'); |
207 | 207 | } |