@@ -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 |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $this->groupedShares = $arguments['groupedShares']; |
75 | 75 | |
76 | 76 | $newMountPoint = $this->verifyMountPoint($this->superShare, $mountpoints, $folderExistCache); |
77 | - $absMountPoint = '/' . $this->user . '/files' . $newMountPoint; |
|
77 | + $absMountPoint = '/'.$this->user.'/files'.$newMountPoint; |
|
78 | 78 | parent::__construct($storage, $absMountPoint, $arguments, $loader); |
79 | 79 | } |
80 | 80 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | } |
102 | 102 | |
103 | 103 | $newMountPoint = $this->generateUniqueTarget( |
104 | - \OC\Files\Filesystem::normalizePath($parent . '/' . $mountPoint), |
|
104 | + \OC\Files\Filesystem::normalizePath($parent.'/'.$mountPoint), |
|
105 | 105 | $this->recipientView, |
106 | 106 | $mountpoints |
107 | 107 | ); |
@@ -138,15 +138,15 @@ discard block |
||
138 | 138 | */ |
139 | 139 | private function generateUniqueTarget($path, $view, array $mountpoints) { |
140 | 140 | $pathinfo = pathinfo($path); |
141 | - $ext = (isset($pathinfo['extension'])) ? '.' . $pathinfo['extension'] : ''; |
|
141 | + $ext = (isset($pathinfo['extension'])) ? '.'.$pathinfo['extension'] : ''; |
|
142 | 142 | $name = $pathinfo['filename']; |
143 | 143 | $dir = $pathinfo['dirname']; |
144 | 144 | |
145 | 145 | $i = 2; |
146 | - $absolutePath = $this->recipientView->getAbsolutePath($path) . '/'; |
|
146 | + $absolutePath = $this->recipientView->getAbsolutePath($path).'/'; |
|
147 | 147 | while ($view->file_exists($path) || isset($mountpoints[$absolutePath])) { |
148 | - $path = Filesystem::normalizePath($dir . '/' . $name . ' (' . $i . ')' . $ext); |
|
149 | - $absolutePath = $this->recipientView->getAbsolutePath($path) . '/'; |
|
148 | + $path = Filesystem::normalizePath($dir.'/'.$name.' ('.$i.')'.$ext); |
|
149 | + $absolutePath = $this->recipientView->getAbsolutePath($path).'/'; |
|
150 | 150 | $i++; |
151 | 151 | } |
152 | 152 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | // it is not a file relative to data/user/files |
168 | 168 | if (count($split) < 3 || $split[1] !== 'files') { |
169 | 169 | \OCP\Util::writeLog('file sharing', |
170 | - 'Can not strip userid and "files/" from path: ' . $path, |
|
170 | + 'Can not strip userid and "files/" from path: '.$path, |
|
171 | 171 | \OCP\Util::ERROR); |
172 | 172 | throw new \OCA\Files_Sharing\Exceptions\BrokenPath('Path does not start with /user/files', 10); |
173 | 173 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $sliced = array_slice($split, 2); |
177 | 177 | $relPath = implode('/', $sliced); |
178 | 178 | |
179 | - return '/' . $relPath; |
|
179 | + return '/'.$relPath; |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | $this->storage->setMountPoint($relTargetPath); |
199 | 199 | } catch (\Exception $e) { |
200 | 200 | \OCP\Util::writeLog('file sharing', |
201 | - 'Could not rename mount point for shared folder "' . $this->getMountPoint() . '" to "' . $target . '"', |
|
201 | + 'Could not rename mount point for shared folder "'.$this->getMountPoint().'" to "'.$target.'"', |
|
202 | 202 | \OCP\Util::ERROR); |
203 | 203 | } |
204 | 204 | |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | $row = $result->fetch(); |
254 | 254 | $result->closeCursor(); |
255 | 255 | if ($row) { |
256 | - return (int)$row['storage']; |
|
256 | + return (int) $row['storage']; |
|
257 | 257 | } |
258 | 258 | return -1; |
259 | 259 | } |
@@ -76,14 +76,14 @@ discard block |
||
76 | 76 | $shares = array_merge($shares, $this->shareManager->getSharedWith($user->getUID(), \OCP\Share::SHARE_TYPE_CIRCLE, null, -1)); |
77 | 77 | |
78 | 78 | // filter out excluded shares and group shares that includes self |
79 | - $shares = array_filter($shares, function (\OCP\Share\IShare $share) use ($user) { |
|
79 | + $shares = array_filter($shares, function(\OCP\Share\IShare $share) use ($user) { |
|
80 | 80 | return $share->getPermissions() > 0 && $share->getShareOwner() !== $user->getUID(); |
81 | 81 | }); |
82 | 82 | |
83 | 83 | $superShares = $this->buildSuperShares($shares, $user); |
84 | 84 | |
85 | 85 | $mounts = []; |
86 | - $view = new View('/' . $user->getUID() . '/files'); |
|
86 | + $view = new View('/'.$user->getUID().'/files'); |
|
87 | 87 | $ownerViews = []; |
88 | 88 | $sharingDisabledForUser = $this->shareManager->sharingDisabledForUser($user->getUID()); |
89 | 89 | $foldersExistCache = new CappedMemoryCache(); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $parentShare = $share[0]; |
94 | 94 | $owner = $parentShare->getShareOwner(); |
95 | 95 | if (!isset($ownerViews[$owner])) { |
96 | - $ownerViews[$owner] = new View('/' . $parentShare->getShareOwner() . '/files'); |
|
96 | + $ownerViews[$owner] = new View('/'.$parentShare->getShareOwner().'/files'); |
|
97 | 97 | } |
98 | 98 | $mount = new SharedMount( |
99 | 99 | '\OCA\Files_Sharing\SharedStorage', |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | // null groups which usually appear with group backend |
204 | 204 | // caching inconsistencies |
205 | 205 | $this->logger->debug( |
206 | - 'Could not adjust share target for share ' . $share->getId() . ' to make it consistent: ' . $e->getMessage(), |
|
206 | + 'Could not adjust share target for share '.$share->getId().' to make it consistent: '.$e->getMessage(), |
|
207 | 207 | ['app' => 'files_sharing'] |
208 | 208 | ); |
209 | 209 | } |
@@ -126,9 +126,9 @@ discard block |
||
126 | 126 | $path = '/'; |
127 | 127 | } |
128 | 128 | if ($path[0] !== '/') { |
129 | - $path = '/' . $path; |
|
129 | + $path = '/'.$path; |
|
130 | 130 | } |
131 | - return $this->fakeRoot . $path; |
|
131 | + return $this->fakeRoot.$path; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | public function chroot($fakeRoot) { |
141 | 141 | if (!$fakeRoot == '') { |
142 | 142 | if ($fakeRoot[0] !== '/') { |
143 | - $fakeRoot = '/' . $fakeRoot; |
|
143 | + $fakeRoot = '/'.$fakeRoot; |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | $this->fakeRoot = $fakeRoot; |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | } |
173 | 173 | |
174 | 174 | // missing slashes can cause wrong matches! |
175 | - $root = rtrim($this->fakeRoot, '/') . '/'; |
|
175 | + $root = rtrim($this->fakeRoot, '/').'/'; |
|
176 | 176 | |
177 | 177 | if (strpos($path, $root) !== 0) { |
178 | 178 | return null; |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | if ($mount instanceof MoveableMount) { |
279 | 279 | // cut of /user/files to get the relative path to data/user/files |
280 | 280 | $pathParts = explode('/', $path, 4); |
281 | - $relPath = '/' . $pathParts[3]; |
|
281 | + $relPath = '/'.$pathParts[3]; |
|
282 | 282 | $this->lockFile($relPath, ILockingProvider::LOCK_SHARED, true); |
283 | 283 | \OC_Hook::emit( |
284 | 284 | Filesystem::CLASSNAME, "umount", |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | } |
701 | 701 | $postFix = (substr($path, -1, 1) === '/') ? '/' : ''; |
702 | 702 | $absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path)); |
703 | - $mount = Filesystem::getMountManager()->find($absolutePath . $postFix); |
|
703 | + $mount = Filesystem::getMountManager()->find($absolutePath.$postFix); |
|
704 | 704 | if ($mount and $mount->getInternalPath($absolutePath) === '') { |
705 | 705 | return $this->removeMount($mount, $absolutePath); |
706 | 706 | } |
@@ -820,7 +820,7 @@ discard block |
||
820 | 820 | $this->renameUpdate($storage1, $storage2, $internalPath1, $internalPath2); |
821 | 821 | } |
822 | 822 | } |
823 | - } catch(\Exception $e) { |
|
823 | + } catch (\Exception $e) { |
|
824 | 824 | throw $e; |
825 | 825 | } finally { |
826 | 826 | $this->changeLock($path1, ILockingProvider::LOCK_SHARED, true); |
@@ -844,7 +844,7 @@ discard block |
||
844 | 844 | } |
845 | 845 | } |
846 | 846 | } |
847 | - } catch(\Exception $e) { |
|
847 | + } catch (\Exception $e) { |
|
848 | 848 | throw $e; |
849 | 849 | } finally { |
850 | 850 | $this->unlockFile($path1, ILockingProvider::LOCK_SHARED, true); |
@@ -977,7 +977,7 @@ discard block |
||
977 | 977 | $hooks[] = 'write'; |
978 | 978 | break; |
979 | 979 | default: |
980 | - \OCP\Util::writeLog('core', 'invalid mode (' . $mode . ') for ' . $path, \OCP\Util::ERROR); |
|
980 | + \OCP\Util::writeLog('core', 'invalid mode ('.$mode.') for '.$path, \OCP\Util::ERROR); |
|
981 | 981 | } |
982 | 982 | |
983 | 983 | if ($mode !== 'r' && $mode !== 'w') { |
@@ -1081,7 +1081,7 @@ discard block |
||
1081 | 1081 | array(Filesystem::signal_param_path => $this->getHookPath($path)) |
1082 | 1082 | ); |
1083 | 1083 | } |
1084 | - list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix); |
|
1084 | + list($storage, $internalPath) = Filesystem::resolvePath($absolutePath.$postFix); |
|
1085 | 1085 | if ($storage) { |
1086 | 1086 | $result = $storage->hash($type, $internalPath, $raw); |
1087 | 1087 | return $result; |
@@ -1136,7 +1136,7 @@ discard block |
||
1136 | 1136 | |
1137 | 1137 | $run = $this->runHooks($hooks, $path); |
1138 | 1138 | /** @var \OC\Files\Storage\Storage $storage */ |
1139 | - list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix); |
|
1139 | + list($storage, $internalPath) = Filesystem::resolvePath($absolutePath.$postFix); |
|
1140 | 1140 | if ($run and $storage) { |
1141 | 1141 | if (in_array('write', $hooks) || in_array('delete', $hooks)) { |
1142 | 1142 | $this->changeLock($path, ILockingProvider::LOCK_EXCLUSIVE); |
@@ -1175,7 +1175,7 @@ discard block |
||
1175 | 1175 | $unlockLater = true; |
1176 | 1176 | // make sure our unlocking callback will still be called if connection is aborted |
1177 | 1177 | ignore_user_abort(true); |
1178 | - $result = CallbackWrapper::wrap($result, null, null, function () use ($hooks, $path) { |
|
1178 | + $result = CallbackWrapper::wrap($result, null, null, function() use ($hooks, $path) { |
|
1179 | 1179 | if (in_array('write', $hooks)) { |
1180 | 1180 | $this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE); |
1181 | 1181 | } else if (in_array('read', $hooks)) { |
@@ -1236,7 +1236,7 @@ discard block |
||
1236 | 1236 | return true; |
1237 | 1237 | } |
1238 | 1238 | |
1239 | - return (strlen($fullPath) > strlen($defaultRoot)) && (substr($fullPath, 0, strlen($defaultRoot) + 1) === $defaultRoot . '/'); |
|
1239 | + return (strlen($fullPath) > strlen($defaultRoot)) && (substr($fullPath, 0, strlen($defaultRoot) + 1) === $defaultRoot.'/'); |
|
1240 | 1240 | } |
1241 | 1241 | |
1242 | 1242 | /** |
@@ -1255,7 +1255,7 @@ discard block |
||
1255 | 1255 | if ($hook != 'read') { |
1256 | 1256 | \OC_Hook::emit( |
1257 | 1257 | Filesystem::CLASSNAME, |
1258 | - $prefix . $hook, |
|
1258 | + $prefix.$hook, |
|
1259 | 1259 | array( |
1260 | 1260 | Filesystem::signal_param_run => &$run, |
1261 | 1261 | Filesystem::signal_param_path => $path |
@@ -1264,7 +1264,7 @@ discard block |
||
1264 | 1264 | } elseif (!$post) { |
1265 | 1265 | \OC_Hook::emit( |
1266 | 1266 | Filesystem::CLASSNAME, |
1267 | - $prefix . $hook, |
|
1267 | + $prefix.$hook, |
|
1268 | 1268 | array( |
1269 | 1269 | Filesystem::signal_param_path => $path |
1270 | 1270 | ) |
@@ -1357,7 +1357,7 @@ discard block |
||
1357 | 1357 | return $this->getPartFileInfo($path); |
1358 | 1358 | } |
1359 | 1359 | $relativePath = $path; |
1360 | - $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path); |
|
1360 | + $path = Filesystem::normalizePath($this->fakeRoot.'/'.$path); |
|
1361 | 1361 | |
1362 | 1362 | $mount = Filesystem::getMountManager()->find($path); |
1363 | 1363 | if (!$mount) { |
@@ -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 | })); |
@@ -1438,12 +1438,12 @@ discard block |
||
1438 | 1438 | /** |
1439 | 1439 | * @var \OC\Files\FileInfo[] $fileInfos |
1440 | 1440 | */ |
1441 | - $fileInfos = array_map(function (ICacheEntry $content) use ($path, $storage, $mount, $sharingDisabled) { |
|
1441 | + $fileInfos = array_map(function(ICacheEntry $content) use ($path, $storage, $mount, $sharingDisabled) { |
|
1442 | 1442 | if ($sharingDisabled) { |
1443 | 1443 | $content['permissions'] = $content['permissions'] & ~\OCP\Constants::PERMISSION_SHARE; |
1444 | 1444 | } |
1445 | 1445 | $owner = $this->getUserObjectForOwner($storage->getOwner($content['path'])); |
1446 | - return new FileInfo($path . '/' . $content['name'], $storage, $content['path'], $content, $mount, $owner); |
|
1446 | + return new FileInfo($path.'/'.$content['name'], $storage, $content['path'], $content, $mount, $owner); |
|
1447 | 1447 | }, $contents); |
1448 | 1448 | $files = array_combine($fileNames, $fileInfos); |
1449 | 1449 | |
@@ -1469,8 +1469,8 @@ discard block |
||
1469 | 1469 | // sometimes when the storage is not available it can be any exception |
1470 | 1470 | \OCP\Util::writeLog( |
1471 | 1471 | 'core', |
1472 | - 'Exception while scanning storage "' . $subStorage->getId() . '": ' . |
|
1473 | - get_class($e) . ': ' . $e->getMessage(), |
|
1472 | + 'Exception while scanning storage "'.$subStorage->getId().'": '. |
|
1473 | + get_class($e).': '.$e->getMessage(), |
|
1474 | 1474 | \OCP\Util::ERROR |
1475 | 1475 | ); |
1476 | 1476 | continue; |
@@ -1500,7 +1500,7 @@ discard block |
||
1500 | 1500 | $rootEntry['permissions'] = $permissions & (\OCP\Constants::PERMISSION_ALL - (\OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE)); |
1501 | 1501 | } |
1502 | 1502 | |
1503 | - $rootEntry['path'] = substr(Filesystem::normalizePath($path . '/' . $rootEntry['name']), strlen($user) + 2); // full path without /$user/ |
|
1503 | + $rootEntry['path'] = substr(Filesystem::normalizePath($path.'/'.$rootEntry['name']), strlen($user) + 2); // full path without /$user/ |
|
1504 | 1504 | |
1505 | 1505 | // if sharing was disabled for the user we remove the share permissions |
1506 | 1506 | if (\OCP\Util::isSharingDisabledForUser()) { |
@@ -1508,14 +1508,14 @@ discard block |
||
1508 | 1508 | } |
1509 | 1509 | |
1510 | 1510 | $owner = $this->getUserObjectForOwner($subStorage->getOwner('')); |
1511 | - $files[$rootEntry->getName()] = new FileInfo($path . '/' . $rootEntry['name'], $subStorage, '', $rootEntry, $mount, $owner); |
|
1511 | + $files[$rootEntry->getName()] = new FileInfo($path.'/'.$rootEntry['name'], $subStorage, '', $rootEntry, $mount, $owner); |
|
1512 | 1512 | } |
1513 | 1513 | } |
1514 | 1514 | } |
1515 | 1515 | } |
1516 | 1516 | |
1517 | 1517 | if ($mimetype_filter) { |
1518 | - $files = array_filter($files, function (FileInfo $file) use ($mimetype_filter) { |
|
1518 | + $files = array_filter($files, function(FileInfo $file) use ($mimetype_filter) { |
|
1519 | 1519 | if (strpos($mimetype_filter, '/')) { |
1520 | 1520 | return $file->getMimetype() === $mimetype_filter; |
1521 | 1521 | } else { |
@@ -1544,7 +1544,7 @@ discard block |
||
1544 | 1544 | if ($data instanceof FileInfo) { |
1545 | 1545 | $data = $data->getData(); |
1546 | 1546 | } |
1547 | - $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path); |
|
1547 | + $path = Filesystem::normalizePath($this->fakeRoot.'/'.$path); |
|
1548 | 1548 | /** |
1549 | 1549 | * @var \OC\Files\Storage\Storage $storage |
1550 | 1550 | * @var string $internalPath |
@@ -1571,7 +1571,7 @@ discard block |
||
1571 | 1571 | * @return FileInfo[] |
1572 | 1572 | */ |
1573 | 1573 | public function search($query) { |
1574 | - return $this->searchCommon('search', array('%' . $query . '%')); |
|
1574 | + return $this->searchCommon('search', array('%'.$query.'%')); |
|
1575 | 1575 | } |
1576 | 1576 | |
1577 | 1577 | /** |
@@ -1622,10 +1622,10 @@ discard block |
||
1622 | 1622 | |
1623 | 1623 | $results = call_user_func_array(array($cache, $method), $args); |
1624 | 1624 | foreach ($results as $result) { |
1625 | - if (substr($mountPoint . $result['path'], 0, $rootLength + 1) === $this->fakeRoot . '/') { |
|
1625 | + if (substr($mountPoint.$result['path'], 0, $rootLength + 1) === $this->fakeRoot.'/') { |
|
1626 | 1626 | $internalPath = $result['path']; |
1627 | - $path = $mountPoint . $result['path']; |
|
1628 | - $result['path'] = substr($mountPoint . $result['path'], $rootLength); |
|
1627 | + $path = $mountPoint.$result['path']; |
|
1628 | + $result['path'] = substr($mountPoint.$result['path'], $rootLength); |
|
1629 | 1629 | $owner = \OC::$server->getUserManager()->get($storage->getOwner($internalPath)); |
1630 | 1630 | $files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner); |
1631 | 1631 | } |
@@ -1643,8 +1643,8 @@ discard block |
||
1643 | 1643 | if ($results) { |
1644 | 1644 | foreach ($results as $result) { |
1645 | 1645 | $internalPath = $result['path']; |
1646 | - $result['path'] = rtrim($relativeMountPoint . $result['path'], '/'); |
|
1647 | - $path = rtrim($mountPoint . $internalPath, '/'); |
|
1646 | + $result['path'] = rtrim($relativeMountPoint.$result['path'], '/'); |
|
1647 | + $path = rtrim($mountPoint.$internalPath, '/'); |
|
1648 | 1648 | $owner = \OC::$server->getUserManager()->get($storage->getOwner($internalPath)); |
1649 | 1649 | $files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner); |
1650 | 1650 | } |
@@ -1665,7 +1665,7 @@ discard block |
||
1665 | 1665 | public function getOwner($path) { |
1666 | 1666 | $info = $this->getFileInfo($path); |
1667 | 1667 | if (!$info) { |
1668 | - throw new NotFoundException($path . ' not found while trying to get owner'); |
|
1668 | + throw new NotFoundException($path.' not found while trying to get owner'); |
|
1669 | 1669 | } |
1670 | 1670 | return $info->getOwner()->getUID(); |
1671 | 1671 | } |
@@ -1699,7 +1699,7 @@ discard block |
||
1699 | 1699 | * @return string |
1700 | 1700 | */ |
1701 | 1701 | public function getPath($id) { |
1702 | - $id = (int)$id; |
|
1702 | + $id = (int) $id; |
|
1703 | 1703 | $manager = Filesystem::getMountManager(); |
1704 | 1704 | $mounts = $manager->findIn($this->fakeRoot); |
1705 | 1705 | $mounts[] = $manager->find($this->fakeRoot); |
@@ -1714,7 +1714,7 @@ discard block |
||
1714 | 1714 | $cache = $mount->getStorage()->getCache(); |
1715 | 1715 | $internalPath = $cache->getPathById($id); |
1716 | 1716 | if (is_string($internalPath)) { |
1717 | - $fullPath = $mount->getMountPoint() . $internalPath; |
|
1717 | + $fullPath = $mount->getMountPoint().$internalPath; |
|
1718 | 1718 | if (!is_null($path = $this->getRelativePath($fullPath))) { |
1719 | 1719 | return $path; |
1720 | 1720 | } |
@@ -1757,10 +1757,10 @@ discard block |
||
1757 | 1757 | } |
1758 | 1758 | |
1759 | 1759 | // note: cannot use the view because the target is already locked |
1760 | - $fileId = (int)$targetStorage->getCache()->getId($targetInternalPath); |
|
1760 | + $fileId = (int) $targetStorage->getCache()->getId($targetInternalPath); |
|
1761 | 1761 | if ($fileId === -1) { |
1762 | 1762 | // target might not exist, need to check parent instead |
1763 | - $fileId = (int)$targetStorage->getCache()->getId(dirname($targetInternalPath)); |
|
1763 | + $fileId = (int) $targetStorage->getCache()->getId(dirname($targetInternalPath)); |
|
1764 | 1764 | } |
1765 | 1765 | |
1766 | 1766 | // check if any of the parents were shared by the current owner (include collections) |
@@ -1860,7 +1860,7 @@ discard block |
||
1860 | 1860 | $resultPath = ''; |
1861 | 1861 | foreach ($parts as $part) { |
1862 | 1862 | if ($part) { |
1863 | - $resultPath .= '/' . $part; |
|
1863 | + $resultPath .= '/'.$part; |
|
1864 | 1864 | $result[] = $resultPath; |
1865 | 1865 | } |
1866 | 1866 | } |
@@ -2123,16 +2123,16 @@ discard block |
||
2123 | 2123 | public function getUidAndFilename($filename) { |
2124 | 2124 | $info = $this->getFileInfo($filename); |
2125 | 2125 | if (!$info instanceof \OCP\Files\FileInfo) { |
2126 | - throw new NotFoundException($this->getAbsolutePath($filename) . ' not found'); |
|
2126 | + throw new NotFoundException($this->getAbsolutePath($filename).' not found'); |
|
2127 | 2127 | } |
2128 | 2128 | $uid = $info->getOwner()->getUID(); |
2129 | 2129 | if ($uid != \OCP\User::getUser()) { |
2130 | 2130 | Filesystem::initMountPoints($uid); |
2131 | - $ownerView = new View('/' . $uid . '/files'); |
|
2131 | + $ownerView = new View('/'.$uid.'/files'); |
|
2132 | 2132 | try { |
2133 | 2133 | $filename = $ownerView->getPath($info['fileid']); |
2134 | 2134 | } catch (NotFoundException $e) { |
2135 | - throw new NotFoundException('File with id ' . $info['fileid'] . ' not found for user ' . $uid); |
|
2135 | + throw new NotFoundException('File with id '.$info['fileid'].' not found for user '.$uid); |
|
2136 | 2136 | } |
2137 | 2137 | } |
2138 | 2138 | return [$uid, $filename]; |
@@ -2149,7 +2149,7 @@ discard block |
||
2149 | 2149 | $directoryParts = array_filter($directoryParts); |
2150 | 2150 | foreach ($directoryParts as $key => $part) { |
2151 | 2151 | $currentPathElements = array_slice($directoryParts, 0, $key); |
2152 | - $currentPath = '/' . implode('/', $currentPathElements); |
|
2152 | + $currentPath = '/'.implode('/', $currentPathElements); |
|
2153 | 2153 | if ($this->is_file($currentPath)) { |
2154 | 2154 | return false; |
2155 | 2155 | } |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | |
356 | 356 | if ($fullId === null && $expirationDate === null && $this->shareApiLinkDefaultExpireDate()) { |
357 | 357 | $expirationDate = new \DateTime(); |
358 | - $expirationDate->setTime(0,0,0); |
|
358 | + $expirationDate->setTime(0, 0, 0); |
|
359 | 359 | $expirationDate->add(new \DateInterval('P'.$this->shareApiLinkDefaultExpireDays().'D')); |
360 | 360 | } |
361 | 361 | |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | |
368 | 368 | $date = new \DateTime(); |
369 | 369 | $date->setTime(0, 0, 0); |
370 | - $date->add(new \DateInterval('P' . $this->shareApiLinkDefaultExpireDays() . 'D')); |
|
370 | + $date->add(new \DateInterval('P'.$this->shareApiLinkDefaultExpireDays().'D')); |
|
371 | 371 | if ($date < $expirationDate) { |
372 | 372 | $message = $this->l->t('Can’t set expiration date more than %s days in the future', [$this->shareApiLinkDefaultExpireDays()]); |
373 | 373 | throw new GenericShareException($message, $message, 404); |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | */ |
421 | 421 | $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_USER); |
422 | 422 | $existingShares = $provider->getSharesByPath($share->getNode()); |
423 | - foreach($existingShares as $existingShare) { |
|
423 | + foreach ($existingShares as $existingShare) { |
|
424 | 424 | // Ignore if it is the same share |
425 | 425 | try { |
426 | 426 | if ($existingShare->getFullId() === $share->getFullId()) { |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | */ |
478 | 478 | $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_GROUP); |
479 | 479 | $existingShares = $provider->getSharesByPath($share->getNode()); |
480 | - foreach($existingShares as $existingShare) { |
|
480 | + foreach ($existingShares as $existingShare) { |
|
481 | 481 | try { |
482 | 482 | if ($existingShare->getFullId() === $share->getFullId()) { |
483 | 483 | continue; |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | // Make sure that we do not share a path that contains a shared mountpoint |
547 | 547 | if ($path instanceof \OCP\Files\Folder) { |
548 | 548 | $mounts = $this->mountManager->findIn($path->getPath()); |
549 | - foreach($mounts as $mount) { |
|
549 | + foreach ($mounts as $mount) { |
|
550 | 550 | if ($mount->getStorage()->instanceOfStorage('\OCA\Files_Sharing\ISharedStorage')) { |
551 | 551 | throw new \InvalidArgumentException('Path contains files shared with you'); |
552 | 552 | } |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | $storage = $share->getNode()->getStorage(); |
595 | 595 | if ($storage->instanceOfStorage('OCA\Files_Sharing\External\Storage')) { |
596 | 596 | $parent = $share->getNode()->getParent(); |
597 | - while($parent->getStorage()->instanceOfStorage('OCA\Files_Sharing\External\Storage')) { |
|
597 | + while ($parent->getStorage()->instanceOfStorage('OCA\Files_Sharing\External\Storage')) { |
|
598 | 598 | $parent = $parent->getParent(); |
599 | 599 | } |
600 | 600 | $share->setShareOwner($parent->getOwner()->getUID()); |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | } |
648 | 648 | |
649 | 649 | // Generate the target |
650 | - $target = $this->config->getSystemValue('share_folder', '/') .'/'. $share->getNode()->getName(); |
|
650 | + $target = $this->config->getSystemValue('share_folder', '/').'/'.$share->getNode()->getName(); |
|
651 | 651 | $target = \OC\Files\Filesystem::normalizePath($target); |
652 | 652 | $share->setTarget($target); |
653 | 653 | |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | |
671 | 671 | if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) { |
672 | 672 | $mailSend = $share->getMailSend(); |
673 | - if($mailSend === true) { |
|
673 | + if ($mailSend === true) { |
|
674 | 674 | $user = $this->userManager->get($share->getSharedWith()); |
675 | 675 | if ($user !== null) { |
676 | 676 | $emailAddress = $user->getEMailAddress(); |
@@ -685,12 +685,12 @@ discard block |
||
685 | 685 | $emailAddress, |
686 | 686 | $share->getExpirationDate() |
687 | 687 | ); |
688 | - $this->logger->debug('Send share notification to ' . $emailAddress . ' for share with ID ' . $share->getId(), ['app' => 'share']); |
|
688 | + $this->logger->debug('Send share notification to '.$emailAddress.' for share with ID '.$share->getId(), ['app' => 'share']); |
|
689 | 689 | } else { |
690 | - $this->logger->debug('Share notification not send to ' . $share->getSharedWith() . ' because email address is not set.', ['app' => 'share']); |
|
690 | + $this->logger->debug('Share notification not send to '.$share->getSharedWith().' because email address is not set.', ['app' => 'share']); |
|
691 | 691 | } |
692 | 692 | } else { |
693 | - $this->logger->debug('Share notification not send to ' . $share->getSharedWith() . ' because user could not be found.', ['app' => 'share']); |
|
693 | + $this->logger->debug('Share notification not send to '.$share->getSharedWith().' because user could not be found.', ['app' => 'share']); |
|
694 | 694 | } |
695 | 695 | } else { |
696 | 696 | $this->logger->debug('Share notification not send because mailsend is false.', ['app' => 'share']); |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | $text = $l->t('%s shared »%s« with you.', [$initiatorDisplayName, $filename]); |
735 | 735 | |
736 | 736 | $emailTemplate->addBodyText( |
737 | - $text . ' ' . $l->t('Click the button below to open it.'), |
|
737 | + $text.' '.$l->t('Click the button below to open it.'), |
|
738 | 738 | $text |
739 | 739 | ); |
740 | 740 | $emailTemplate->addBodyButton( |
@@ -758,9 +758,9 @@ discard block |
||
758 | 758 | // The "Reply-To" is set to the sharer if an mail address is configured |
759 | 759 | // also the default footer contains a "Do not reply" which needs to be adjusted. |
760 | 760 | $initiatorEmail = $initiatorUser->getEMailAddress(); |
761 | - if($initiatorEmail !== null) { |
|
761 | + if ($initiatorEmail !== null) { |
|
762 | 762 | $message->setReplyTo([$initiatorEmail => $initiatorDisplayName]); |
763 | - $emailTemplate->addFooter($instanceName . ($this->defaults->getSlogan() !== '' ? ' - ' . $this->defaults->getSlogan() : '')); |
|
763 | + $emailTemplate->addFooter($instanceName.($this->defaults->getSlogan() !== '' ? ' - '.$this->defaults->getSlogan() : '')); |
|
764 | 764 | } else { |
765 | 765 | $emailTemplate->addFooter(); |
766 | 766 | } |
@@ -969,7 +969,7 @@ discard block |
||
969 | 969 | * @param string $recipientId |
970 | 970 | */ |
971 | 971 | public function deleteFromSelf(\OCP\Share\IShare $share, $recipientId) { |
972 | - list($providerId, ) = $this->splitFullId($share->getFullId()); |
|
972 | + list($providerId,) = $this->splitFullId($share->getFullId()); |
|
973 | 973 | $provider = $this->factory->getProvider($providerId); |
974 | 974 | |
975 | 975 | $provider->deleteFromSelf($share, $recipientId); |
@@ -992,7 +992,7 @@ discard block |
||
992 | 992 | if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { |
993 | 993 | $sharedWith = $this->groupManager->get($share->getSharedWith()); |
994 | 994 | if (is_null($sharedWith)) { |
995 | - throw new \InvalidArgumentException('Group "' . $share->getSharedWith() . '" does not exist'); |
|
995 | + throw new \InvalidArgumentException('Group "'.$share->getSharedWith().'" does not exist'); |
|
996 | 996 | } |
997 | 997 | $recipient = $this->userManager->get($recipientId); |
998 | 998 | if (!$sharedWith->inGroup($recipient)) { |
@@ -1000,7 +1000,7 @@ discard block |
||
1000 | 1000 | } |
1001 | 1001 | } |
1002 | 1002 | |
1003 | - list($providerId, ) = $this->splitFullId($share->getFullId()); |
|
1003 | + list($providerId,) = $this->splitFullId($share->getFullId()); |
|
1004 | 1004 | $provider = $this->factory->getProvider($providerId); |
1005 | 1005 | |
1006 | 1006 | $provider->move($share, $recipientId); |
@@ -1047,7 +1047,7 @@ discard block |
||
1047 | 1047 | |
1048 | 1048 | $shares2 = []; |
1049 | 1049 | |
1050 | - while(true) { |
|
1050 | + while (true) { |
|
1051 | 1051 | $added = 0; |
1052 | 1052 | foreach ($shares as $share) { |
1053 | 1053 | |
@@ -1152,7 +1152,7 @@ discard block |
||
1152 | 1152 | * |
1153 | 1153 | * @return Share[] |
1154 | 1154 | */ |
1155 | - public function getSharesByPath(\OCP\Files\Node $path, $page=0, $perPage=50) { |
|
1155 | + public function getSharesByPath(\OCP\Files\Node $path, $page = 0, $perPage = 50) { |
|
1156 | 1156 | return []; |
1157 | 1157 | } |
1158 | 1158 | |
@@ -1171,7 +1171,7 @@ discard block |
||
1171 | 1171 | } |
1172 | 1172 | $share = null; |
1173 | 1173 | try { |
1174 | - if($this->shareApiAllowLinks()) { |
|
1174 | + if ($this->shareApiAllowLinks()) { |
|
1175 | 1175 | $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_LINK); |
1176 | 1176 | $share = $provider->getShareByToken($token); |
1177 | 1177 | } |
@@ -1378,7 +1378,7 @@ discard block |
||
1378 | 1378 | } |
1379 | 1379 | $al['users'][$owner] = [ |
1380 | 1380 | 'node_id' => $path->getId(), |
1381 | - 'node_path' => '/' . $ownerPath, |
|
1381 | + 'node_path' => '/'.$ownerPath, |
|
1382 | 1382 | ]; |
1383 | 1383 | } else { |
1384 | 1384 | $al['users'][] = $owner; |
@@ -1478,7 +1478,7 @@ discard block |
||
1478 | 1478 | * @return int |
1479 | 1479 | */ |
1480 | 1480 | public function shareApiLinkDefaultExpireDays() { |
1481 | - return (int)$this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
1481 | + return (int) $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
1482 | 1482 | } |
1483 | 1483 | |
1484 | 1484 | /** |