@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $this->groupedShares = $arguments['groupedShares']; |
76 | 76 | |
77 | 77 | $newMountPoint = $this->verifyMountPoint($this->superShare, $mountpoints, $folderExistCache); |
78 | - $absMountPoint = '/' . $this->user . '/files' . $newMountPoint; |
|
78 | + $absMountPoint = '/'.$this->user.'/files'.$newMountPoint; |
|
79 | 79 | parent::__construct($storage, $absMountPoint, $arguments, $loader); |
80 | 80 | } |
81 | 81 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | } |
103 | 103 | |
104 | 104 | $newMountPoint = $this->generateUniqueTarget( |
105 | - \OC\Files\Filesystem::normalizePath($parent . '/' . $mountPoint), |
|
105 | + \OC\Files\Filesystem::normalizePath($parent.'/'.$mountPoint), |
|
106 | 106 | $this->recipientView, |
107 | 107 | $mountpoints |
108 | 108 | ); |
@@ -139,15 +139,15 @@ discard block |
||
139 | 139 | */ |
140 | 140 | private function generateUniqueTarget($path, $view, array $mountpoints) { |
141 | 141 | $pathinfo = pathinfo($path); |
142 | - $ext = isset($pathinfo['extension']) ? '.' . $pathinfo['extension'] : ''; |
|
142 | + $ext = isset($pathinfo['extension']) ? '.'.$pathinfo['extension'] : ''; |
|
143 | 143 | $name = $pathinfo['filename']; |
144 | 144 | $dir = $pathinfo['dirname']; |
145 | 145 | |
146 | 146 | $i = 2; |
147 | - $absolutePath = $this->recipientView->getAbsolutePath($path) . '/'; |
|
147 | + $absolutePath = $this->recipientView->getAbsolutePath($path).'/'; |
|
148 | 148 | while ($view->file_exists($path) || isset($mountpoints[$absolutePath])) { |
149 | - $path = Filesystem::normalizePath($dir . '/' . $name . ' (' . $i . ')' . $ext); |
|
150 | - $absolutePath = $this->recipientView->getAbsolutePath($path) . '/'; |
|
149 | + $path = Filesystem::normalizePath($dir.'/'.$name.' ('.$i.')'.$ext); |
|
150 | + $absolutePath = $this->recipientView->getAbsolutePath($path).'/'; |
|
151 | 151 | $i++; |
152 | 152 | } |
153 | 153 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | |
168 | 168 | // it is not a file relative to data/user/files |
169 | 169 | if (count($split) < 3 || $split[1] !== 'files') { |
170 | - \OC::$server->getLogger()->error('Can not strip userid and "files/" from path: ' . $path, ['app' => 'files_sharing']); |
|
170 | + \OC::$server->getLogger()->error('Can not strip userid and "files/" from path: '.$path, ['app' => 'files_sharing']); |
|
171 | 171 | throw new \OCA\Files_Sharing\Exceptions\BrokenPath('Path does not start with /user/files', 10); |
172 | 172 | } |
173 | 173 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | $sliced = array_slice($split, 2); |
176 | 176 | $relPath = implode('/', $sliced); |
177 | 177 | |
178 | - return '/' . $relPath; |
|
178 | + return '/'.$relPath; |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | /** |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | $this->setMountPoint($target); |
197 | 197 | $this->storage->setMountPoint($relTargetPath); |
198 | 198 | } catch (\Exception $e) { |
199 | - \OC::$server->getLogger()->logException($e, ['app' => 'files_sharing', 'message' => 'Could not rename mount point for shared folder "' . $this->getMountPoint() . '" to "' . $target . '"']); |
|
199 | + \OC::$server->getLogger()->logException($e, ['app' => 'files_sharing', 'message' => 'Could not rename mount point for shared folder "'.$this->getMountPoint().'" to "'.$target.'"']); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | return $result; |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $row = $result->fetch(); |
251 | 251 | $result->closeCursor(); |
252 | 252 | if ($row) { |
253 | - return (int)$row['storage']; |
|
253 | + return (int) $row['storage']; |
|
254 | 254 | } |
255 | 255 | return -1; |
256 | 256 | } |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | $shares = array_merge($shares, $this->shareManager->getSharedWith($user->getUID(), \OCP\Share::SHARE_TYPE_ROOM, null, -1)); |
80 | 80 | |
81 | 81 | // filter out excluded shares and group shares that includes self |
82 | - $shares = array_filter($shares, function (\OCP\Share\IShare $share) use ($user) { |
|
82 | + $shares = array_filter($shares, function(\OCP\Share\IShare $share) use ($user) { |
|
83 | 83 | return $share->getPermissions() > 0 && $share->getShareOwner() !== $user->getUID(); |
84 | 84 | }); |
85 | 85 | |
86 | 86 | $superShares = $this->buildSuperShares($shares, $user); |
87 | 87 | |
88 | 88 | $mounts = []; |
89 | - $view = new View('/' . $user->getUID() . '/files'); |
|
89 | + $view = new View('/'.$user->getUID().'/files'); |
|
90 | 90 | $ownerViews = []; |
91 | 91 | $sharingDisabledForUser = $this->shareManager->sharingDisabledForUser($user->getUID()); |
92 | 92 | $foldersExistCache = new CappedMemoryCache(); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $parentShare = $share[0]; |
97 | 97 | $owner = $parentShare->getShareOwner(); |
98 | 98 | if (!isset($ownerViews[$owner])) { |
99 | - $ownerViews[$owner] = new View('/' . $parentShare->getShareOwner() . '/files'); |
|
99 | + $ownerViews[$owner] = new View('/'.$parentShare->getShareOwner().'/files'); |
|
100 | 100 | } |
101 | 101 | $mount = new SharedMount( |
102 | 102 | '\OCA\Files_Sharing\SharedStorage', |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | // null groups which usually appear with group backend |
207 | 207 | // caching inconsistencies |
208 | 208 | $this->logger->debug( |
209 | - 'Could not adjust share target for share ' . $share->getId() . ' to make it consistent: ' . $e->getMessage(), |
|
209 | + 'Could not adjust share target for share '.$share->getId().' to make it consistent: '.$e->getMessage(), |
|
210 | 210 | ['app' => 'files_sharing'] |
211 | 211 | ); |
212 | 212 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | if ($share->getSharedWith() === null) { |
227 | 227 | throw new \InvalidArgumentException('SharedWith should not be empty'); |
228 | 228 | } |
229 | - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_REMOTE_GROUP) { |
|
229 | + } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_REMOTE_GROUP) { |
|
230 | 230 | if ($share->getSharedWith() === null) { |
231 | 231 | throw new \InvalidArgumentException('SharedWith should not be empty'); |
232 | 232 | } |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | |
363 | 363 | if ($fullId === null && $expirationDate === null && $this->shareApiLinkDefaultExpireDate()) { |
364 | 364 | $expirationDate = new \DateTime(); |
365 | - $expirationDate->setTime(0,0,0); |
|
365 | + $expirationDate->setTime(0, 0, 0); |
|
366 | 366 | $expirationDate->add(new \DateInterval('P'.$this->shareApiLinkDefaultExpireDays().'D')); |
367 | 367 | } |
368 | 368 | |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | |
375 | 375 | $date = new \DateTime(); |
376 | 376 | $date->setTime(0, 0, 0); |
377 | - $date->add(new \DateInterval('P' . $this->shareApiLinkDefaultExpireDays() . 'D')); |
|
377 | + $date->add(new \DateInterval('P'.$this->shareApiLinkDefaultExpireDays().'D')); |
|
378 | 378 | if ($date < $expirationDate) { |
379 | 379 | $message = $this->l->t('Can’t set expiration date more than %s days in the future', [$this->shareApiLinkDefaultExpireDays()]); |
380 | 380 | throw new GenericShareException($message, $message, 404); |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | */ |
428 | 428 | $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_USER); |
429 | 429 | $existingShares = $provider->getSharesByPath($share->getNode()); |
430 | - foreach($existingShares as $existingShare) { |
|
430 | + foreach ($existingShares as $existingShare) { |
|
431 | 431 | // Ignore if it is the same share |
432 | 432 | try { |
433 | 433 | if ($existingShare->getFullId() === $share->getFullId()) { |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | */ |
485 | 485 | $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_GROUP); |
486 | 486 | $existingShares = $provider->getSharesByPath($share->getNode()); |
487 | - foreach($existingShares as $existingShare) { |
|
487 | + foreach ($existingShares as $existingShare) { |
|
488 | 488 | try { |
489 | 489 | if ($existingShare->getFullId() === $share->getFullId()) { |
490 | 490 | continue; |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | // Make sure that we do not share a path that contains a shared mountpoint |
554 | 554 | if ($path instanceof \OCP\Files\Folder) { |
555 | 555 | $mounts = $this->mountManager->findIn($path->getPath()); |
556 | - foreach($mounts as $mount) { |
|
556 | + foreach ($mounts as $mount) { |
|
557 | 557 | if ($mount->getStorage()->instanceOfStorage('\OCA\Files_Sharing\ISharedStorage')) { |
558 | 558 | throw new \InvalidArgumentException('Path contains files shared with you'); |
559 | 559 | } |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | $storage = $share->getNode()->getStorage(); |
602 | 602 | if ($storage->instanceOfStorage('OCA\Files_Sharing\External\Storage')) { |
603 | 603 | $parent = $share->getNode()->getParent(); |
604 | - while($parent->getStorage()->instanceOfStorage('OCA\Files_Sharing\External\Storage')) { |
|
604 | + while ($parent->getStorage()->instanceOfStorage('OCA\Files_Sharing\External\Storage')) { |
|
605 | 605 | $parent = $parent->getParent(); |
606 | 606 | } |
607 | 607 | $share->setShareOwner($parent->getOwner()->getUID()); |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | } |
655 | 655 | |
656 | 656 | // Generate the target |
657 | - $target = $this->config->getSystemValue('share_folder', '/') .'/'. $share->getNode()->getName(); |
|
657 | + $target = $this->config->getSystemValue('share_folder', '/').'/'.$share->getNode()->getName(); |
|
658 | 658 | $target = \OC\Files\Filesystem::normalizePath($target); |
659 | 659 | $share->setTarget($target); |
660 | 660 | |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | |
678 | 678 | if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) { |
679 | 679 | $mailSend = $share->getMailSend(); |
680 | - if($mailSend === true) { |
|
680 | + if ($mailSend === true) { |
|
681 | 681 | $user = $this->userManager->get($share->getSharedWith()); |
682 | 682 | if ($user !== null) { |
683 | 683 | $emailAddress = $user->getEMailAddress(); |
@@ -692,12 +692,12 @@ discard block |
||
692 | 692 | $emailAddress, |
693 | 693 | $share->getExpirationDate() |
694 | 694 | ); |
695 | - $this->logger->debug('Send share notification to ' . $emailAddress . ' for share with ID ' . $share->getId(), ['app' => 'share']); |
|
695 | + $this->logger->debug('Send share notification to '.$emailAddress.' for share with ID '.$share->getId(), ['app' => 'share']); |
|
696 | 696 | } else { |
697 | - $this->logger->debug('Share notification not send to ' . $share->getSharedWith() . ' because email address is not set.', ['app' => 'share']); |
|
697 | + $this->logger->debug('Share notification not send to '.$share->getSharedWith().' because email address is not set.', ['app' => 'share']); |
|
698 | 698 | } |
699 | 699 | } else { |
700 | - $this->logger->debug('Share notification not send to ' . $share->getSharedWith() . ' because user could not be found.', ['app' => 'share']); |
|
700 | + $this->logger->debug('Share notification not send to '.$share->getSharedWith().' because user could not be found.', ['app' => 'share']); |
|
701 | 701 | } |
702 | 702 | } else { |
703 | 703 | $this->logger->debug('Share notification not send because mailsend is false.', ['app' => 'share']); |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | $text = $l->t('%s shared »%s« with you.', [$initiatorDisplayName, $filename]); |
742 | 742 | |
743 | 743 | $emailTemplate->addBodyText( |
744 | - htmlspecialchars($text . ' ' . $l->t('Click the button below to open it.')), |
|
744 | + htmlspecialchars($text.' '.$l->t('Click the button below to open it.')), |
|
745 | 745 | $text |
746 | 746 | ); |
747 | 747 | $emailTemplate->addBodyButton( |
@@ -765,9 +765,9 @@ discard block |
||
765 | 765 | // The "Reply-To" is set to the sharer if an mail address is configured |
766 | 766 | // also the default footer contains a "Do not reply" which needs to be adjusted. |
767 | 767 | $initiatorEmail = $initiatorUser->getEMailAddress(); |
768 | - if($initiatorEmail !== null) { |
|
768 | + if ($initiatorEmail !== null) { |
|
769 | 769 | $message->setReplyTo([$initiatorEmail => $initiatorDisplayName]); |
770 | - $emailTemplate->addFooter($instanceName . ($this->defaults->getSlogan() !== '' ? ' - ' . $this->defaults->getSlogan() : '')); |
|
770 | + $emailTemplate->addFooter($instanceName.($this->defaults->getSlogan() !== '' ? ' - '.$this->defaults->getSlogan() : '')); |
|
771 | 771 | } else { |
772 | 772 | $emailTemplate->addFooter(); |
773 | 773 | } |
@@ -986,7 +986,7 @@ discard block |
||
986 | 986 | * @param string $recipientId |
987 | 987 | */ |
988 | 988 | public function deleteFromSelf(\OCP\Share\IShare $share, $recipientId) { |
989 | - list($providerId, ) = $this->splitFullId($share->getFullId()); |
|
989 | + list($providerId,) = $this->splitFullId($share->getFullId()); |
|
990 | 990 | $provider = $this->factory->getProvider($providerId); |
991 | 991 | |
992 | 992 | $provider->deleteFromSelf($share, $recipientId); |
@@ -995,7 +995,7 @@ discard block |
||
995 | 995 | } |
996 | 996 | |
997 | 997 | public function restoreShare(IShare $share, string $recipientId): IShare { |
998 | - list($providerId, ) = $this->splitFullId($share->getFullId()); |
|
998 | + list($providerId,) = $this->splitFullId($share->getFullId()); |
|
999 | 999 | $provider = $this->factory->getProvider($providerId); |
1000 | 1000 | |
1001 | 1001 | return $provider->restore($share, $recipientId); |
@@ -1016,7 +1016,7 @@ discard block |
||
1016 | 1016 | if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { |
1017 | 1017 | $sharedWith = $this->groupManager->get($share->getSharedWith()); |
1018 | 1018 | if (is_null($sharedWith)) { |
1019 | - throw new \InvalidArgumentException('Group "' . $share->getSharedWith() . '" does not exist'); |
|
1019 | + throw new \InvalidArgumentException('Group "'.$share->getSharedWith().'" does not exist'); |
|
1020 | 1020 | } |
1021 | 1021 | $recipient = $this->userManager->get($recipientId); |
1022 | 1022 | if (!$sharedWith->inGroup($recipient)) { |
@@ -1024,7 +1024,7 @@ discard block |
||
1024 | 1024 | } |
1025 | 1025 | } |
1026 | 1026 | |
1027 | - list($providerId, ) = $this->splitFullId($share->getFullId()); |
|
1027 | + list($providerId,) = $this->splitFullId($share->getFullId()); |
|
1028 | 1028 | $provider = $this->factory->getProvider($providerId); |
1029 | 1029 | |
1030 | 1030 | $provider->move($share, $recipientId); |
@@ -1071,7 +1071,7 @@ discard block |
||
1071 | 1071 | |
1072 | 1072 | $shares2 = []; |
1073 | 1073 | |
1074 | - while(true) { |
|
1074 | + while (true) { |
|
1075 | 1075 | $added = 0; |
1076 | 1076 | foreach ($shares as $share) { |
1077 | 1077 | |
@@ -1156,7 +1156,7 @@ discard block |
||
1156 | 1156 | }); |
1157 | 1157 | |
1158 | 1158 | // Only get shares where the owner still exists |
1159 | - $shares = array_filter($shares, function (IShare $share) { |
|
1159 | + $shares = array_filter($shares, function(IShare $share) { |
|
1160 | 1160 | return $this->userManager->userExists($share->getShareOwner()); |
1161 | 1161 | }); |
1162 | 1162 | |
@@ -1195,7 +1195,7 @@ discard block |
||
1195 | 1195 | * |
1196 | 1196 | * @return Share[] |
1197 | 1197 | */ |
1198 | - public function getSharesByPath(\OCP\Files\Node $path, $page=0, $perPage=50) { |
|
1198 | + public function getSharesByPath(\OCP\Files\Node $path, $page = 0, $perPage = 50) { |
|
1199 | 1199 | return []; |
1200 | 1200 | } |
1201 | 1201 | |
@@ -1214,7 +1214,7 @@ discard block |
||
1214 | 1214 | } |
1215 | 1215 | $share = null; |
1216 | 1216 | try { |
1217 | - if($this->shareApiAllowLinks()) { |
|
1217 | + if ($this->shareApiAllowLinks()) { |
|
1218 | 1218 | $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_LINK); |
1219 | 1219 | $share = $provider->getShareByToken($token); |
1220 | 1220 | } |
@@ -1430,7 +1430,7 @@ discard block |
||
1430 | 1430 | } |
1431 | 1431 | $al['users'][$owner] = [ |
1432 | 1432 | 'node_id' => $path->getId(), |
1433 | - 'node_path' => '/' . $ownerPath, |
|
1433 | + 'node_path' => '/'.$ownerPath, |
|
1434 | 1434 | ]; |
1435 | 1435 | } else { |
1436 | 1436 | $al['users'][] = $owner; |
@@ -1530,7 +1530,7 @@ discard block |
||
1530 | 1530 | * @return int |
1531 | 1531 | */ |
1532 | 1532 | public function shareApiLinkDefaultExpireDays() { |
1533 | - return (int)$this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
1533 | + return (int) $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
1534 | 1534 | } |
1535 | 1535 | |
1536 | 1536 | /** |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | $path = '/'; |
128 | 128 | } |
129 | 129 | if ($path[0] !== '/') { |
130 | - $path = '/' . $path; |
|
130 | + $path = '/'.$path; |
|
131 | 131 | } |
132 | - return $this->fakeRoot . $path; |
|
132 | + return $this->fakeRoot.$path; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | public function chroot($fakeRoot) { |
142 | 142 | if (!$fakeRoot == '') { |
143 | 143 | if ($fakeRoot[0] !== '/') { |
144 | - $fakeRoot = '/' . $fakeRoot; |
|
144 | + $fakeRoot = '/'.$fakeRoot; |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 | $this->fakeRoot = $fakeRoot; |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | } |
174 | 174 | |
175 | 175 | // missing slashes can cause wrong matches! |
176 | - $root = rtrim($this->fakeRoot, '/') . '/'; |
|
176 | + $root = rtrim($this->fakeRoot, '/').'/'; |
|
177 | 177 | |
178 | 178 | if (strpos($path, $root) !== 0) { |
179 | 179 | return null; |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | if ($mount instanceof MoveableMount) { |
280 | 280 | // cut of /user/files to get the relative path to data/user/files |
281 | 281 | $pathParts = explode('/', $path, 4); |
282 | - $relPath = '/' . $pathParts[3]; |
|
282 | + $relPath = '/'.$pathParts[3]; |
|
283 | 283 | $this->lockFile($relPath, ILockingProvider::LOCK_SHARED, true); |
284 | 284 | \OC_Hook::emit( |
285 | 285 | Filesystem::CLASSNAME, "umount", |
@@ -699,7 +699,7 @@ discard block |
||
699 | 699 | } |
700 | 700 | $postFix = (substr($path, -1) === '/') ? '/' : ''; |
701 | 701 | $absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path)); |
702 | - $mount = Filesystem::getMountManager()->find($absolutePath . $postFix); |
|
702 | + $mount = Filesystem::getMountManager()->find($absolutePath.$postFix); |
|
703 | 703 | if ($mount and $mount->getInternalPath($absolutePath) === '') { |
704 | 704 | return $this->removeMount($mount, $absolutePath); |
705 | 705 | } |
@@ -819,7 +819,7 @@ discard block |
||
819 | 819 | $this->renameUpdate($storage1, $storage2, $internalPath1, $internalPath2); |
820 | 820 | } |
821 | 821 | } |
822 | - } catch(\Exception $e) { |
|
822 | + } catch (\Exception $e) { |
|
823 | 823 | throw $e; |
824 | 824 | } finally { |
825 | 825 | $this->changeLock($path1, ILockingProvider::LOCK_SHARED, true); |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | } |
844 | 844 | } |
845 | 845 | } |
846 | - } catch(\Exception $e) { |
|
846 | + } catch (\Exception $e) { |
|
847 | 847 | throw $e; |
848 | 848 | } finally { |
849 | 849 | $this->unlockFile($path1, ILockingProvider::LOCK_SHARED, true); |
@@ -976,7 +976,7 @@ discard block |
||
976 | 976 | $hooks[] = 'write'; |
977 | 977 | break; |
978 | 978 | default: |
979 | - \OCP\Util::writeLog('core', 'invalid mode (' . $mode . ') for ' . $path, ILogger::ERROR); |
|
979 | + \OCP\Util::writeLog('core', 'invalid mode ('.$mode.') for '.$path, ILogger::ERROR); |
|
980 | 980 | } |
981 | 981 | |
982 | 982 | if ($mode !== 'r' && $mode !== 'w') { |
@@ -1080,7 +1080,7 @@ discard block |
||
1080 | 1080 | array(Filesystem::signal_param_path => $this->getHookPath($path)) |
1081 | 1081 | ); |
1082 | 1082 | } |
1083 | - list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix); |
|
1083 | + list($storage, $internalPath) = Filesystem::resolvePath($absolutePath.$postFix); |
|
1084 | 1084 | if ($storage) { |
1085 | 1085 | return $storage->hash($type, $internalPath, $raw); |
1086 | 1086 | } |
@@ -1134,7 +1134,7 @@ discard block |
||
1134 | 1134 | |
1135 | 1135 | $run = $this->runHooks($hooks, $path); |
1136 | 1136 | /** @var \OC\Files\Storage\Storage $storage */ |
1137 | - list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix); |
|
1137 | + list($storage, $internalPath) = Filesystem::resolvePath($absolutePath.$postFix); |
|
1138 | 1138 | if ($run and $storage) { |
1139 | 1139 | if (in_array('write', $hooks) || in_array('delete', $hooks)) { |
1140 | 1140 | $this->changeLock($path, ILockingProvider::LOCK_EXCLUSIVE); |
@@ -1173,7 +1173,7 @@ discard block |
||
1173 | 1173 | $unlockLater = true; |
1174 | 1174 | // make sure our unlocking callback will still be called if connection is aborted |
1175 | 1175 | ignore_user_abort(true); |
1176 | - $result = CallbackWrapper::wrap($result, null, null, function () use ($hooks, $path) { |
|
1176 | + $result = CallbackWrapper::wrap($result, null, null, function() use ($hooks, $path) { |
|
1177 | 1177 | if (in_array('write', $hooks)) { |
1178 | 1178 | $this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE); |
1179 | 1179 | } else if (in_array('read', $hooks)) { |
@@ -1234,7 +1234,7 @@ discard block |
||
1234 | 1234 | return true; |
1235 | 1235 | } |
1236 | 1236 | |
1237 | - return (strlen($fullPath) > strlen($defaultRoot)) && (substr($fullPath, 0, strlen($defaultRoot) + 1) === $defaultRoot . '/'); |
|
1237 | + return (strlen($fullPath) > strlen($defaultRoot)) && (substr($fullPath, 0, strlen($defaultRoot) + 1) === $defaultRoot.'/'); |
|
1238 | 1238 | } |
1239 | 1239 | |
1240 | 1240 | /** |
@@ -1253,7 +1253,7 @@ discard block |
||
1253 | 1253 | if ($hook != 'read') { |
1254 | 1254 | \OC_Hook::emit( |
1255 | 1255 | Filesystem::CLASSNAME, |
1256 | - $prefix . $hook, |
|
1256 | + $prefix.$hook, |
|
1257 | 1257 | array( |
1258 | 1258 | Filesystem::signal_param_run => &$run, |
1259 | 1259 | Filesystem::signal_param_path => $path |
@@ -1262,7 +1262,7 @@ discard block |
||
1262 | 1262 | } elseif (!$post) { |
1263 | 1263 | \OC_Hook::emit( |
1264 | 1264 | Filesystem::CLASSNAME, |
1265 | - $prefix . $hook, |
|
1265 | + $prefix.$hook, |
|
1266 | 1266 | array( |
1267 | 1267 | Filesystem::signal_param_path => $path |
1268 | 1268 | ) |
@@ -1355,11 +1355,11 @@ discard block |
||
1355 | 1355 | return $this->getPartFileInfo($path); |
1356 | 1356 | } |
1357 | 1357 | $relativePath = $path; |
1358 | - $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path); |
|
1358 | + $path = Filesystem::normalizePath($this->fakeRoot.'/'.$path); |
|
1359 | 1359 | |
1360 | 1360 | $mount = Filesystem::getMountManager()->find($path); |
1361 | 1361 | if (!$mount) { |
1362 | - \OC::$server->getLogger()->warning('Mountpoint not found for path: ' . $path); |
|
1362 | + \OC::$server->getLogger()->warning('Mountpoint not found for path: '.$path); |
|
1363 | 1363 | return false; |
1364 | 1364 | } |
1365 | 1365 | $storage = $mount->getStorage(); |
@@ -1368,7 +1368,7 @@ discard block |
||
1368 | 1368 | $data = $this->getCacheEntry($storage, $internalPath, $relativePath); |
1369 | 1369 | |
1370 | 1370 | if (!$data instanceof ICacheEntry) { |
1371 | - \OC::$server->getLogger()->debug('No cache entry found for ' . $path . ' (storage: ' . $storage->getId() . ', internalPath: ' . $internalPath . ')'); |
|
1371 | + \OC::$server->getLogger()->debug('No cache entry found for '.$path.' (storage: '.$storage->getId().', internalPath: '.$internalPath.')'); |
|
1372 | 1372 | return false; |
1373 | 1373 | } |
1374 | 1374 | |
@@ -1384,7 +1384,7 @@ discard block |
||
1384 | 1384 | //add the sizes of other mount points to the folder |
1385 | 1385 | $extOnly = ($includeMountPoints === 'ext'); |
1386 | 1386 | $mounts = Filesystem::getMountManager()->findIn($path); |
1387 | - $info->setSubMounts(array_filter($mounts, function (IMountPoint $mount) use ($extOnly) { |
|
1387 | + $info->setSubMounts(array_filter($mounts, function(IMountPoint $mount) use ($extOnly) { |
|
1388 | 1388 | $subStorage = $mount->getStorage(); |
1389 | 1389 | return !($extOnly && $subStorage instanceof \OCA\Files_Sharing\SharedStorage); |
1390 | 1390 | })); |
@@ -1393,7 +1393,7 @@ discard block |
||
1393 | 1393 | |
1394 | 1394 | return $info; |
1395 | 1395 | } else { |
1396 | - \OC::$server->getLogger()->warning('Storage not valid for mountpoint: ' . $mount->getMountPoint()); |
|
1396 | + \OC::$server->getLogger()->warning('Storage not valid for mountpoint: '.$mount->getMountPoint()); |
|
1397 | 1397 | } |
1398 | 1398 | |
1399 | 1399 | return false; |
@@ -1440,12 +1440,12 @@ discard block |
||
1440 | 1440 | /** |
1441 | 1441 | * @var \OC\Files\FileInfo[] $fileInfos |
1442 | 1442 | */ |
1443 | - $fileInfos = array_map(function (ICacheEntry $content) use ($path, $storage, $mount, $sharingDisabled) { |
|
1443 | + $fileInfos = array_map(function(ICacheEntry $content) use ($path, $storage, $mount, $sharingDisabled) { |
|
1444 | 1444 | if ($sharingDisabled) { |
1445 | 1445 | $content['permissions'] = $content['permissions'] & ~\OCP\Constants::PERMISSION_SHARE; |
1446 | 1446 | } |
1447 | 1447 | $owner = $this->getUserObjectForOwner($storage->getOwner($content['path'])); |
1448 | - return new FileInfo($path . '/' . $content['name'], $storage, $content['path'], $content, $mount, $owner); |
|
1448 | + return new FileInfo($path.'/'.$content['name'], $storage, $content['path'], $content, $mount, $owner); |
|
1449 | 1449 | }, $contents); |
1450 | 1450 | $files = array_combine($fileNames, $fileInfos); |
1451 | 1451 | |
@@ -1470,7 +1470,7 @@ discard block |
||
1470 | 1470 | } catch (\Exception $e) { |
1471 | 1471 | // sometimes when the storage is not available it can be any exception |
1472 | 1472 | \OC::$server->getLogger()->logException($e, [ |
1473 | - 'message' => 'Exception while scanning storage "' . $subStorage->getId() . '"', |
|
1473 | + 'message' => 'Exception while scanning storage "'.$subStorage->getId().'"', |
|
1474 | 1474 | 'level' => ILogger::ERROR, |
1475 | 1475 | 'app' => 'lib', |
1476 | 1476 | ]); |
@@ -1501,7 +1501,7 @@ discard block |
||
1501 | 1501 | $rootEntry['permissions'] = $permissions & (\OCP\Constants::PERMISSION_ALL - (\OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE)); |
1502 | 1502 | } |
1503 | 1503 | |
1504 | - $rootEntry['path'] = substr(Filesystem::normalizePath($path . '/' . $rootEntry['name']), strlen($user) + 2); // full path without /$user/ |
|
1504 | + $rootEntry['path'] = substr(Filesystem::normalizePath($path.'/'.$rootEntry['name']), strlen($user) + 2); // full path without /$user/ |
|
1505 | 1505 | |
1506 | 1506 | // if sharing was disabled for the user we remove the share permissions |
1507 | 1507 | if (\OCP\Util::isSharingDisabledForUser()) { |
@@ -1509,14 +1509,14 @@ discard block |
||
1509 | 1509 | } |
1510 | 1510 | |
1511 | 1511 | $owner = $this->getUserObjectForOwner($subStorage->getOwner('')); |
1512 | - $files[$rootEntry->getName()] = new FileInfo($path . '/' . $rootEntry['name'], $subStorage, '', $rootEntry, $mount, $owner); |
|
1512 | + $files[$rootEntry->getName()] = new FileInfo($path.'/'.$rootEntry['name'], $subStorage, '', $rootEntry, $mount, $owner); |
|
1513 | 1513 | } |
1514 | 1514 | } |
1515 | 1515 | } |
1516 | 1516 | } |
1517 | 1517 | |
1518 | 1518 | if ($mimetype_filter) { |
1519 | - $files = array_filter($files, function (FileInfo $file) use ($mimetype_filter) { |
|
1519 | + $files = array_filter($files, function(FileInfo $file) use ($mimetype_filter) { |
|
1520 | 1520 | if (strpos($mimetype_filter, '/')) { |
1521 | 1521 | return $file->getMimetype() === $mimetype_filter; |
1522 | 1522 | } else { |
@@ -1545,7 +1545,7 @@ discard block |
||
1545 | 1545 | if ($data instanceof FileInfo) { |
1546 | 1546 | $data = $data->getData(); |
1547 | 1547 | } |
1548 | - $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path); |
|
1548 | + $path = Filesystem::normalizePath($this->fakeRoot.'/'.$path); |
|
1549 | 1549 | /** |
1550 | 1550 | * @var \OC\Files\Storage\Storage $storage |
1551 | 1551 | * @var string $internalPath |
@@ -1572,7 +1572,7 @@ discard block |
||
1572 | 1572 | * @return FileInfo[] |
1573 | 1573 | */ |
1574 | 1574 | public function search($query) { |
1575 | - return $this->searchCommon('search', array('%' . $query . '%')); |
|
1575 | + return $this->searchCommon('search', array('%'.$query.'%')); |
|
1576 | 1576 | } |
1577 | 1577 | |
1578 | 1578 | /** |
@@ -1623,10 +1623,10 @@ discard block |
||
1623 | 1623 | |
1624 | 1624 | $results = call_user_func_array(array($cache, $method), $args); |
1625 | 1625 | foreach ($results as $result) { |
1626 | - if (substr($mountPoint . $result['path'], 0, $rootLength + 1) === $this->fakeRoot . '/') { |
|
1626 | + if (substr($mountPoint.$result['path'], 0, $rootLength + 1) === $this->fakeRoot.'/') { |
|
1627 | 1627 | $internalPath = $result['path']; |
1628 | - $path = $mountPoint . $result['path']; |
|
1629 | - $result['path'] = substr($mountPoint . $result['path'], $rootLength); |
|
1628 | + $path = $mountPoint.$result['path']; |
|
1629 | + $result['path'] = substr($mountPoint.$result['path'], $rootLength); |
|
1630 | 1630 | $owner = \OC::$server->getUserManager()->get($storage->getOwner($internalPath)); |
1631 | 1631 | $files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner); |
1632 | 1632 | } |
@@ -1644,8 +1644,8 @@ discard block |
||
1644 | 1644 | if ($results) { |
1645 | 1645 | foreach ($results as $result) { |
1646 | 1646 | $internalPath = $result['path']; |
1647 | - $result['path'] = rtrim($relativeMountPoint . $result['path'], '/'); |
|
1648 | - $path = rtrim($mountPoint . $internalPath, '/'); |
|
1647 | + $result['path'] = rtrim($relativeMountPoint.$result['path'], '/'); |
|
1648 | + $path = rtrim($mountPoint.$internalPath, '/'); |
|
1649 | 1649 | $owner = \OC::$server->getUserManager()->get($storage->getOwner($internalPath)); |
1650 | 1650 | $files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner); |
1651 | 1651 | } |
@@ -1666,7 +1666,7 @@ discard block |
||
1666 | 1666 | public function getOwner($path) { |
1667 | 1667 | $info = $this->getFileInfo($path); |
1668 | 1668 | if (!$info) { |
1669 | - throw new NotFoundException($path . ' not found while trying to get owner'); |
|
1669 | + throw new NotFoundException($path.' not found while trying to get owner'); |
|
1670 | 1670 | } |
1671 | 1671 | return $info->getOwner()->getUID(); |
1672 | 1672 | } |
@@ -1700,7 +1700,7 @@ discard block |
||
1700 | 1700 | * @return string |
1701 | 1701 | */ |
1702 | 1702 | public function getPath($id) { |
1703 | - $id = (int)$id; |
|
1703 | + $id = (int) $id; |
|
1704 | 1704 | $manager = Filesystem::getMountManager(); |
1705 | 1705 | $mounts = $manager->findIn($this->fakeRoot); |
1706 | 1706 | $mounts[] = $manager->find($this->fakeRoot); |
@@ -1715,7 +1715,7 @@ discard block |
||
1715 | 1715 | $cache = $mount->getStorage()->getCache(); |
1716 | 1716 | $internalPath = $cache->getPathById($id); |
1717 | 1717 | if (is_string($internalPath)) { |
1718 | - $fullPath = $mount->getMountPoint() . $internalPath; |
|
1718 | + $fullPath = $mount->getMountPoint().$internalPath; |
|
1719 | 1719 | if (!is_null($path = $this->getRelativePath($fullPath))) { |
1720 | 1720 | return $path; |
1721 | 1721 | } |
@@ -1758,10 +1758,10 @@ discard block |
||
1758 | 1758 | } |
1759 | 1759 | |
1760 | 1760 | // note: cannot use the view because the target is already locked |
1761 | - $fileId = (int)$targetStorage->getCache()->getId($targetInternalPath); |
|
1761 | + $fileId = (int) $targetStorage->getCache()->getId($targetInternalPath); |
|
1762 | 1762 | if ($fileId === -1) { |
1763 | 1763 | // target might not exist, need to check parent instead |
1764 | - $fileId = (int)$targetStorage->getCache()->getId(dirname($targetInternalPath)); |
|
1764 | + $fileId = (int) $targetStorage->getCache()->getId(dirname($targetInternalPath)); |
|
1765 | 1765 | } |
1766 | 1766 | |
1767 | 1767 | // check if any of the parents were shared by the current owner (include collections) |
@@ -1861,7 +1861,7 @@ discard block |
||
1861 | 1861 | $resultPath = ''; |
1862 | 1862 | foreach ($parts as $part) { |
1863 | 1863 | if ($part) { |
1864 | - $resultPath .= '/' . $part; |
|
1864 | + $resultPath .= '/'.$part; |
|
1865 | 1865 | $result[] = $resultPath; |
1866 | 1866 | } |
1867 | 1867 | } |
@@ -2124,16 +2124,16 @@ discard block |
||
2124 | 2124 | public function getUidAndFilename($filename) { |
2125 | 2125 | $info = $this->getFileInfo($filename); |
2126 | 2126 | if (!$info instanceof \OCP\Files\FileInfo) { |
2127 | - throw new NotFoundException($this->getAbsolutePath($filename) . ' not found'); |
|
2127 | + throw new NotFoundException($this->getAbsolutePath($filename).' not found'); |
|
2128 | 2128 | } |
2129 | 2129 | $uid = $info->getOwner()->getUID(); |
2130 | 2130 | if ($uid != \OCP\User::getUser()) { |
2131 | 2131 | Filesystem::initMountPoints($uid); |
2132 | - $ownerView = new View('/' . $uid . '/files'); |
|
2132 | + $ownerView = new View('/'.$uid.'/files'); |
|
2133 | 2133 | try { |
2134 | 2134 | $filename = $ownerView->getPath($info['fileid']); |
2135 | 2135 | } catch (NotFoundException $e) { |
2136 | - throw new NotFoundException('File with id ' . $info['fileid'] . ' not found for user ' . $uid); |
|
2136 | + throw new NotFoundException('File with id '.$info['fileid'].' not found for user '.$uid); |
|
2137 | 2137 | } |
2138 | 2138 | } |
2139 | 2139 | return [$uid, $filename]; |
@@ -2150,7 +2150,7 @@ discard block |
||
2150 | 2150 | $directoryParts = array_filter($directoryParts); |
2151 | 2151 | foreach ($directoryParts as $key => $part) { |
2152 | 2152 | $currentPathElements = array_slice($directoryParts, 0, $key); |
2153 | - $currentPath = '/' . implode('/', $currentPathElements); |
|
2153 | + $currentPath = '/'.implode('/', $currentPathElements); |
|
2154 | 2154 | if ($this->is_file($currentPath)) { |
2155 | 2155 | return false; |
2156 | 2156 | } |
@@ -95,7 +95,7 @@ |
||
95 | 95 | |
96 | 96 | $current = $path; |
97 | 97 | while (true) { |
98 | - $mountPoint = $current . '/'; |
|
98 | + $mountPoint = $current.'/'; |
|
99 | 99 | if (isset($this->mounts[$mountPoint])) { |
100 | 100 | $this->pathCache[$path] = $this->mounts[$mountPoint]; |
101 | 101 | return $this->mounts[$mountPoint]; |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | |
89 | 89 | public function registerMounts(IUser $user, array $mounts) { |
90 | 90 | // filter out non-proper storages coming from unit tests |
91 | - $mounts = array_filter($mounts, function (IMountPoint $mount) { |
|
91 | + $mounts = array_filter($mounts, function(IMountPoint $mount) { |
|
92 | 92 | return $mount instanceof SharedMount || $mount->getStorage() && $mount->getStorage()->getCache(); |
93 | 93 | }); |
94 | 94 | /** @var ICachedMountInfo[] $newMounts */ |
95 | - $newMounts = array_map(function (IMountPoint $mount) use ($user) { |
|
95 | + $newMounts = array_map(function(IMountPoint $mount) use ($user) { |
|
96 | 96 | // filter out any storages which aren't scanned yet since we aren't interested in files from those storages (yet) |
97 | 97 | if ($mount->getStorageRootId() === -1) { |
98 | 98 | return null; |
@@ -101,13 +101,13 @@ discard block |
||
101 | 101 | } |
102 | 102 | }, $mounts); |
103 | 103 | $newMounts = array_values(array_filter($newMounts)); |
104 | - $newMountRootIds = array_map(function (ICachedMountInfo $mount) { |
|
104 | + $newMountRootIds = array_map(function(ICachedMountInfo $mount) { |
|
105 | 105 | return $mount->getRootId(); |
106 | 106 | }, $newMounts); |
107 | 107 | $newMounts = array_combine($newMountRootIds, $newMounts); |
108 | 108 | |
109 | 109 | $cachedMounts = $this->getMountsForUser($user); |
110 | - $cachedMountRootIds = array_map(function (ICachedMountInfo $mount) { |
|
110 | + $cachedMountRootIds = array_map(function(ICachedMountInfo $mount) { |
|
111 | 111 | return $mount->getRootId(); |
112 | 112 | }, $cachedMounts); |
113 | 113 | $cachedMounts = array_combine($cachedMountRootIds, $cachedMounts); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | ], ['root_id', 'user_id']); |
182 | 182 | } else { |
183 | 183 | // in some cases this is legitimate, like orphaned shares |
184 | - $this->logger->debug('Could not get storage info for mount at ' . $mount->getMountPoint()); |
|
184 | + $this->logger->debug('Could not get storage info for mount at '.$mount->getMountPoint()); |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
@@ -214,9 +214,9 @@ discard block |
||
214 | 214 | } |
215 | 215 | $mount_id = $row['mount_id']; |
216 | 216 | if (!is_null($mount_id)) { |
217 | - $mount_id = (int)$mount_id; |
|
217 | + $mount_id = (int) $mount_id; |
|
218 | 218 | } |
219 | - return new CachedMountInfo($user, (int)$row['storage_id'], (int)$row['root_id'], $row['mount_point'], $mount_id, isset($row['path']) ? $row['path'] : ''); |
|
219 | + return new CachedMountInfo($user, (int) $row['storage_id'], (int) $row['root_id'], $row['mount_point'], $mount_id, isset($row['path']) ? $row['path'] : ''); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | /** |
@@ -290,12 +290,12 @@ discard block |
||
290 | 290 | $row = $query->execute()->fetch(); |
291 | 291 | if (is_array($row)) { |
292 | 292 | $this->cacheInfoCache[$fileId] = [ |
293 | - (int)$row['storage'], |
|
293 | + (int) $row['storage'], |
|
294 | 294 | $row['path'], |
295 | - (int)$row['mimetype'] |
|
295 | + (int) $row['mimetype'] |
|
296 | 296 | ]; |
297 | 297 | } else { |
298 | - throw new NotFoundException('File with id "' . $fileId . '" not found'); |
|
298 | + throw new NotFoundException('File with id "'.$fileId.'" not found'); |
|
299 | 299 | } |
300 | 300 | } |
301 | 301 | return $this->cacheInfoCache[$fileId]; |
@@ -316,16 +316,16 @@ discard block |
||
316 | 316 | $mountsForStorage = $this->getMountsForStorageId($storageId, $user); |
317 | 317 | |
318 | 318 | // filter mounts that are from the same storage but a different directory |
319 | - $filteredMounts = array_filter($mountsForStorage, function (ICachedMountInfo $mount) use ($internalPath, $fileId) { |
|
319 | + $filteredMounts = array_filter($mountsForStorage, function(ICachedMountInfo $mount) use ($internalPath, $fileId) { |
|
320 | 320 | if ($fileId === $mount->getRootId()) { |
321 | 321 | return true; |
322 | 322 | } |
323 | 323 | $internalMountPath = $mount->getRootInternalPath(); |
324 | 324 | |
325 | - return $internalMountPath === '' || substr($internalPath, 0, strlen($internalMountPath) + 1) === $internalMountPath . '/'; |
|
325 | + return $internalMountPath === '' || substr($internalPath, 0, strlen($internalMountPath) + 1) === $internalMountPath.'/'; |
|
326 | 326 | }); |
327 | 327 | |
328 | - return array_map(function (ICachedMountInfo $mount) use ($internalPath) { |
|
328 | + return array_map(function(ICachedMountInfo $mount) use ($internalPath) { |
|
329 | 329 | return new CachedMountFileInfo( |
330 | 330 | $mount->getUser(), |
331 | 331 | $mount->getStorageId(), |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | $slash |
384 | 384 | ); |
385 | 385 | |
386 | - $userIds = array_map(function (IUser $user) { |
|
386 | + $userIds = array_map(function(IUser $user) { |
|
387 | 387 | return $user->getUID(); |
388 | 388 | }, $users); |
389 | 389 |