@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | private function mapTrashItems(array $items, IUser $user, ITrashItem $parent = null): array { |
| 53 | 53 | $parentTrashPath = ($parent instanceof ITrashItem) ? $parent->getTrashPath() : ''; |
| 54 | 54 | $isRoot = $parent === null; |
| 55 | - return array_map(function (FileInfo $file) use ($parent, $parentTrashPath, $isRoot, $user) { |
|
| 56 | - $originalLocation = $isRoot ? $file['extraData'] : $parent->getOriginalLocation() . '/' . $file->getName(); |
|
| 55 | + return array_map(function(FileInfo $file) use ($parent, $parentTrashPath, $isRoot, $user) { |
|
| 56 | + $originalLocation = $isRoot ? $file['extraData'] : $parent->getOriginalLocation().'/'.$file->getName(); |
|
| 57 | 57 | if (!$originalLocation) { |
| 58 | 58 | $originalLocation = $file->getName(); |
| 59 | 59 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | $this, |
| 62 | 62 | $originalLocation, |
| 63 | 63 | $file->getMTime(), |
| 64 | - $parentTrashPath . '/' . $file->getName() . ($isRoot ? '.d' . $file->getMtime() : ''), |
|
| 64 | + $parentTrashPath.'/'.$file->getName().($isRoot ? '.d'.$file->getMtime() : ''), |
|
| 65 | 65 | $file, |
| 66 | 66 | $user |
| 67 | 67 | ); |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | public function listTrashFolder(ITrashItem $folder): array { |
| 77 | 77 | $user = $folder->getUser(); |
| 78 | 78 | $entries = Helper::getTrashFiles($folder->getTrashPath(), $user->getUID()); |
| 79 | - return $this->mapTrashItems($entries, $user ,$folder); |
|
| 79 | + return $this->mapTrashItems($entries, $user, $folder); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | public function restoreItem(ITrashItem $item) { |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | public function removeItem(ITrashItem $item) { |
| 87 | 87 | $user = $item->getUser(); |
| 88 | 88 | if ($item->isRootItem()) { |
| 89 | - $path = substr($item->getTrashPath(), 0, -strlen('.d' . $item->getDeletedTime())); |
|
| 89 | + $path = substr($item->getTrashPath(), 0, -strlen('.d'.$item->getDeletedTime())); |
|
| 90 | 90 | Trashbin::delete($path, $user->getUID(), $item->getDeletedTime()); |
| 91 | 91 | } else { |
| 92 | 92 | Trashbin::delete($item->getTrashPath(), $user->getUID(), null); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | if (!$storage instanceof Storage) { |
| 99 | 99 | return false; |
| 100 | 100 | } |
| 101 | - $normalized = Filesystem::normalizePath($storage->getMountPoint() . '/' . $internalPath, true, false, true); |
|
| 101 | + $normalized = Filesystem::normalizePath($storage->getMountPoint().'/'.$internalPath, true, false, true); |
|
| 102 | 102 | $view = Filesystem::getView(); |
| 103 | 103 | if (!isset($this->deletedFiles[$normalized]) && $view instanceof View) { |
| 104 | 104 | $this->deletedFiles[$normalized] = $normalized; |
@@ -55,12 +55,12 @@ discard block |
||
| 55 | 55 | $file2 = array_pop($nodes); |
| 56 | 56 | $versions = Storage::getVersions($user->getUID(), $userFolder->getRelativePath($file2->getPath())); |
| 57 | 57 | |
| 58 | - return array_map(function (array $data) use ($file, $user) { |
|
| 58 | + return array_map(function(array $data) use ($file, $user) { |
|
| 59 | 59 | return new Version( |
| 60 | - (int)$data['version'], |
|
| 61 | - (int)$data['version'], |
|
| 60 | + (int) $data['version'], |
|
| 61 | + (int) $data['version'], |
|
| 62 | 62 | $data['name'], |
| 63 | - (int)$data['size'], |
|
| 63 | + (int) $data['size'], |
|
| 64 | 64 | $data['mimetype'], |
| 65 | 65 | $data['path'], |
| 66 | 66 | $file, |
@@ -73,16 +73,16 @@ discard block |
||
| 73 | 73 | public function createVersion(IUser $user, FileInfo $file) { |
| 74 | 74 | $userFolder = $this->rootFolder->getUserFolder($user->getUID()); |
| 75 | 75 | $relativePath = $userFolder->getRelativePath($file->getPath()); |
| 76 | - $userView = new View('/' . $user->getUID()); |
|
| 76 | + $userView = new View('/'.$user->getUID()); |
|
| 77 | 77 | // create all parent folders |
| 78 | 78 | Storage::createMissingDirectories($relativePath, $userView); |
| 79 | 79 | |
| 80 | 80 | Storage::scheduleExpire($user->getUID(), $relativePath); |
| 81 | 81 | |
| 82 | 82 | // store a new version of a file |
| 83 | - $userView->copy('files/' . $relativePath, 'files_versions/' . $relativePath . '.v' . $file->getMtime()); |
|
| 83 | + $userView->copy('files/'.$relativePath, 'files_versions/'.$relativePath.'.v'.$file->getMtime()); |
|
| 84 | 84 | // ensure the file is scanned |
| 85 | - $userView->getFileInfo('files_versions/' . $relativePath . '.v' . $file->getMtime()); |
|
| 85 | + $userView->getFileInfo('files_versions/'.$relativePath.'.v'.$file->getMtime()); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | public function rollback(IVersion $version) { |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | public function read(IVersion $version) { |
| 105 | 105 | $versions = $this->getVersionFolder($version->getUser()); |
| 106 | 106 | /** @var File $file */ |
| 107 | - $file = $versions->get($version->getVersionPath() . '.v' . $version->getRevisionId()); |
|
| 107 | + $file = $versions->get($version->getVersionPath().'.v'.$version->getRevisionId()); |
|
| 108 | 108 | return $file->fopen('r'); |
| 109 | 109 | } |
| 110 | 110 | |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | $userFolder = $this->rootFolder->getUserFolder($user->getUID()); |
| 113 | 113 | $versionFolder = $this->getVersionFolder($user); |
| 114 | 114 | /** @var File $file */ |
| 115 | - $file = $versionFolder->get($userFolder->getRelativePath($sourceFile->getPath()) . '.v' . $revision); |
|
| 115 | + $file = $versionFolder->get($userFolder->getRelativePath($sourceFile->getPath()).'.v'.$revision); |
|
| 116 | 116 | return $file; |
| 117 | 117 | } |
| 118 | 118 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | |
| 53 | 53 | public function setName($name) { |
| 54 | - throw new Forbidden('Renaming ' . self::FILENAME . ' is forbidden'); |
|
| 54 | + throw new Forbidden('Renaming '.self::FILENAME.' is forbidden'); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * @throws Forbidden |
| 66 | 66 | */ |
| 67 | 67 | public function delete() { |
| 68 | - throw new Forbidden(self::FILENAME . ' may not be deleted.'); |
|
| 68 | + throw new Forbidden(self::FILENAME.' may not be deleted.'); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -86,6 +86,6 @@ discard block |
||
| 86 | 86 | * @throws Forbidden |
| 87 | 87 | */ |
| 88 | 88 | public function propPatch(PropPatch $propPatch) { |
| 89 | - throw new Forbidden(self::FILENAME . '\'s properties may not be altered.'); |
|
| 89 | + throw new Forbidden(self::FILENAME.'\'s properties may not be altered.'); |
|
| 90 | 90 | } |
| 91 | 91 | } |
@@ -90,8 +90,8 @@ discard block |
||
| 90 | 90 | * @return string short footer |
| 91 | 91 | */ |
| 92 | 92 | public function getShortFooter() { |
| 93 | - $footer = '© ' . date('Y') . ' <a href="' . $this->getBaseUrl() . '" target="_blank">' . $this->getEntity() . '</a>' . |
|
| 94 | - '<br/>' . $this->getSlogan(); |
|
| 93 | + $footer = '© '.date('Y').' <a href="'.$this->getBaseUrl().'" target="_blank">'.$this->getEntity().'</a>'. |
|
| 94 | + '<br/>'.$this->getSlogan(); |
|
| 95 | 95 | |
| 96 | 96 | return $footer; |
| 97 | 97 | } |
@@ -101,8 +101,8 @@ discard block |
||
| 101 | 101 | * @return string long footer |
| 102 | 102 | */ |
| 103 | 103 | public function getLongFooter() { |
| 104 | - $footer = '© ' . date('Y') . ' <a href="' . $this->getBaseUrl() . '" target="_blank">' . $this->getEntity() . '</a>' . |
|
| 105 | - '<br/>' . $this->getSlogan(); |
|
| 104 | + $footer = '© '.date('Y').' <a href="'.$this->getBaseUrl().'" target="_blank">'.$this->getEntity().'</a>'. |
|
| 105 | + '<br/>'.$this->getSlogan(); |
|
| 106 | 106 | |
| 107 | 107 | return $footer; |
| 108 | 108 | } |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | * @return string documentation link |
| 113 | 113 | */ |
| 114 | 114 | public function buildDocLinkToKey($key) { |
| 115 | - return $this->getDocBaseUrl() . '/server/15/go.php?to=' . $key; |
|
| 115 | + return $this->getDocBaseUrl().'/server/15/go.php?to='.$key; |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | return; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - $folders = array_filter($folders, function (ISimpleFolder $folder) { |
|
| 70 | + $folders = array_filter($folders, function(ISimpleFolder $folder) { |
|
| 71 | 71 | return $folder->fileExists('photo.'); |
| 72 | 72 | }); |
| 73 | 73 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | return; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - $output->info('Delete ' . count($folders) . ' "photo." files'); |
|
| 78 | + $output->info('Delete '.count($folders).' "photo." files'); |
|
| 79 | 79 | |
| 80 | 80 | foreach ($folders as $folder) { |
| 81 | 81 | try { |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $folder->getFile('photo.')->delete(); |
| 84 | 84 | } catch (\Exception $e) { |
| 85 | 85 | $this->logger->logException($e); |
| 86 | - $output->warning('Could not delete file "dav-photocache/' . $folder->getName() . '/photo."'); |
|
| 86 | + $output->warning('Could not delete file "dav-photocache/'.$folder->getName().'/photo."'); |
|
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | } |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | |
| 212 | 212 | private function hashToken(string $token): string { |
| 213 | 213 | $secret = $this->config->getSystemValue('secret'); |
| 214 | - return hash('sha512', $token . $secret); |
|
| 214 | + return hash('sha512', $token.$secret); |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | private function getKeyPair(): array { |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | while ($error = openssl_error_string()) { |
| 242 | 242 | $errors[] = $error; |
| 243 | 243 | } |
| 244 | - $this->logger->critical('Something is wrong with your openssl setup: ' . implode(', ', $errors)); |
|
| 244 | + $this->logger->critical('Something is wrong with your openssl setup: '.implode(', ', $errors)); |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | private function encryptPassword(string $password, string $publicKey): string { |
@@ -389,7 +389,7 @@ |
||
| 389 | 389 | foreach ($ak as $source) { |
| 390 | 390 | $tags = $this->subTags[$source]; |
| 391 | 391 | foreach ($tags as $tag) { |
| 392 | - $subTags[] = $source . '_' . $tag; |
|
| 392 | + $subTags[] = $source.'_'.$tag; |
|
| 393 | 393 | } |
| 394 | 394 | } |
| 395 | 395 | |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | $providers = $this->registry->getProviderStates($event->getUser()); |
| 54 | 54 | |
| 55 | 55 | // Loop over all providers. If all are disabled we remove the job |
| 56 | - $state = array_reduce($providers, function (bool $carry, bool $enabled) { |
|
| 56 | + $state = array_reduce($providers, function(bool $carry, bool $enabled) { |
|
| 57 | 57 | return $carry || $enabled; |
| 58 | 58 | }, false); |
| 59 | 59 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | ->setFirstResult($start); |
| 145 | 145 | |
| 146 | 146 | if ($filter !== '') { |
| 147 | - $query->where($query->expr()->iLike('c.name', $query->createNamedParameter('%' . $this->connection->escapeLikeParameter($filter) . '%'))); |
|
| 147 | + $query->where($query->expr()->iLike('c.name', $query->createNamedParameter('%'.$this->connection->escapeLikeParameter($filter).'%'))); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | $result = $query->execute(); |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | while ($row = $result->fetch()) { |
| 155 | 155 | $foundResults++; |
| 156 | 156 | $access = $row['access'] === null ? null : (bool) $row['access']; |
| 157 | - $collection = new Collection($this, $this->connection, (int)$row['id'], (string)$row['name'], $user, $access); |
|
| 157 | + $collection = new Collection($this, $this->connection, (int) $row['id'], (string) $row['name'], $user, $access); |
|
| 158 | 158 | if ($collection->canAccess($user)) { |
| 159 | 159 | $collections[] = $collection; |
| 160 | 160 | } |