@@ -78,12 +78,12 @@ |
||
78 | 78 | |
79 | 79 | if ($size <= 64) { |
80 | 80 | if ($size !== 64) { |
81 | - $this->logger->debug('Avatar requested in deprecated size ' . $size); |
|
81 | + $this->logger->debug('Avatar requested in deprecated size '.$size); |
|
82 | 82 | } |
83 | 83 | $size = 64; |
84 | 84 | } else { |
85 | 85 | if ($size !== 512) { |
86 | - $this->logger->debug('Avatar requested in deprecated size ' . $size); |
|
86 | + $this->logger->debug('Avatar requested in deprecated size '.$size); |
|
87 | 87 | } |
88 | 88 | $size = 512; |
89 | 89 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | $entriesToUpdate = $this->estimateNumberOfUpdates($input); |
141 | 141 | $progress = new ProgressBar($output); |
142 | 142 | $progress->start($entriesToUpdate); |
143 | - foreach($this->handleUpdates($input) as $_) { |
|
143 | + foreach ($this->handleUpdates($input) as $_) { |
|
144 | 144 | $progress->advance(); |
145 | 145 | } |
146 | 146 | $progress->finish(); |
@@ -190,9 +190,9 @@ discard block |
||
190 | 190 | if ($output->isVerbose()) { |
191 | 191 | /** @var UuidUpdateReport $report */ |
192 | 192 | foreach ($this->reports[UuidUpdateReport::UNKNOWN] as $report) { |
193 | - $output->writeln(sprintf(' %s: %s',$report->isUser ? 'User' : 'Group', $report->id)); |
|
193 | + $output->writeln(sprintf(' %s: %s', $report->isUser ? 'User' : 'Group', $report->id)); |
|
194 | 194 | } |
195 | - $output->writeln(PHP_EOL . 'Old users can be removed along with their data per occ user:delete.' . PHP_EOL); |
|
195 | + $output->writeln(PHP_EOL.'Old users can be removed along with their data per occ user:delete.'.PHP_EOL); |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | if ($output->isVerbose()) { |
202 | 202 | /** @var UuidUpdateReport $report */ |
203 | 203 | foreach ($this->reports[UuidUpdateReport::UNREADABLE] as $report) { |
204 | - $output->writeln(sprintf(' %s: %s',$report->isUser ? 'User' : 'Group', $report->id)); |
|
204 | + $output->writeln(sprintf(' %s: %s', $report->isUser ? 'User' : 'Group', $report->id)); |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | } |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | if ($output->isVerbose()) { |
212 | 212 | /** @var UuidUpdateReport $report */ |
213 | 213 | foreach ($this->reports[UuidUpdateReport::UNWRITABLE] as $report) { |
214 | - $output->writeln(sprintf(' %s: %s',$report->isUser ? 'User' : 'Group', $report->id)); |
|
214 | + $output->writeln(sprintf(' %s: %s', $report->isUser ? 'User' : 'Group', $report->id)); |
|
215 | 215 | } |
216 | 216 | } |
217 | 217 | } |
@@ -219,37 +219,37 @@ discard block |
||
219 | 219 | |
220 | 220 | protected function handleUpdates(InputInterface $input): \Generator { |
221 | 221 | if ($input->getOption('all')) { |
222 | - foreach($this->handleMappingBasedUpdates(false) as $_) { |
|
222 | + foreach ($this->handleMappingBasedUpdates(false) as $_) { |
|
223 | 223 | yield; |
224 | 224 | } |
225 | 225 | } else if ($input->getOption('userId') |
226 | 226 | || $input->getOption('groupId') |
227 | 227 | || $input->getOption('dn') |
228 | 228 | ) { |
229 | - foreach($this->handleUpdatesByUserId($input->getOption('userId')) as $_) { |
|
229 | + foreach ($this->handleUpdatesByUserId($input->getOption('userId')) as $_) { |
|
230 | 230 | yield; |
231 | 231 | } |
232 | - foreach($this->handleUpdatesByGroupId($input->getOption('groupId')) as $_) { |
|
232 | + foreach ($this->handleUpdatesByGroupId($input->getOption('groupId')) as $_) { |
|
233 | 233 | yield; |
234 | 234 | } |
235 | - foreach($this->handleUpdatesByDN($input->getOption('dn')) as $_) { |
|
235 | + foreach ($this->handleUpdatesByDN($input->getOption('dn')) as $_) { |
|
236 | 236 | yield; |
237 | 237 | } |
238 | 238 | } else { |
239 | - foreach($this->handleMappingBasedUpdates(true) as $_) { |
|
239 | + foreach ($this->handleMappingBasedUpdates(true) as $_) { |
|
240 | 240 | yield; |
241 | 241 | } |
242 | 242 | } |
243 | 243 | } |
244 | 244 | |
245 | 245 | protected function handleUpdatesByUserId(array $userIds): \Generator { |
246 | - foreach($this->handleUpdatesByEntryId($userIds, $this->userMapping) as $_) { |
|
246 | + foreach ($this->handleUpdatesByEntryId($userIds, $this->userMapping) as $_) { |
|
247 | 247 | yield; |
248 | 248 | } |
249 | 249 | } |
250 | 250 | |
251 | 251 | protected function handleUpdatesByGroupId(array $groupIds): \Generator { |
252 | - foreach($this->handleUpdatesByEntryId($groupIds, $this->groupMapping) as $_) { |
|
252 | + foreach ($this->handleUpdatesByEntryId($groupIds, $this->groupMapping) as $_) { |
|
253 | 253 | yield; |
254 | 254 | } |
255 | 255 | } |
@@ -272,10 +272,10 @@ discard block |
||
272 | 272 | $this->reports[UuidUpdateReport::UNMAPPED][] = new UuidUpdateReport('', $dn, true, UuidUpdateReport::UNMAPPED); |
273 | 273 | yield; |
274 | 274 | } |
275 | - foreach($this->handleUpdatesByList($this->userMapping, $userList) as $_) { |
|
275 | + foreach ($this->handleUpdatesByList($this->userMapping, $userList) as $_) { |
|
276 | 276 | yield; |
277 | 277 | } |
278 | - foreach($this->handleUpdatesByList($this->groupMapping, $groupList) as $_) { |
|
278 | + foreach ($this->handleUpdatesByList($this->groupMapping, $groupList) as $_) { |
|
279 | 279 | yield; |
280 | 280 | } |
281 | 281 | } |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | $isUser = $mapping instanceof UserMapping; |
285 | 285 | $list = []; |
286 | 286 | while ($id = array_pop($ids)) { |
287 | - if(!$dn = $mapping->getDNByName($id)) { |
|
287 | + if (!$dn = $mapping->getDNByName($id)) { |
|
288 | 288 | $this->reports[UuidUpdateReport::UNMAPPED][] = new UuidUpdateReport($id, '', $isUser, UuidUpdateReport::UNMAPPED); |
289 | 289 | yield; |
290 | 290 | continue; |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | $uuid = $mapping->getUUIDByDN($dn); |
294 | 294 | $list[] = ['name' => $id, 'uuid' => $uuid]; |
295 | 295 | } |
296 | - foreach($this->handleUpdatesByList($mapping, $list) as $_) { |
|
296 | + foreach ($this->handleUpdatesByList($mapping, $list) as $_) { |
|
297 | 297 | yield; |
298 | 298 | } |
299 | 299 | } |
@@ -301,13 +301,13 @@ discard block |
||
301 | 301 | protected function handleMappingBasedUpdates(bool $invalidatedOnly): \Generator { |
302 | 302 | $limit = 1000; |
303 | 303 | /** @var AbstractMapping $mapping*/ |
304 | - foreach([$this->userMapping, $this->groupMapping] as $mapping) { |
|
304 | + foreach ([$this->userMapping, $this->groupMapping] as $mapping) { |
|
305 | 305 | $offset = 0; |
306 | 306 | do { |
307 | 307 | $list = $mapping->getList($offset, $limit, $invalidatedOnly); |
308 | 308 | $offset += $limit; |
309 | 309 | |
310 | - foreach($this->handleUpdatesByList($mapping, $list) as $tick) { |
|
310 | + foreach ($this->handleUpdatesByList($mapping, $list) as $tick) { |
|
311 | 311 | yield; // null, for it only advances progress counter |
312 | 312 | } |
313 | 313 | } while (count($list) === $limit); |
@@ -214,7 +214,7 @@ |
||
214 | 214 | |
215 | 215 | while ($nextcloudId = array_shift($idList)) { |
216 | 216 | $update->setParameter('nextcloudId', $nextcloudId); |
217 | - $update->setParameter('invalidatedUuid', 'invalidated_' . \bin2hex(\random_bytes(6))); |
|
217 | + $update->setParameter('invalidatedUuid', 'invalidated_'.\bin2hex(\random_bytes(6))); |
|
218 | 218 | try { |
219 | 219 | $update->executeStatement(); |
220 | 220 | $this->logger->warning( |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $output = $output ?? new NullOutput(); |
106 | 106 | $sourceUid = $sourceUser->getUID(); |
107 | 107 | $destinationUid = $destinationUser->getUID(); |
108 | - $sourcePath = rtrim($sourceUid . '/files/' . $path, '/'); |
|
108 | + $sourcePath = rtrim($sourceUid.'/files/'.$path, '/'); |
|
109 | 109 | |
110 | 110 | // If encryption is on we have to ensure the user has logged in before and that all encryption modules are ready |
111 | 111 | if (($this->encryptionManager->isEnabled() && $destinationUser->getLastLogin() === 0) |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | OutputInterface $output): void { |
239 | 239 | $output->writeln('Validating quota'); |
240 | 240 | $size = $view->getFileInfo($sourcePath, false)->getSize(false); |
241 | - $freeSpace = $view->free_space($destinationUid . '/files/'); |
|
241 | + $freeSpace = $view->free_space($destinationUid.'/files/'); |
|
242 | 242 | if ($size > $freeSpace && $freeSpace !== FileInfo::SPACE_UNKNOWN) { |
243 | 243 | $output->writeln('<error>Target user does not have enough free space available.</error>'); |
244 | 244 | throw new \Exception('Execution terminated.'); |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | |
251 | 251 | $encryptedFiles = []; |
252 | 252 | $this->walkFiles($view, $sourcePath, |
253 | - function (FileInfo $fileInfo) use ($progress) { |
|
253 | + function(FileInfo $fileInfo) use ($progress) { |
|
254 | 254 | if ($fileInfo->getType() === FileInfo::TYPE_FOLDER) { |
255 | 255 | // only analyze into folders from main storage, |
256 | 256 | if (!$fileInfo->getStorage()->instanceOfStorage(IHomeStorage::class)) { |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | $output->writeln("<error>Some files are encrypted - please decrypt them first.</error>"); |
273 | 273 | foreach ($encryptedFiles as $encryptedFile) { |
274 | 274 | /** @var FileInfo $encryptedFile */ |
275 | - $output->writeln(" " . $encryptedFile->getPath()); |
|
275 | + $output->writeln(" ".$encryptedFile->getPath()); |
|
276 | 276 | } |
277 | 277 | throw new \Exception('Execution terminated.'); |
278 | 278 | } |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | break; |
297 | 297 | } |
298 | 298 | if ($path !== "$sourceUid/files") { |
299 | - $sharePage = array_filter($sharePage, function (IShare $share) use ($view, $path) { |
|
299 | + $sharePage = array_filter($sharePage, function(IShare $share) use ($view, $path) { |
|
300 | 300 | try { |
301 | 301 | $relativePath = $view->getPath($share->getNodeId()); |
302 | 302 | $singleFileTranfer = $view->is_file($path); |
@@ -305,8 +305,8 @@ discard block |
||
305 | 305 | } |
306 | 306 | |
307 | 307 | return mb_strpos( |
308 | - Filesystem::normalizePath($relativePath . '/', false), |
|
309 | - Filesystem::normalizePath($path . '/', false)) === 0; |
|
308 | + Filesystem::normalizePath($relativePath.'/', false), |
|
309 | + Filesystem::normalizePath($path.'/', false)) === 0; |
|
310 | 310 | } catch (\Exception $e) { |
311 | 311 | return false; |
312 | 312 | } |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | // Else only the content inside folder is transferred which is not correct. |
372 | 372 | if ($sourcePath !== "$sourceUid/files") { |
373 | 373 | $view->mkdir($finalTarget); |
374 | - $finalTarget = $finalTarget . '/' . basename($sourcePath); |
|
374 | + $finalTarget = $finalTarget.'/'.basename($sourcePath); |
|
375 | 375 | } |
376 | 376 | if ($view->rename($sourcePath, $finalTarget) === false) { |
377 | 377 | throw new TransferOwnershipException("Could not transfer files.", 1); |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | if ($share->getShareType() === IShare::TYPE_USER && |
395 | 395 | $share->getSharedWith() === $destinationUid) { |
396 | 396 | // Unmount the shares before deleting, so we don't try to get the storage later on. |
397 | - $shareMountPoint = $this->mountManager->find('/' . $destinationUid . '/files' . $share->getTarget()); |
|
397 | + $shareMountPoint = $this->mountManager->find('/'.$destinationUid.'/files'.$share->getTarget()); |
|
398 | 398 | if ($shareMountPoint) { |
399 | 399 | $this->mountManager->removeMount($shareMountPoint->getMountPoint()); |
400 | 400 | } |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | if ($share->getShareType() === IShare::TYPE_USER && |
411 | 411 | !$this->userManager->userExists($share->getSharedWith())) { |
412 | 412 | // stray share with deleted user |
413 | - $output->writeln('<error>Share with id ' . $share->getId() . ' points at deleted user "' . $share->getSharedWith() . '", deleting</error>'); |
|
413 | + $output->writeln('<error>Share with id '.$share->getId().' points at deleted user "'.$share->getSharedWith().'", deleting</error>'); |
|
414 | 414 | $this->shareManager->deleteShare($share); |
415 | 415 | continue; |
416 | 416 | } else { |
@@ -423,9 +423,9 @@ discard block |
||
423 | 423 | } |
424 | 424 | } |
425 | 425 | } catch (\OCP\Files\NotFoundException $e) { |
426 | - $output->writeln('<error>Share with id ' . $share->getId() . ' points at deleted file, skipping</error>'); |
|
426 | + $output->writeln('<error>Share with id '.$share->getId().' points at deleted file, skipping</error>'); |
|
427 | 427 | } catch (\Throwable $e) { |
428 | - $output->writeln('<error>Could not restore share with id ' . $share->getId() . ':' . $e->getMessage() . ' : ' . $e->getTraceAsString() . '</error>'); |
|
428 | + $output->writeln('<error>Could not restore share with id '.$share->getId().':'.$e->getMessage().' : '.$e->getTraceAsString().'</error>'); |
|
429 | 429 | } |
430 | 430 | $progress->advance(); |
431 | 431 | } |
@@ -453,13 +453,13 @@ discard block |
||
453 | 453 | // Only restore if share is in given path. |
454 | 454 | $pathToCheck = '/'; |
455 | 455 | if (trim($path, '/') !== '') { |
456 | - $pathToCheck = '/' . trim($path) . '/'; |
|
456 | + $pathToCheck = '/'.trim($path).'/'; |
|
457 | 457 | } |
458 | 458 | if (substr($share->getTarget(), 0, strlen($pathToCheck)) !== $pathToCheck) { |
459 | 459 | continue; |
460 | 460 | } |
461 | 461 | $shareTarget = $share->getTarget(); |
462 | - $shareTarget = $finalShareTarget . $shareTarget; |
|
462 | + $shareTarget = $finalShareTarget.$shareTarget; |
|
463 | 463 | if ($share->getShareType() === IShare::TYPE_USER && |
464 | 464 | $share->getSharedBy() === $destinationUid) { |
465 | 465 | $this->shareManager->deleteShare($share); |
@@ -503,9 +503,9 @@ discard block |
||
503 | 503 | continue; |
504 | 504 | } |
505 | 505 | } catch (\OCP\Files\NotFoundException $e) { |
506 | - $output->writeln('<error>Share with id ' . $share->getId() . ' points at deleted file, skipping</error>'); |
|
506 | + $output->writeln('<error>Share with id '.$share->getId().' points at deleted file, skipping</error>'); |
|
507 | 507 | } catch (\Throwable $e) { |
508 | - $output->writeln('<error>Could not restore share with id ' . $share->getId() . ':' . $e->getTraceAsString() . '</error>'); |
|
508 | + $output->writeln('<error>Could not restore share with id '.$share->getId().':'.$e->getTraceAsString().'</error>'); |
|
509 | 509 | } |
510 | 510 | $progress->advance(); |
511 | 511 | } |
@@ -128,12 +128,12 @@ discard block |
||
128 | 128 | |
129 | 129 | sort($serverConnections); |
130 | 130 | $lastKey = array_pop($serverConnections); |
131 | - $lastNumber = (int)str_replace('s', '', $lastKey); |
|
132 | - return 's' . str_pad((string)($lastNumber + 1), 2, '0', STR_PAD_LEFT); |
|
131 | + $lastNumber = (int) str_replace('s', '', $lastKey); |
|
132 | + return 's'.str_pad((string) ($lastNumber + 1), 2, '0', STR_PAD_LEFT); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | private function getServersConfig(string $value): array { |
136 | - $regex = '/' . $value . '$/S'; |
|
136 | + $regex = '/'.$value.'$/S'; |
|
137 | 137 | |
138 | 138 | $keys = $this->config->getAppKeys('user_ldap'); |
139 | 139 | $result = []; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $query = $this->connection->getQueryBuilder(); |
161 | 161 | $query->delete('appconfig') |
162 | 162 | ->where($query->expr()->eq('appid', $query->createNamedParameter('user_ldap'))) |
163 | - ->andWhere($query->expr()->like('configkey', $query->createNamedParameter((string)$prefix . '%'))) |
|
163 | + ->andWhere($query->expr()->like('configkey', $query->createNamedParameter((string) $prefix.'%'))) |
|
164 | 164 | ->andWhere($query->expr()->notIn('configkey', $query->createNamedParameter([ |
165 | 165 | 'enabled', |
166 | 166 | 'installed_version', |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | } |
226 | 226 | |
227 | 227 | if (!is_string($dn)) { |
228 | - throw new \LogicException('String expected ' . \gettype($dn) . ' given'); |
|
228 | + throw new \LogicException('String expected '.\gettype($dn).' given'); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | if (($sanitizedDn = $this->sanitizeDnCache->get($dn)) !== null) { |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | $template->setSubject($l->t('Password for %1$s changed on %2$s', [$user->getDisplayName(), $instanceName])); |
141 | 141 | $template->addHeader(); |
142 | 142 | $template->addHeading($l->t('Password changed for %s', [$user->getDisplayName()]), false); |
143 | - $template->addBodyText($text . ' ' . $l->t('If you did not request this, please contact an administrator.')); |
|
143 | + $template->addBodyText($text.' '.$l->t('If you did not request this, please contact an administrator.')); |
|
144 | 144 | $template->addFooter(); |
145 | 145 | |
146 | 146 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | $template->setSubject($l->t('Email address for %1$s changed on %2$s', [$user->getDisplayName(), $instanceUrl])); |
205 | 205 | $template->addHeader(); |
206 | 206 | $template->addHeading($l->t('Email address changed for %s', [$user->getDisplayName()]), false); |
207 | - $template->addBodyText($text . ' ' . $l->t('If you did not request this, please contact an administrator.')); |
|
207 | + $template->addBodyText($text.' '.$l->t('If you did not request this, please contact an administrator.')); |
|
208 | 208 | if ($user->getEMailAddress()) { |
209 | 209 | $template->addBodyText($l->t('The new email address is %s', [$user->getEMailAddress()])); |
210 | 210 | } |
@@ -103,13 +103,13 @@ discard block |
||
103 | 103 | $this->dui->markUser($uid); |
104 | 104 | $output->writeln('The user does not exists on LDAP anymore.'); |
105 | 105 | $output->writeln('Clean up the user\'s remnants by: ./occ user:delete "' |
106 | - . $uid . '"'); |
|
106 | + . $uid.'"'); |
|
107 | 107 | return 0; |
108 | 108 | } else { |
109 | 109 | throw new \Exception('The given user is not a recognized LDAP user.'); |
110 | 110 | } |
111 | 111 | } catch (\Exception $e) { |
112 | - $output->writeln('<error>' . $e->getMessage(). '</error>'); |
|
112 | + $output->writeln('<error>'.$e->getMessage().'</error>'); |
|
113 | 113 | return 1; |
114 | 114 | } |
115 | 115 | } |
@@ -146,12 +146,12 @@ discard block |
||
146 | 146 | $avatarAttributes = $access->getConnection()->resolveRule('avatar'); |
147 | 147 | $result = $access->search('objectclass=*', $user->getDN(), $attrs, 1, 0); |
148 | 148 | foreach ($result[0] as $attribute => $valueSet) { |
149 | - $output->writeln(' ' . $attribute . ': '); |
|
149 | + $output->writeln(' '.$attribute.': '); |
|
150 | 150 | foreach ($valueSet as $value) { |
151 | 151 | if (in_array($attribute, $avatarAttributes)) { |
152 | 152 | $value = '{ImageData}'; |
153 | 153 | } |
154 | - $output->writeln(' ' . $value); |
|
154 | + $output->writeln(' '.$value); |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 | $access->batchApplyUserAttributes($result); |
@@ -53,6 +53,6 @@ |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | public function getPath(): string { |
56 | - return $this->getMountPoint() . $this->getInternalPath(); |
|
56 | + return $this->getMountPoint().$this->getInternalPath(); |
|
57 | 57 | } |
58 | 58 | } |
@@ -54,15 +54,15 @@ |
||
54 | 54 | public function getMountsForUser(IUser $user, IStorageFactory $loader) { |
55 | 55 | $cacheBaseDir = $this->config->getSystemValue('cache_path', ''); |
56 | 56 | if ($cacheBaseDir !== '') { |
57 | - $cacheDir = rtrim($cacheBaseDir, '/') . '/' . $user->getUID(); |
|
57 | + $cacheDir = rtrim($cacheBaseDir, '/').'/'.$user->getUID(); |
|
58 | 58 | if (!file_exists($cacheDir)) { |
59 | 59 | mkdir($cacheDir, 0770, true); |
60 | - mkdir($cacheDir . '/uploads', 0770, true); |
|
60 | + mkdir($cacheDir.'/uploads', 0770, true); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | return [ |
64 | - new MountPoint('\OC\Files\Storage\Local', '/' . $user->getUID() . '/cache', ['datadir' => $cacheDir], $loader, null, null, self::class), |
|
65 | - new MountPoint('\OC\Files\Storage\Local', '/' . $user->getUID() . '/uploads', ['datadir' => $cacheDir . '/uploads'], $loader, null, null, self::class) |
|
64 | + new MountPoint('\OC\Files\Storage\Local', '/'.$user->getUID().'/cache', ['datadir' => $cacheDir], $loader, null, null, self::class), |
|
65 | + new MountPoint('\OC\Files\Storage\Local', '/'.$user->getUID().'/uploads', ['datadir' => $cacheDir.'/uploads'], $loader, null, null, self::class) |
|
66 | 66 | ]; |
67 | 67 | } else { |
68 | 68 | return []; |