@@ -66,9 +66,9 @@ discard block |
||
| 66 | 66 | $qResult->closeCursor(); |
| 67 | 67 | $this->assertCount(1, $result); |
| 68 | 68 | $this->assertSame($expectedUrl, $result[0]['url']); |
| 69 | - $this->assertSame($id, (int)$result[0]['id']); |
|
| 69 | + $this->assertSame($id, (int) $result[0]['id']); |
|
| 70 | 70 | $this->assertSame($expectedHash, $result[0]['url_hash']); |
| 71 | - $this->assertSame(TrustedServers::STATUS_PENDING, (int)$result[0]['status']); |
|
| 71 | + $this->assertSame(TrustedServers::STATUS_PENDING, (int) $result[0]['status']); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | public static function dataTestAddServer(): array { |
@@ -91,8 +91,8 @@ discard block |
||
| 91 | 91 | $this->assertCount(2, $result); |
| 92 | 92 | $this->assertSame('server1', $result[0]['url']); |
| 93 | 93 | $this->assertSame('server2', $result[1]['url']); |
| 94 | - $this->assertSame($id1, (int)$result[0]['id']); |
|
| 95 | - $this->assertSame($id2, (int)$result[1]['id']); |
|
| 94 | + $this->assertSame($id1, (int) $result[0]['id']); |
|
| 95 | + $this->assertSame($id2, (int) $result[1]['id']); |
|
| 96 | 96 | |
| 97 | 97 | $this->dbHandler->removeServer($id2); |
| 98 | 98 | $query = $this->connection->getQueryBuilder()->select('*')->from($this->dbTable); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $qResult->closeCursor(); |
| 103 | 103 | $this->assertCount(1, $result); |
| 104 | 104 | $this->assertSame('server1', $result[0]['url']); |
| 105 | - $this->assertSame($id1, (int)$result[0]['id']); |
|
| 105 | + $this->assertSame($id1, (int) $result[0]['id']); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | |
@@ -122,8 +122,8 @@ discard block |
||
| 122 | 122 | $this->assertSame(2, count($result)); |
| 123 | 123 | $this->assertSame('server1', $result[0]['url']); |
| 124 | 124 | $this->assertSame('server2', $result[1]['url']); |
| 125 | - $this->assertSame($id1, (int)$result[0]['id']); |
|
| 126 | - $this->assertSame($id2, (int)$result[1]['id']); |
|
| 125 | + $this->assertSame($id1, (int) $result[0]['id']); |
|
| 126 | + $this->assertSame($id2, (int) $result[1]['id']); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | #[\PHPUnit\Framework\Attributes\DataProvider('dataTestServerExists')] |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | $result = $qResult->fetchAllAssociative(); |
| 205 | 205 | $qResult->closeCursor(); |
| 206 | 206 | $this->assertCount(1, $result); |
| 207 | - $this->assertSame(TrustedServers::STATUS_PENDING, (int)$result[0]['status']); |
|
| 207 | + $this->assertSame(TrustedServers::STATUS_PENDING, (int) $result[0]['status']); |
|
| 208 | 208 | $this->dbHandler->setServerStatus('http://server1', TrustedServers::STATUS_OK); |
| 209 | 209 | $query = $this->connection->getQueryBuilder()->select('*')->from($this->dbTable); |
| 210 | 210 | |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $result = $qResult->fetchAllAssociative(); |
| 213 | 213 | $qResult->closeCursor(); |
| 214 | 214 | $this->assertCount(1, $result); |
| 215 | - $this->assertSame(TrustedServers::STATUS_OK, (int)$result[0]['status']); |
|
| 215 | + $this->assertSame(TrustedServers::STATUS_OK, (int) $result[0]['status']); |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | public function testGetServerStatus(): void { |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | return $query->getLastInsertId(); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - $message = 'Internal failure, Could not add trusted server: ' . $url; |
|
| 57 | + $message = 'Internal failure, Could not add trusted server: '.$url; |
|
| 58 | 58 | $message_t = $this->IL10N->t('Could not add server'); |
| 59 | 59 | throw new HintException($message, $message_t); |
| 60 | 60 | return -1; |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $qResult->closeCursor(); |
| 90 | 90 | |
| 91 | 91 | if ($result === false) { |
| 92 | - throw new \Exception('No Server found with ID: ' . $id); |
|
| 92 | + throw new \Exception('No Server found with ID: '.$id); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | return $result; |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | $statement->closeCursor(); |
| 159 | 159 | |
| 160 | 160 | if (!isset($result['token'])) { |
| 161 | - throw new \Exception('No token found for: ' . $url); |
|
| 161 | + throw new \Exception('No token found for: '.$url); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | return $result['token']; |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | $statement = $query->executeQuery(); |
| 192 | 192 | $result = $statement->fetchAssociative(); |
| 193 | 193 | $statement->closeCursor(); |
| 194 | - return (string)$result['shared_secret']; |
|
| 194 | + return (string) $result['shared_secret']; |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | /** |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | $statement = $query->executeQuery(); |
| 223 | 223 | $result = $statement->fetchAssociative(); |
| 224 | 224 | $statement->closeCursor(); |
| 225 | - return (int)$result['status']; |
|
| 225 | + return (int) $result['status']; |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | /** |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * @return array<IShare>|\Iterator |
| 79 | 79 | * @throws Exception if a database error occurs |
| 80 | 80 | */ |
| 81 | - private function getShares(): array|\Iterator { |
|
| 81 | + private function getShares(): array | \Iterator { |
|
| 82 | 82 | if ($this->db->getShardDefinition('filecache')) { |
| 83 | 83 | $sharesResult = $this->getSharesDataSharded(); |
| 84 | 84 | } else { |
@@ -134,8 +134,8 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | $shares = $qb->executeQuery()->fetchAllAssociative(); |
| 136 | 136 | return array_map(fn ($share): array => [ |
| 137 | - 'id' => (int)$share['id'], |
|
| 138 | - 'share_type' => (int)$share['share_type'], |
|
| 137 | + 'id' => (int) $share['id'], |
|
| 138 | + 'share_type' => (int) $share['share_type'], |
|
| 139 | 139 | ], $shares); |
| 140 | 140 | } |
| 141 | 141 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | * |
| 145 | 145 | * @return list<array{id: int, share_type: int, file_source: int}> |
| 146 | 146 | */ |
| 147 | - private function getSharesDataSharded(): array|\Iterator { |
|
| 147 | + private function getSharesDataSharded(): array | \Iterator { |
|
| 148 | 148 | $minDate = new \DateTime(); |
| 149 | 149 | $maxDate = new \DateTime(); |
| 150 | 150 | $maxDate->setTimestamp($maxDate->getTimestamp() + self::SECONDS_BEFORE_REMINDER); |
@@ -173,9 +173,9 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | $shares = $qb->executeQuery()->fetchAllAssociative(); |
| 175 | 175 | $shares = array_map(fn ($share): array => [ |
| 176 | - 'id' => (int)$share['id'], |
|
| 177 | - 'share_type' => (int)$share['share_type'], |
|
| 178 | - 'file_source' => (int)$share['file_source'], |
|
| 176 | + 'id' => (int) $share['id'], |
|
| 177 | + 'share_type' => (int) $share['share_type'], |
|
| 178 | + 'file_source' => (int) $share['file_source'], |
|
| 179 | 179 | ], $shares); |
| 180 | 180 | return $this->filterSharesWithEmptyFolders($shares, self::CHUNK_SIZE); |
| 181 | 181 | } |
@@ -70,10 +70,10 @@ discard block |
||
| 70 | 70 | $result = $query->executeQuery(); |
| 71 | 71 | while ($row = $result->fetchAssociative()) { |
| 72 | 72 | yield [ |
| 73 | - 'id' => (int)$row['id'], |
|
| 74 | - 'owner' => (string)$row['uid_owner'], |
|
| 75 | - 'fileid' => (int)$row['file_source'], |
|
| 76 | - 'target' => (string)$row['file_target'], |
|
| 73 | + 'id' => (int) $row['id'], |
|
| 74 | + 'owner' => (string) $row['uid_owner'], |
|
| 75 | + 'fileid' => (int) $row['file_source'], |
|
| 76 | + 'target' => (string) $row['file_target'], |
|
| 77 | 77 | ]; |
| 78 | 78 | } |
| 79 | 79 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | return null; |
| 85 | 85 | } |
| 86 | 86 | foreach ($mounts as $mount) { |
| 87 | - $userHomeMountPoint = '/' . $mount->getUser()->getUID() . '/'; |
|
| 87 | + $userHomeMountPoint = '/'.$mount->getUser()->getUID().'/'; |
|
| 88 | 88 | if ($mount->getMountPoint() === $userHomeMountPoint) { |
| 89 | 89 | return $mount->getUser()->getUID(); |
| 90 | 90 | } |
@@ -53,12 +53,12 @@ discard block |
||
| 53 | 53 | $this->superShare = $arguments['superShare']; |
| 54 | 54 | $this->groupedShares = $arguments['groupedShares']; |
| 55 | 55 | |
| 56 | - $absMountPoint = '/' . $user->getUID() . '/files/' . trim($this->superShare->getTarget(), '/') . '/'; |
|
| 56 | + $absMountPoint = '/'.$user->getUID().'/files/'.trim($this->superShare->getTarget(), '/').'/'; |
|
| 57 | 57 | |
| 58 | 58 | // after the mountpoint is verified for the first time, only new mountpoints (e.g. groupfolders can overwrite the target) |
| 59 | 59 | if (!$alreadyVerified || isset($mountpoints[$absMountPoint])) { |
| 60 | 60 | $newMountPoint = $this->verifyMountPoint($this->superShare, $mountpoints, $folderExistCache); |
| 61 | - $absMountPoint = '/' . $user->getUID() . '/files/' . trim($newMountPoint, '/') . '/'; |
|
| 61 | + $absMountPoint = '/'.$user->getUID().'/files/'.trim($newMountPoint, '/').'/'; |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | parent::__construct($storage, $absMountPoint, $arguments, $loader, null, null, MountProvider::class); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | $newMountPoint = $this->generateUniqueTarget( |
| 99 | - Filesystem::normalizePath($parent . '/' . $mountPoint), |
|
| 99 | + Filesystem::normalizePath($parent.'/'.$mountPoint), |
|
| 100 | 100 | $this->recipientView, |
| 101 | 101 | $mountpoints |
| 102 | 102 | ); |
@@ -135,15 +135,15 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | private function generateUniqueTarget($path, $view, array $mountpoints) { |
| 137 | 137 | $pathinfo = pathinfo($path); |
| 138 | - $ext = isset($pathinfo['extension']) ? '.' . $pathinfo['extension'] : ''; |
|
| 138 | + $ext = isset($pathinfo['extension']) ? '.'.$pathinfo['extension'] : ''; |
|
| 139 | 139 | $name = $pathinfo['filename']; |
| 140 | 140 | $dir = $pathinfo['dirname']; |
| 141 | 141 | |
| 142 | 142 | $i = 2; |
| 143 | - $absolutePath = $this->recipientView->getAbsolutePath($path) . '/'; |
|
| 143 | + $absolutePath = $this->recipientView->getAbsolutePath($path).'/'; |
|
| 144 | 144 | while ($view->file_exists($path) || isset($mountpoints[$absolutePath])) { |
| 145 | - $path = Filesystem::normalizePath($dir . '/' . $name . ' (' . $i . ')' . $ext); |
|
| 146 | - $absolutePath = $this->recipientView->getAbsolutePath($path) . '/'; |
|
| 145 | + $path = Filesystem::normalizePath($dir.'/'.$name.' ('.$i.')'.$ext); |
|
| 146 | + $absolutePath = $this->recipientView->getAbsolutePath($path).'/'; |
|
| 147 | 147 | $i++; |
| 148 | 148 | } |
| 149 | 149 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | // it is not a file relative to data/user/files |
| 165 | 165 | if (count($split) < 3 || $split[1] !== 'files') { |
| 166 | - Server::get(LoggerInterface::class)->error('Can not strip userid and "files/" from path: ' . $path, ['app' => 'files_sharing']); |
|
| 166 | + Server::get(LoggerInterface::class)->error('Can not strip userid and "files/" from path: '.$path, ['app' => 'files_sharing']); |
|
| 167 | 167 | throw new BrokenPath('Path does not start with /user/files', 10); |
| 168 | 168 | } |
| 169 | 169 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | $sliced = array_slice($split, 2); |
| 172 | 172 | $relPath = implode('/', $sliced); |
| 173 | 173 | |
| 174 | - return '/' . $relPath; |
|
| 174 | + return '/'.$relPath; |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /** |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | $this->storage->setMountPoint($relTargetPath); |
| 193 | 193 | } catch (\Exception $e) { |
| 194 | 194 | Server::get(LoggerInterface::class)->error( |
| 195 | - 'Could not rename mount point for shared folder "' . $this->getMountPoint() . '" to "' . $target . '"', |
|
| 195 | + 'Could not rename mount point for shared folder "'.$this->getMountPoint().'" to "'.$target.'"', |
|
| 196 | 196 | [ |
| 197 | 197 | 'app' => 'files_sharing', |
| 198 | 198 | 'exception' => $e, |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | $row = $result->fetchAssociative(); |
| 259 | 259 | $result->closeCursor(); |
| 260 | 260 | if ($row) { |
| 261 | - return (int)$row['storage']; |
|
| 261 | + return (int) $row['storage']; |
|
| 262 | 262 | } |
| 263 | 263 | return -1; |
| 264 | 264 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | $cutOff = $this->time->getTime() + self::INTERVAL; |
| 81 | 81 | do { |
| 82 | - $deleted = $this->atomic(function () use ($qbSelect, $deleteQb) { |
|
| 82 | + $deleted = $this->atomic(function() use ($qbSelect, $deleteQb) { |
|
| 83 | 83 | $result = $qbSelect->executeQuery(); |
| 84 | 84 | $ids = array_map('intval', $result->fetchFirstColumn()); |
| 85 | 85 | $result->closeCursor(); |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | $chunks = array_chunk($sourceFiles, self::CHUNK_SIZE); |
| 110 | 110 | foreach ($chunks as $chunk) { |
| 111 | 111 | $deletedFiles = $this->findMissingSources($chunk); |
| 112 | - $this->atomic(function () use ($deletedFiles, $deleteQb) { |
|
| 112 | + $this->atomic(function() use ($deletedFiles, $deleteQb) { |
|
| 113 | 113 | $deleteQb->setParameter('ids', $deletedFiles, IQueryBuilder::PARAM_INT_ARRAY); |
| 114 | 114 | $deleted = $deleteQb->executeStatement(); |
| 115 | 115 | $this->logger->debug('{deleted} orphaned share(s) deleted', [ |
@@ -79,14 +79,14 @@ discard block |
||
| 79 | 79 | public function addShare($remote, $token, $password, $name, $owner, $shareType, $accepted = false, $user = null, $remoteId = '', $parent = -1) { |
| 80 | 80 | $user = $user ?? $this->uid; |
| 81 | 81 | $accepted = $accepted ? IShare::STATUS_ACCEPTED : IShare::STATUS_PENDING; |
| 82 | - $name = Filesystem::normalizePath('/' . $name); |
|
| 82 | + $name = Filesystem::normalizePath('/'.$name); |
|
| 83 | 83 | |
| 84 | 84 | if ($accepted !== IShare::STATUS_ACCEPTED) { |
| 85 | 85 | // To avoid conflicts with the mount point generation later, |
| 86 | 86 | // we only use a temporary mount point name here. The real |
| 87 | 87 | // mount point name will be generated when accepting the share, |
| 88 | 88 | // using the original share item name. |
| 89 | - $tmpMountPointName = '{{TemporaryMountPointName#' . $name . '}}'; |
|
| 89 | + $tmpMountPointName = '{{TemporaryMountPointName#'.$name.'}}'; |
|
| 90 | 90 | $mountPoint = $tmpMountPointName; |
| 91 | 91 | $hash = md5($tmpMountPointName); |
| 92 | 92 | $data = [ |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | $i = 1; |
| 107 | 107 | while (!$this->connection->insertIfNotExist('*PREFIX*share_external', $data, ['user', 'mountpoint_hash'])) { |
| 108 | 108 | // The external share already exists for the user |
| 109 | - $data['mountpoint'] = $tmpMountPointName . '-' . $i; |
|
| 109 | + $data['mountpoint'] = $tmpMountPointName.'-'.$i; |
|
| 110 | 110 | $data['mountpoint_hash'] = md5($data['mountpoint']); |
| 111 | 111 | $i++; |
| 112 | 112 | } |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | $mountPoint = Files::buildNotExistingFileName('/', $name); |
| 117 | - $mountPoint = Filesystem::normalizePath('/' . $mountPoint); |
|
| 117 | + $mountPoint = Filesystem::normalizePath('/'.$mountPoint); |
|
| 118 | 118 | $hash = md5($mountPoint); |
| 119 | 119 | |
| 120 | 120 | $this->writeShareToDb($remote, $token, $password, $name, $owner, $user, $mountPoint, $hash, $accepted, $remoteId, $parent, $shareType); |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | ->executeStatement(); |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - private function fetchShare(int $id): array|false { |
|
| 157 | + private function fetchShare(int $id): array | false { |
|
| 158 | 158 | $qb = $this->connection->getQueryBuilder(); |
| 159 | 159 | $result = $qb->select('id', 'remote', 'remote_id', 'share_token', 'name', 'owner', 'user', 'mountpoint', 'accepted', 'parent', 'share_type', 'password', 'mountpoint_hash') |
| 160 | 160 | ->from('share_external') |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | * @param string $token |
| 172 | 172 | * @return mixed share of false |
| 173 | 173 | */ |
| 174 | - private function fetchShareByToken(string $token): array|false { |
|
| 174 | + private function fetchShareByToken(string $token): array | false { |
|
| 175 | 175 | $qb = $this->connection->getQueryBuilder(); |
| 176 | 176 | $result = $qb->select('id', 'remote', 'remote_id', 'share_token', 'name', 'owner', 'user', 'mountpoint', 'accepted', 'parent', 'share_type', 'password', 'mountpoint_hash') |
| 177 | 177 | ->from('share_external') |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | return null; |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - public function getShare(int $id, ?string $user = null): array|false { |
|
| 202 | + public function getShare(int $id, ?string $user = null): array | false { |
|
| 203 | 203 | $user = $user ?? $this->uid; |
| 204 | 204 | $share = $this->fetchShare($id); |
| 205 | 205 | if ($share === false) { |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | * @param string $token |
| 221 | 221 | * @return array|false |
| 222 | 222 | */ |
| 223 | - public function getShareByToken(string $token): array|false { |
|
| 223 | + public function getShareByToken(string $token): array | false { |
|
| 224 | 224 | $share = $this->fetchShareByToken($token); |
| 225 | 225 | |
| 226 | 226 | // We do not check if the user is allowed to access it here, |
@@ -240,14 +240,14 @@ discard block |
||
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | // If the share is a user share, check if the user is the recipient |
| 243 | - if ((int)$share['share_type'] === IShare::TYPE_USER |
|
| 243 | + if ((int) $share['share_type'] === IShare::TYPE_USER |
|
| 244 | 244 | && $share['user'] === $user) { |
| 245 | 245 | return true; |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | // If the share is a group share, check if the user is in the group |
| 249 | - if ((int)$share['share_type'] === IShare::TYPE_GROUP) { |
|
| 250 | - $parentId = (int)$share['parent']; |
|
| 249 | + if ((int) $share['share_type'] === IShare::TYPE_GROUP) { |
|
| 250 | + $parentId = (int) $share['parent']; |
|
| 251 | 251 | if ($parentId !== -1) { |
| 252 | 252 | // we just retrieved a sub-share, switch to the parent entry for verification |
| 253 | 253 | $groupShare = $this->fetchShare($parentId); |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | $hash = md5($mountPoint); |
| 302 | 302 | $userShareAccepted = false; |
| 303 | 303 | |
| 304 | - if ((int)$share['share_type'] === IShare::TYPE_USER) { |
|
| 304 | + if ((int) $share['share_type'] === IShare::TYPE_USER) { |
|
| 305 | 305 | $qb = $this->connection->getQueryBuilder(); |
| 306 | 306 | $qb->update('share_external') |
| 307 | 307 | ->set('accepted', $qb->createNamedParameter(1)) |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | )); |
| 314 | 314 | $userShareAccepted = $qb->executeStatement(); |
| 315 | 315 | } else { |
| 316 | - $parentId = (int)$share['parent']; |
|
| 316 | + $parentId = (int) $share['parent']; |
|
| 317 | 317 | if ($parentId !== -1) { |
| 318 | 318 | // this is the sub-share |
| 319 | 319 | $subshare = $share; |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | $share = $this->getShare($id, $user); |
| 390 | 390 | $result = false; |
| 391 | 391 | |
| 392 | - if ($share && (int)$share['share_type'] === IShare::TYPE_USER) { |
|
| 392 | + if ($share && (int) $share['share_type'] === IShare::TYPE_USER) { |
|
| 393 | 393 | $qb = $this->connection->getQueryBuilder(); |
| 394 | 394 | $qb->delete('share_external') |
| 395 | 395 | ->where($qb->expr()->andX( |
@@ -401,8 +401,8 @@ discard block |
||
| 401 | 401 | |
| 402 | 402 | $this->processNotification($id, $user); |
| 403 | 403 | $result = true; |
| 404 | - } elseif ($share && (int)$share['share_type'] === IShare::TYPE_GROUP) { |
|
| 405 | - $parentId = (int)$share['parent']; |
|
| 404 | + } elseif ($share && (int) $share['share_type'] === IShare::TYPE_GROUP) { |
|
| 405 | + $parentId = (int) $share['parent']; |
|
| 406 | 406 | if ($parentId !== -1) { |
| 407 | 407 | // this is the sub-share |
| 408 | 408 | $subshare = $share; |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | |
| 413 | 413 | if ($subshare !== null) { |
| 414 | 414 | try { |
| 415 | - $this->updateAccepted((int)$subshare['id'], false); |
|
| 415 | + $this->updateAccepted((int) $subshare['id'], false); |
|
| 416 | 416 | $result = true; |
| 417 | 417 | } catch (Exception $e) { |
| 418 | 418 | $this->logger->emergency('Could not update share', ['exception' => $e]); |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | $filter = $this->notificationManager->createNotification(); |
| 461 | 461 | $filter->setApp('files_sharing') |
| 462 | 462 | ->setUser($user) |
| 463 | - ->setObject('remote_share', (string)$remoteShare); |
|
| 463 | + ->setObject('remote_share', (string) $remoteShare); |
|
| 464 | 464 | $this->notificationManager->markProcessed($filter); |
| 465 | 465 | } |
| 466 | 466 | |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | $federationEndpoints = $this->discoveryService->discover($remote, 'FEDERATED_SHARING'); |
| 484 | 484 | $endpoint = $federationEndpoints['share'] ?? '/ocs/v2.php/cloud/shares'; |
| 485 | 485 | |
| 486 | - $url = rtrim($remote, '/') . $endpoint . '/' . $remoteId . '/' . $feedback . '?format=' . Share::RESPONSE_FORMAT; |
|
| 486 | + $url = rtrim($remote, '/').$endpoint.'/'.$remoteId.'/'.$feedback.'?format='.Share::RESPONSE_FORMAT; |
|
| 487 | 487 | $fields = ['token' => $token]; |
| 488 | 488 | |
| 489 | 489 | $client = $this->clientService->newClient(); |
@@ -551,14 +551,14 @@ discard block |
||
| 551 | 551 | * remove '/user/files' from the path and trailing slashes |
| 552 | 552 | */ |
| 553 | 553 | protected function stripPath(string $path): string { |
| 554 | - $prefix = '/' . $this->uid . '/files'; |
|
| 554 | + $prefix = '/'.$this->uid.'/files'; |
|
| 555 | 555 | return rtrim(substr($path, strlen($prefix)), '/'); |
| 556 | 556 | } |
| 557 | 557 | |
| 558 | 558 | public function getMount(array $data, ?string $user = null) { |
| 559 | 559 | $user = $user ?? $this->uid; |
| 560 | 560 | $data['manager'] = $this; |
| 561 | - $mountPoint = '/' . $user . '/files' . $data['mountpoint']; |
|
| 561 | + $mountPoint = '/'.$user.'/files'.$data['mountpoint']; |
|
| 562 | 562 | $data['mountpoint'] = $mountPoint; |
| 563 | 563 | $data['certificateManager'] = \OC::$server->getCertificateManager(); |
| 564 | 564 | return new Mount(self::STORAGE, $mountPoint, $data, $this, $this->storageLoader); |
@@ -591,7 +591,7 @@ discard block |
||
| 591 | 591 | ->where($qb->expr()->eq('mountpoint_hash', $qb->createNamedParameter($sourceHash))) |
| 592 | 592 | ->andWhere($qb->expr()->eq('user', $qb->createNamedParameter($this->uid))); |
| 593 | 593 | |
| 594 | - $result = (bool)$qb->executeStatement(); |
|
| 594 | + $result = (bool) $qb->executeStatement(); |
|
| 595 | 595 | |
| 596 | 596 | $this->eventDispatcher->dispatchTyped(new InvalidateMountCacheEvent($this->userManager->get($this->uid))); |
| 597 | 597 | |
@@ -623,7 +623,7 @@ discard block |
||
| 623 | 623 | $result = $qb->executeQuery(); |
| 624 | 624 | $share = $result->fetchAssociative(); |
| 625 | 625 | $result->closeCursor(); |
| 626 | - if ($share !== false && (int)$share['share_type'] === IShare::TYPE_USER) { |
|
| 626 | + if ($share !== false && (int) $share['share_type'] === IShare::TYPE_USER) { |
|
| 627 | 627 | try { |
| 628 | 628 | $this->sendFeedbackToRemote($share['remote'], $share['share_token'], $share['remote_id'], 'decline'); |
| 629 | 629 | } catch (\Throwable $e) { |
@@ -633,13 +633,13 @@ discard block |
||
| 633 | 633 | |
| 634 | 634 | $qb = $this->connection->getQueryBuilder(); |
| 635 | 635 | $qb->delete('share_external') |
| 636 | - ->where('id', $qb->createNamedParameter((int)$share['id'])) |
|
| 636 | + ->where('id', $qb->createNamedParameter((int) $share['id'])) |
|
| 637 | 637 | ->executeStatement(); |
| 638 | - } elseif ($share !== false && (int)$share['share_type'] === IShare::TYPE_GROUP) { |
|
| 639 | - $this->updateAccepted((int)$share['id'], false); |
|
| 638 | + } elseif ($share !== false && (int) $share['share_type'] === IShare::TYPE_GROUP) { |
|
| 639 | + $this->updateAccepted((int) $share['id'], false); |
|
| 640 | 640 | } |
| 641 | 641 | |
| 642 | - $this->removeReShares((string)$id); |
|
| 642 | + $this->removeReShares((string) $id); |
|
| 643 | 643 | } catch (Exception $ex) { |
| 644 | 644 | $this->logger->emergency('Could not update share', ['exception' => $ex]); |
| 645 | 645 | return false; |
@@ -806,17 +806,17 @@ discard block |
||
| 806 | 806 | // remove parent group share entry if we have a specific user share entry for the user |
| 807 | 807 | $toRemove = []; |
| 808 | 808 | foreach ($shares as $share) { |
| 809 | - if ((int)$share['share_type'] === IShare::TYPE_GROUP && (int)$share['parent'] > 0) { |
|
| 809 | + if ((int) $share['share_type'] === IShare::TYPE_GROUP && (int) $share['parent'] > 0) { |
|
| 810 | 810 | $toRemove[] = $share['parent']; |
| 811 | 811 | } |
| 812 | 812 | } |
| 813 | - $shares = array_filter($shares, function ($share) use ($toRemove) { |
|
| 813 | + $shares = array_filter($shares, function($share) use ($toRemove) { |
|
| 814 | 814 | return !in_array($share['id'], $toRemove, true); |
| 815 | 815 | }); |
| 816 | 816 | |
| 817 | 817 | if (!is_null($accepted)) { |
| 818 | - $shares = array_filter($shares, function ($share) use ($accepted) { |
|
| 819 | - return (bool)$share['accepted'] === $accepted; |
|
| 818 | + $shares = array_filter($shares, function($share) use ($accepted) { |
|
| 819 | + return (bool) $share['accepted'] === $accepted; |
|
| 820 | 820 | }); |
| 821 | 821 | } |
| 822 | 822 | return array_values($shares); |
@@ -59,13 +59,13 @@ |
||
| 59 | 59 | |
| 60 | 60 | $shares = $qb->executeQuery(); |
| 61 | 61 | while ($share = $shares->fetchAssociative()) { |
| 62 | - if ((int)$share['share_type'] === IShare::TYPE_LINK) { |
|
| 62 | + if ((int) $share['share_type'] === IShare::TYPE_LINK) { |
|
| 63 | 63 | $id = 'ocinternal'; |
| 64 | - } elseif ((int)$share['share_type'] === IShare::TYPE_EMAIL) { |
|
| 64 | + } elseif ((int) $share['share_type'] === IShare::TYPE_EMAIL) { |
|
| 65 | 65 | $id = 'ocMailShare'; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - $id .= ':' . $share['id']; |
|
| 68 | + $id .= ':'.$share['id']; |
|
| 69 | 69 | |
| 70 | 70 | try { |
| 71 | 71 | $share = $this->shareManager->getShareById($id); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | $result = $qb->executeQuery(); |
| 26 | 26 | |
| 27 | 27 | if (($row = $result->fetchAssociative()) !== false) { |
| 28 | - $mimetype = (int)$row['id']; |
|
| 28 | + $mimetype = (int) $row['id']; |
|
| 29 | 29 | } else { |
| 30 | 30 | $mimetype = -1; |
| 31 | 31 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | while (!empty($parents)) { |
| 35 | 35 | $qb = Server::get(IDBConnection::class)->getQueryBuilder(); |
| 36 | 36 | |
| 37 | - $parents = array_map(function ($parent) use ($qb) { |
|
| 37 | + $parents = array_map(function($parent) use ($qb) { |
|
| 38 | 38 | return $qb->createNamedParameter($parent); |
| 39 | 39 | }, $parents); |
| 40 | 40 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | foreach ($result->iterateAssociative() as $file) { |
| 51 | 51 | $children[] = ['source' => $file['fileid'], 'file_path' => $file['name']]; |
| 52 | 52 | // If a child folder is found look inside it |
| 53 | - if ((int)$file['mimetype'] === $mimetype) { |
|
| 53 | + if ((int) $file['mimetype'] === $mimetype) { |
|
| 54 | 54 | $parents[] = $file['fileid']; |
| 55 | 55 | } |
| 56 | 56 | } |