@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | $path = '/'; |
95 | 95 | } |
96 | 96 | if ($path[0] !== '/') { |
97 | - $path = '/' . $path; |
|
97 | + $path = '/'.$path; |
|
98 | 98 | } |
99 | - return $this->fakeRoot . $path; |
|
99 | + return $this->fakeRoot.$path; |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | public function chroot($fakeRoot): void { |
108 | 108 | if (!$fakeRoot == '') { |
109 | 109 | if ($fakeRoot[0] !== '/') { |
110 | - $fakeRoot = '/' . $fakeRoot; |
|
110 | + $fakeRoot = '/'.$fakeRoot; |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 | $this->fakeRoot = $fakeRoot; |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | } |
137 | 137 | |
138 | 138 | // missing slashes can cause wrong matches! |
139 | - $root = rtrim($this->fakeRoot, '/') . '/'; |
|
139 | + $root = rtrim($this->fakeRoot, '/').'/'; |
|
140 | 140 | |
141 | 141 | if (!str_starts_with($path, $root)) { |
142 | 142 | return null; |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | * |
194 | 194 | * @param string $path |
195 | 195 | */ |
196 | - public function getLocalFile($path): string|false { |
|
196 | + public function getLocalFile($path): string | false { |
|
197 | 197 | $parent = substr($path, 0, strrpos($path, '/') ?: 0); |
198 | 198 | $path = $this->getAbsolutePath($path); |
199 | 199 | [$storage, $internalPath] = Filesystem::resolvePath($path); |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | if ($mount instanceof MoveableMount) { |
224 | 224 | // cut of /user/files to get the relative path to data/user/files |
225 | 225 | $pathParts = explode('/', $path, 4); |
226 | - $relPath = '/' . $pathParts[3]; |
|
226 | + $relPath = '/'.$pathParts[3]; |
|
227 | 227 | $this->lockFile($relPath, ILockingProvider::LOCK_SHARED, true); |
228 | 228 | \OC_Hook::emit( |
229 | 229 | Filesystem::CLASSNAME, 'umount', |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | } |
668 | 668 | $postFix = (substr($path, -1) === '/') ? '/' : ''; |
669 | 669 | $absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path)); |
670 | - $mount = Filesystem::getMountManager()->find($absolutePath . $postFix); |
|
670 | + $mount = Filesystem::getMountManager()->find($absolutePath.$postFix); |
|
671 | 671 | if ($mount->getInternalPath($absolutePath) === '') { |
672 | 672 | return $this->removeMount($mount, $absolutePath); |
673 | 673 | } |
@@ -710,7 +710,7 @@ discard block |
||
710 | 710 | $absolutePath1 = Filesystem::normalizePath($this->getAbsolutePath($source)); |
711 | 711 | $absolutePath2 = Filesystem::normalizePath($this->getAbsolutePath($target)); |
712 | 712 | |
713 | - if (str_starts_with($absolutePath2, $absolutePath1 . '/')) { |
|
713 | + if (str_starts_with($absolutePath2, $absolutePath1.'/')) { |
|
714 | 714 | throw new ForbiddenException('Moving a folder into a child folder is forbidden', false); |
715 | 715 | } |
716 | 716 | |
@@ -1028,7 +1028,7 @@ discard block |
||
1028 | 1028 | $hooks[] = 'write'; |
1029 | 1029 | break; |
1030 | 1030 | default: |
1031 | - $this->logger->error('invalid mode (' . $mode . ') for ' . $path, ['app' => 'core']); |
|
1031 | + $this->logger->error('invalid mode ('.$mode.') for '.$path, ['app' => 'core']); |
|
1032 | 1032 | } |
1033 | 1033 | |
1034 | 1034 | if ($mode !== 'r' && $mode !== 'w') { |
@@ -1052,7 +1052,7 @@ discard block |
||
1052 | 1052 | * @param string $path |
1053 | 1053 | * @throws InvalidPathException |
1054 | 1054 | */ |
1055 | - public function toTmpFile($path): string|false { |
|
1055 | + public function toTmpFile($path): string | false { |
|
1056 | 1056 | $this->assertPathLength($path); |
1057 | 1057 | if (Filesystem::isValidPath($path)) { |
1058 | 1058 | $source = $this->fopen($path, 'r'); |
@@ -1127,7 +1127,7 @@ discard block |
||
1127 | 1127 | * @param string $path |
1128 | 1128 | * @param bool $raw |
1129 | 1129 | */ |
1130 | - public function hash($type, $path, $raw = false): string|bool { |
|
1130 | + public function hash($type, $path, $raw = false): string | bool { |
|
1131 | 1131 | $postFix = (substr($path, -1) === '/') ? '/' : ''; |
1132 | 1132 | $absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path)); |
1133 | 1133 | if (Filesystem::isValidPath($path)) { |
@@ -1143,7 +1143,7 @@ discard block |
||
1143 | 1143 | ); |
1144 | 1144 | } |
1145 | 1145 | /** @var Storage|null $storage */ |
1146 | - [$storage, $internalPath] = Filesystem::resolvePath($absolutePath . $postFix); |
|
1146 | + [$storage, $internalPath] = Filesystem::resolvePath($absolutePath.$postFix); |
|
1147 | 1147 | if ($storage) { |
1148 | 1148 | return $storage->hash($type, $internalPath, $raw); |
1149 | 1149 | } |
@@ -1193,7 +1193,7 @@ discard block |
||
1193 | 1193 | } |
1194 | 1194 | |
1195 | 1195 | $run = $this->runHooks($hooks, $path); |
1196 | - [$storage, $internalPath] = Filesystem::resolvePath($absolutePath . $postFix); |
|
1196 | + [$storage, $internalPath] = Filesystem::resolvePath($absolutePath.$postFix); |
|
1197 | 1197 | if ($run && $storage) { |
1198 | 1198 | /** @var Storage $storage */ |
1199 | 1199 | if (in_array('write', $hooks) || in_array('delete', $hooks)) { |
@@ -1241,7 +1241,7 @@ discard block |
||
1241 | 1241 | $unlockLater = true; |
1242 | 1242 | // make sure our unlocking callback will still be called if connection is aborted |
1243 | 1243 | ignore_user_abort(true); |
1244 | - $result = CallbackWrapper::wrap($result, null, null, function () use ($hooks, $path) { |
|
1244 | + $result = CallbackWrapper::wrap($result, null, null, function() use ($hooks, $path) { |
|
1245 | 1245 | if (in_array('write', $hooks)) { |
1246 | 1246 | $this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE); |
1247 | 1247 | } elseif (in_array('read', $hooks)) { |
@@ -1303,7 +1303,7 @@ discard block |
||
1303 | 1303 | return true; |
1304 | 1304 | } |
1305 | 1305 | |
1306 | - return (strlen($fullPath) > strlen($defaultRoot)) && (substr($fullPath, 0, strlen($defaultRoot) + 1) === $defaultRoot . '/'); |
|
1306 | + return (strlen($fullPath) > strlen($defaultRoot)) && (substr($fullPath, 0, strlen($defaultRoot) + 1) === $defaultRoot.'/'); |
|
1307 | 1307 | } |
1308 | 1308 | |
1309 | 1309 | /** |
@@ -1322,7 +1322,7 @@ discard block |
||
1322 | 1322 | if ($hook != 'read') { |
1323 | 1323 | \OC_Hook::emit( |
1324 | 1324 | Filesystem::CLASSNAME, |
1325 | - $prefix . $hook, |
|
1325 | + $prefix.$hook, |
|
1326 | 1326 | [ |
1327 | 1327 | Filesystem::signal_param_run => &$run, |
1328 | 1328 | Filesystem::signal_param_path => $path |
@@ -1331,7 +1331,7 @@ discard block |
||
1331 | 1331 | } elseif (!$post) { |
1332 | 1332 | \OC_Hook::emit( |
1333 | 1333 | Filesystem::CLASSNAME, |
1334 | - $prefix . $hook, |
|
1334 | + $prefix.$hook, |
|
1335 | 1335 | [ |
1336 | 1336 | Filesystem::signal_param_path => $path |
1337 | 1337 | ] |
@@ -1415,7 +1415,7 @@ discard block |
||
1415 | 1415 | return false; |
1416 | 1416 | } |
1417 | 1417 | $relativePath = $path; |
1418 | - $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path); |
|
1418 | + $path = Filesystem::normalizePath($this->fakeRoot.'/'.$path); |
|
1419 | 1419 | |
1420 | 1420 | $mount = Filesystem::getMountManager()->find($path); |
1421 | 1421 | $storage = $mount->getStorage(); |
@@ -1456,7 +1456,7 @@ discard block |
||
1456 | 1456 | |
1457 | 1457 | return $info; |
1458 | 1458 | } else { |
1459 | - $this->logger->warning('Storage not valid for mountpoint: ' . $mount->getMountPoint(), ['app' => 'core']); |
|
1459 | + $this->logger->warning('Storage not valid for mountpoint: '.$mount->getMountPoint(), ['app' => 'core']); |
|
1460 | 1460 | } |
1461 | 1461 | |
1462 | 1462 | return false; |
@@ -1467,7 +1467,7 @@ discard block |
||
1467 | 1467 | */ |
1468 | 1468 | public function addSubMounts(FileInfo $info, $extOnly = false): void { |
1469 | 1469 | $mounts = Filesystem::getMountManager()->findIn($info->getPath()); |
1470 | - $info->setSubMounts(array_filter($mounts, function (IMountPoint $mount) use ($extOnly) { |
|
1470 | + $info->setSubMounts(array_filter($mounts, function(IMountPoint $mount) use ($extOnly) { |
|
1471 | 1471 | return !($extOnly && $mount instanceof SharedMount); |
1472 | 1472 | })); |
1473 | 1473 | } |
@@ -1515,13 +1515,13 @@ discard block |
||
1515 | 1515 | |
1516 | 1516 | $sharingDisabled = \OCP\Util::isSharingDisabledForUser(); |
1517 | 1517 | |
1518 | - $fileNames = array_map(function (ICacheEntry $content) { |
|
1518 | + $fileNames = array_map(function(ICacheEntry $content) { |
|
1519 | 1519 | return $content->getName(); |
1520 | 1520 | }, $contents); |
1521 | 1521 | /** |
1522 | 1522 | * @var \OC\Files\FileInfo[] $fileInfos |
1523 | 1523 | */ |
1524 | - $fileInfos = array_map(function (ICacheEntry $content) use ($path, $storage, $mount, $sharingDisabled) { |
|
1524 | + $fileInfos = array_map(function(ICacheEntry $content) use ($path, $storage, $mount, $sharingDisabled) { |
|
1525 | 1525 | if ($sharingDisabled) { |
1526 | 1526 | $content['permissions'] = $content['permissions'] & ~\OCP\Constants::PERMISSION_SHARE; |
1527 | 1527 | } |
@@ -1531,7 +1531,7 @@ discard block |
||
1531 | 1531 | } else { |
1532 | 1532 | $owner = null; |
1533 | 1533 | } |
1534 | - return new FileInfo($path . '/' . $content['name'], $storage, $content['path'], $content, $mount, $owner); |
|
1534 | + return new FileInfo($path.'/'.$content['name'], $storage, $content['path'], $content, $mount, $owner); |
|
1535 | 1535 | }, $contents); |
1536 | 1536 | $files = array_combine($fileNames, $fileInfos); |
1537 | 1537 | |
@@ -1540,7 +1540,7 @@ discard block |
||
1540 | 1540 | |
1541 | 1541 | // make sure nested mounts are sorted after their parent mounts |
1542 | 1542 | // otherwise doesn't propagate the etag across storage boundaries correctly |
1543 | - usort($mounts, function (IMountPoint $a, IMountPoint $b) { |
|
1543 | + usort($mounts, function(IMountPoint $a, IMountPoint $b) { |
|
1544 | 1544 | return $a->getMountPoint() <=> $b->getMountPoint(); |
1545 | 1545 | }); |
1546 | 1546 | |
@@ -1562,7 +1562,7 @@ discard block |
||
1562 | 1562 | continue; |
1563 | 1563 | } catch (\Exception $e) { |
1564 | 1564 | // sometimes when the storage is not available it can be any exception |
1565 | - $this->logger->error('Exception while scanning storage "' . $subStorage->getId() . '"', [ |
|
1565 | + $this->logger->error('Exception while scanning storage "'.$subStorage->getId().'"', [ |
|
1566 | 1566 | 'exception' => $e, |
1567 | 1567 | 'app' => 'core', |
1568 | 1568 | ]); |
@@ -1580,14 +1580,14 @@ discard block |
||
1580 | 1580 | // Create parent folders if the mountpoint is inside a subfolder that doesn't exist yet |
1581 | 1581 | if (!isset($files[$entryName])) { |
1582 | 1582 | try { |
1583 | - [$storage, ] = $this->resolvePath($path . '/' . $entryName); |
|
1583 | + [$storage, ] = $this->resolvePath($path.'/'.$entryName); |
|
1584 | 1584 | // make sure we can create the mountpoint folder, even if the user has a quota of 0 |
1585 | 1585 | if ($storage->instanceOfStorage(Quota::class)) { |
1586 | 1586 | $storage->enableQuota(false); |
1587 | 1587 | } |
1588 | 1588 | |
1589 | - if ($this->mkdir($path . '/' . $entryName) !== false) { |
|
1590 | - $info = $this->getFileInfo($path . '/' . $entryName); |
|
1589 | + if ($this->mkdir($path.'/'.$entryName) !== false) { |
|
1590 | + $info = $this->getFileInfo($path.'/'.$entryName); |
|
1591 | 1591 | if ($info !== false) { |
1592 | 1592 | $files[$entryName] = $info; |
1593 | 1593 | } |
@@ -1598,7 +1598,7 @@ discard block |
||
1598 | 1598 | } |
1599 | 1599 | } catch (\Exception $e) { |
1600 | 1600 | // Creating the parent folder might not be possible, for example due to a lack of permissions. |
1601 | - $this->logger->debug('Failed to create non-existent parent', ['exception' => $e, 'path' => $path . '/' . $entryName]); |
|
1601 | + $this->logger->debug('Failed to create non-existent parent', ['exception' => $e, 'path' => $path.'/'.$entryName]); |
|
1602 | 1602 | } |
1603 | 1603 | } |
1604 | 1604 | |
@@ -1617,7 +1617,7 @@ discard block |
||
1617 | 1617 | $rootEntry['permissions'] = $permissions & (\OCP\Constants::PERMISSION_ALL - (\OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE)); |
1618 | 1618 | } |
1619 | 1619 | |
1620 | - $rootEntry['path'] = substr(Filesystem::normalizePath($path . '/' . $rootEntry['name']), strlen($user) + 2); // full path without /$user/ |
|
1620 | + $rootEntry['path'] = substr(Filesystem::normalizePath($path.'/'.$rootEntry['name']), strlen($user) + 2); // full path without /$user/ |
|
1621 | 1621 | |
1622 | 1622 | // if sharing was disabled for the user we remove the share permissions |
1623 | 1623 | if ($sharingDisabled) { |
@@ -1630,14 +1630,14 @@ discard block |
||
1630 | 1630 | } else { |
1631 | 1631 | $owner = null; |
1632 | 1632 | } |
1633 | - $files[$rootEntry->getName()] = new FileInfo($path . '/' . $rootEntry['name'], $subStorage, '', $rootEntry, $mount, $owner); |
|
1633 | + $files[$rootEntry->getName()] = new FileInfo($path.'/'.$rootEntry['name'], $subStorage, '', $rootEntry, $mount, $owner); |
|
1634 | 1634 | } |
1635 | 1635 | } |
1636 | 1636 | } |
1637 | 1637 | } |
1638 | 1638 | |
1639 | 1639 | if ($mimetype_filter) { |
1640 | - $files = array_filter($files, function (FileInfo $file) use ($mimetype_filter) { |
|
1640 | + $files = array_filter($files, function(FileInfo $file) use ($mimetype_filter) { |
|
1641 | 1641 | if (strpos($mimetype_filter, '/')) { |
1642 | 1642 | return $file->getMimetype() === $mimetype_filter; |
1643 | 1643 | } else { |
@@ -1663,7 +1663,7 @@ discard block |
||
1663 | 1663 | if ($data instanceof FileInfo) { |
1664 | 1664 | $data = $data->getData(); |
1665 | 1665 | } |
1666 | - $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path); |
|
1666 | + $path = Filesystem::normalizePath($this->fakeRoot.'/'.$path); |
|
1667 | 1667 | /** |
1668 | 1668 | * @var Storage $storage |
1669 | 1669 | * @var string $internalPath |
@@ -1690,7 +1690,7 @@ discard block |
||
1690 | 1690 | * @return FileInfo[] |
1691 | 1691 | */ |
1692 | 1692 | public function search($query) { |
1693 | - return $this->searchCommon('search', ['%' . $query . '%']); |
|
1693 | + return $this->searchCommon('search', ['%'.$query.'%']); |
|
1694 | 1694 | } |
1695 | 1695 | |
1696 | 1696 | /** |
@@ -1742,10 +1742,10 @@ discard block |
||
1742 | 1742 | |
1743 | 1743 | $results = call_user_func_array([$cache, $method], $args); |
1744 | 1744 | foreach ($results as $result) { |
1745 | - if (substr($mountPoint . $result['path'], 0, $rootLength + 1) === $this->fakeRoot . '/') { |
|
1745 | + if (substr($mountPoint.$result['path'], 0, $rootLength + 1) === $this->fakeRoot.'/') { |
|
1746 | 1746 | $internalPath = $result['path']; |
1747 | - $path = $mountPoint . $result['path']; |
|
1748 | - $result['path'] = substr($mountPoint . $result['path'], $rootLength); |
|
1747 | + $path = $mountPoint.$result['path']; |
|
1748 | + $result['path'] = substr($mountPoint.$result['path'], $rootLength); |
|
1749 | 1749 | $ownerId = $storage->getOwner($internalPath); |
1750 | 1750 | if ($ownerId !== false) { |
1751 | 1751 | $owner = $userManager->get($ownerId); |
@@ -1768,8 +1768,8 @@ discard block |
||
1768 | 1768 | if ($results) { |
1769 | 1769 | foreach ($results as $result) { |
1770 | 1770 | $internalPath = $result['path']; |
1771 | - $result['path'] = rtrim($relativeMountPoint . $result['path'], '/'); |
|
1772 | - $path = rtrim($mountPoint . $internalPath, '/'); |
|
1771 | + $result['path'] = rtrim($relativeMountPoint.$result['path'], '/'); |
|
1772 | + $path = rtrim($mountPoint.$internalPath, '/'); |
|
1773 | 1773 | $ownerId = $storage->getOwner($internalPath); |
1774 | 1774 | if ($ownerId !== false) { |
1775 | 1775 | $owner = $userManager->get($ownerId); |
@@ -1793,11 +1793,11 @@ discard block |
||
1793 | 1793 | public function getOwner(string $path): string { |
1794 | 1794 | $info = $this->getFileInfo($path); |
1795 | 1795 | if (!$info) { |
1796 | - throw new NotFoundException($path . ' not found while trying to get owner'); |
|
1796 | + throw new NotFoundException($path.' not found while trying to get owner'); |
|
1797 | 1797 | } |
1798 | 1798 | |
1799 | 1799 | if ($info->getOwner() === null) { |
1800 | - throw new NotFoundException($path . ' has no owner'); |
|
1800 | + throw new NotFoundException($path.' has no owner'); |
|
1801 | 1801 | } |
1802 | 1802 | |
1803 | 1803 | return $info->getOwner()->getUID(); |
@@ -1829,7 +1829,7 @@ discard block |
||
1829 | 1829 | * @throws NotFoundException |
1830 | 1830 | */ |
1831 | 1831 | public function getPath($id, ?int $storageId = null): string { |
1832 | - $id = (int)$id; |
|
1832 | + $id = (int) $id; |
|
1833 | 1833 | $rootFolder = Server::get(Files\IRootFolder::class); |
1834 | 1834 | |
1835 | 1835 | $node = $rootFolder->getFirstNodeByIdInPath($id, $this->getRoot()); |
@@ -1881,13 +1881,13 @@ discard block |
||
1881 | 1881 | ]; |
1882 | 1882 | $shareManager = Server::get(IManager::class); |
1883 | 1883 | /** @var IShare[] $shares */ |
1884 | - $shares = array_merge(...array_map(function (int $type) use ($shareManager, $user) { |
|
1884 | + $shares = array_merge(...array_map(function(int $type) use ($shareManager, $user) { |
|
1885 | 1885 | return $shareManager->getSharesBy($user, $type); |
1886 | 1886 | }, $providers)); |
1887 | 1887 | |
1888 | 1888 | foreach ($shares as $share) { |
1889 | 1889 | $sharedPath = $share->getNode()->getPath(); |
1890 | - if ($targetPath === $sharedPath || str_starts_with($targetPath, $sharedPath . '/')) { |
|
1890 | + if ($targetPath === $sharedPath || str_starts_with($targetPath, $sharedPath.'/')) { |
|
1891 | 1891 | $this->logger->debug( |
1892 | 1892 | 'It is not allowed to move one mount point into a shared folder', |
1893 | 1893 | ['app' => 'files']); |
@@ -1995,7 +1995,7 @@ discard block |
||
1995 | 1995 | $resultPath = ''; |
1996 | 1996 | foreach ($parts as $part) { |
1997 | 1997 | if ($part) { |
1998 | - $resultPath .= '/' . $part; |
|
1998 | + $resultPath .= '/'.$part; |
|
1999 | 1999 | $result[] = $resultPath; |
2000 | 2000 | } |
2001 | 2001 | } |
@@ -2246,16 +2246,16 @@ discard block |
||
2246 | 2246 | public function getUidAndFilename($filename) { |
2247 | 2247 | $info = $this->getFileInfo($filename); |
2248 | 2248 | if (!$info instanceof \OCP\Files\FileInfo) { |
2249 | - throw new NotFoundException($this->getAbsolutePath($filename) . ' not found'); |
|
2249 | + throw new NotFoundException($this->getAbsolutePath($filename).' not found'); |
|
2250 | 2250 | } |
2251 | 2251 | $uid = $info->getOwner()->getUID(); |
2252 | 2252 | if ($uid != \OC_User::getUser()) { |
2253 | 2253 | Filesystem::initMountPoints($uid); |
2254 | - $ownerView = new View('/' . $uid . '/files'); |
|
2254 | + $ownerView = new View('/'.$uid.'/files'); |
|
2255 | 2255 | try { |
2256 | 2256 | $filename = $ownerView->getPath($info['fileid']); |
2257 | 2257 | } catch (NotFoundException $e) { |
2258 | - throw new NotFoundException('File with id ' . $info['fileid'] . ' not found for user ' . $uid); |
|
2258 | + throw new NotFoundException('File with id '.$info['fileid'].' not found for user '.$uid); |
|
2259 | 2259 | } |
2260 | 2260 | } |
2261 | 2261 | return [$uid, $filename]; |
@@ -2272,7 +2272,7 @@ discard block |
||
2272 | 2272 | $directoryParts = array_filter($directoryParts); |
2273 | 2273 | foreach ($directoryParts as $key => $part) { |
2274 | 2274 | $currentPathElements = array_slice($directoryParts, 0, $key); |
2275 | - $currentPath = '/' . implode('/', $currentPathElements); |
|
2275 | + $currentPath = '/'.implode('/', $currentPathElements); |
|
2276 | 2276 | if ($this->is_file($currentPath)) { |
2277 | 2277 | return false; |
2278 | 2278 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $output = $output ?? new NullOutput(); |
78 | 78 | $sourceUid = $sourceUser->getUID(); |
79 | 79 | $destinationUid = $destinationUser->getUID(); |
80 | - $sourcePath = rtrim($sourceUid . '/files/' . $path, '/'); |
|
80 | + $sourcePath = rtrim($sourceUid.'/files/'.$path, '/'); |
|
81 | 81 | |
82 | 82 | // If encryption is on we have to ensure the user has logged in before and that all encryption modules are ready |
83 | 83 | if (($this->encryptionManager->isEnabled() && $destinationUser->getLastLogin() === 0) |
@@ -105,11 +105,11 @@ discard block |
||
105 | 105 | $date = date('Y-m-d H-i-s'); |
106 | 106 | |
107 | 107 | $cleanUserName = $this->sanitizeFolderName($sourceUser->getDisplayName()) ?: $sourceUid; |
108 | - $finalTarget = "$destinationUid/files/" . $this->sanitizeFolderName($l->t('Transferred from %1$s on %2$s', [$cleanUserName, $date])); |
|
108 | + $finalTarget = "$destinationUid/files/".$this->sanitizeFolderName($l->t('Transferred from %1$s on %2$s', [$cleanUserName, $date])); |
|
109 | 109 | try { |
110 | 110 | $view->verifyPath(dirname($finalTarget), basename($finalTarget)); |
111 | 111 | } catch (InvalidPathException $e) { |
112 | - $finalTarget = "$destinationUid/files/" . $this->sanitizeFolderName($l->t('Transferred from %1$s on %2$s', [$sourceUid, $date])); |
|
112 | + $finalTarget = "$destinationUid/files/".$this->sanitizeFolderName($l->t('Transferred from %1$s on %2$s', [$sourceUid, $date])); |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $move |
180 | 180 | ); |
181 | 181 | |
182 | - $destinationPath = $finalTarget . '/' . $path; |
|
182 | + $destinationPath = $finalTarget.'/'.$path; |
|
183 | 183 | // restore the shares |
184 | 184 | $this->restoreShares( |
185 | 185 | $sourceUid, |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | throw new TransferOwnershipException("Unknown path provided: $sourcePath", 1); |
231 | 231 | } |
232 | 232 | $size = $sourceFileInfo->getSize(false); |
233 | - $freeSpace = $view->free_space($destinationUid . '/files/'); |
|
233 | + $freeSpace = $view->free_space($destinationUid.'/files/'); |
|
234 | 234 | if ($size > $freeSpace && $freeSpace !== FileInfo::SPACE_UNKNOWN) { |
235 | 235 | throw new TransferOwnershipException('Target user does not have enough free space available.', 1); |
236 | 236 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | $encryptedFiles[] = $sourceFileInfo; |
252 | 252 | } else { |
253 | 253 | $this->walkFiles($view, $sourcePath, |
254 | - function (FileInfo $fileInfo) use ($progress, $masterKeyEnabled, &$encryptedFiles, $includeExternalStorage) { |
|
254 | + function(FileInfo $fileInfo) use ($progress, $masterKeyEnabled, &$encryptedFiles, $includeExternalStorage) { |
|
255 | 255 | if ($fileInfo->getType() === FileInfo::TYPE_FOLDER) { |
256 | 256 | $mount = $fileInfo->getMountPoint(); |
257 | 257 | // only analyze into folders from main storage, |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $output->writeln('<error>Some files are encrypted - please decrypt them first.</error>'); |
289 | 289 | foreach ($encryptedFiles as $encryptedFile) { |
290 | 290 | /** @var FileInfo $encryptedFile */ |
291 | - $output->writeln(' ' . $encryptedFile->getPath()); |
|
291 | + $output->writeln(' '.$encryptedFile->getPath()); |
|
292 | 292 | } |
293 | 293 | throw new TransferOwnershipException('Some files are encrypted - please decrypt them first.', 1); |
294 | 294 | } |
@@ -331,12 +331,12 @@ discard block |
||
331 | 331 | break; |
332 | 332 | } |
333 | 333 | if ($path !== "$sourceUid/files") { |
334 | - $sharePage = array_filter($sharePage, function (IShare $share) use ($view, $normalizedPath) { |
|
334 | + $sharePage = array_filter($sharePage, function(IShare $share) use ($view, $normalizedPath) { |
|
335 | 335 | try { |
336 | 336 | $sourceNode = $share->getNode(); |
337 | 337 | $relativePath = $view->getRelativePath($sourceNode->getPath()); |
338 | 338 | |
339 | - return str_starts_with($relativePath . '/', $normalizedPath . '/'); |
|
339 | + return str_starts_with($relativePath.'/', $normalizedPath.'/'); |
|
340 | 340 | } catch (Exception $e) { |
341 | 341 | return false; |
342 | 342 | } |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | $progress->finish(); |
351 | 351 | $output->writeln(''); |
352 | 352 | |
353 | - return array_values(array_filter(array_map(function (IShare $share) use ($view, $normalizedPath, $output, $sourceUid) { |
|
353 | + return array_values(array_filter(array_map(function(IShare $share) use ($view, $normalizedPath, $output, $sourceUid) { |
|
354 | 354 | try { |
355 | 355 | $nodePath = $view->getRelativePath($share->getNode()->getPath()); |
356 | 356 | } catch (NotFoundException $e) { |
@@ -385,9 +385,9 @@ discard block |
||
385 | 385 | } |
386 | 386 | |
387 | 387 | if ($path !== null && $path !== "$sourceUid/files") { |
388 | - $sharePage = array_filter($sharePage, static function (IShare $share) use ($sourceUid, $normalizedPath) { |
|
388 | + $sharePage = array_filter($sharePage, static function(IShare $share) use ($sourceUid, $normalizedPath) { |
|
389 | 389 | try { |
390 | - return str_starts_with(Filesystem::normalizePath($sourceUid . '/files' . $share->getTarget() . '/', false), $normalizedPath . '/'); |
|
390 | + return str_starts_with(Filesystem::normalizePath($sourceUid.'/files'.$share->getTarget().'/', false), $normalizedPath.'/'); |
|
391 | 391 | } catch (Exception) { |
392 | 392 | return false; |
393 | 393 | } |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | // Else only the content inside folder is transferred which is not correct. |
425 | 425 | if ($sourcePath !== "$sourceUid/files") { |
426 | 426 | $view->mkdir($finalTarget); |
427 | - $finalTarget = $finalTarget . '/' . basename($sourcePath); |
|
427 | + $finalTarget = $finalTarget.'/'.basename($sourcePath); |
|
428 | 428 | } |
429 | 429 | $sourceInfo = $view->getFileInfo($sourcePath); |
430 | 430 | |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | foreach ($nestedMounts as $mount) { |
443 | 443 | if ($mount->getMountProvider() === ConfigAdapter::class) { |
444 | 444 | $relativePath = substr(trim($mount->getMountPoint(), '/'), strlen($sourcePath)); |
445 | - $this->moveMountContents($view, $mount->getMountPoint(), $finalTarget . $relativePath); |
|
445 | + $this->moveMountContents($view, $mount->getMountPoint(), $finalTarget.$relativePath); |
|
446 | 446 | } |
447 | 447 | } |
448 | 448 | } |
@@ -486,11 +486,11 @@ discard block |
||
486 | 486 | |
487 | 487 | foreach ($shares as ['share' => $share, 'suffix' => $suffix]) { |
488 | 488 | try { |
489 | - $output->writeln('Transfering share ' . $share->getId() . ' of type ' . $share->getShareType(), OutputInterface::VERBOSITY_VERBOSE); |
|
489 | + $output->writeln('Transfering share '.$share->getId().' of type '.$share->getShareType(), OutputInterface::VERBOSITY_VERBOSE); |
|
490 | 490 | if ($share->getShareType() === IShare::TYPE_USER |
491 | 491 | && $share->getSharedWith() === $destinationUid) { |
492 | 492 | // Unmount the shares before deleting, so we don't try to get the storage later on. |
493 | - $shareMountPoint = $this->mountManager->find('/' . $destinationUid . '/files' . $share->getTarget()); |
|
493 | + $shareMountPoint = $this->mountManager->find('/'.$destinationUid.'/files'.$share->getTarget()); |
|
494 | 494 | if ($shareMountPoint) { |
495 | 495 | $this->mountManager->removeMount($shareMountPoint->getMountPoint()); |
496 | 496 | } |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | if ($share->getShareType() === IShare::TYPE_USER |
507 | 507 | && !$this->userManager->userExists($share->getSharedWith())) { |
508 | 508 | // stray share with deleted user |
509 | - $output->writeln('<error>Share with id ' . $share->getId() . ' points at deleted user "' . $share->getSharedWith() . '", deleting</error>'); |
|
509 | + $output->writeln('<error>Share with id '.$share->getId().' points at deleted user "'.$share->getSharedWith().'", deleting</error>'); |
|
510 | 510 | $this->shareManager->deleteShare($share); |
511 | 511 | continue; |
512 | 512 | } else { |
@@ -522,9 +522,9 @@ discard block |
||
522 | 522 | } catch (NotFoundException) { |
523 | 523 | // ID has changed due to transfer between different storages |
524 | 524 | // Try to get the new ID from the target path and suffix of the share |
525 | - $node = $this->rootFolder->get(Filesystem::normalizePath($targetLocation . '/' . $suffix)); |
|
525 | + $node = $this->rootFolder->get(Filesystem::normalizePath($targetLocation.'/'.$suffix)); |
|
526 | 526 | $newNodeId = $node->getId(); |
527 | - $output->writeln('Had to change node id to ' . $newNodeId, OutputInterface::VERBOSITY_VERY_VERBOSE); |
|
527 | + $output->writeln('Had to change node id to '.$newNodeId, OutputInterface::VERBOSITY_VERY_VERBOSE); |
|
528 | 528 | } |
529 | 529 | $share->setNodeId($newNodeId); |
530 | 530 | |
@@ -532,9 +532,9 @@ discard block |
||
532 | 532 | } |
533 | 533 | } |
534 | 534 | } catch (NotFoundException $e) { |
535 | - $output->writeln('<error>Share with id ' . $share->getId() . ' points at deleted file, skipping</error>'); |
|
535 | + $output->writeln('<error>Share with id '.$share->getId().' points at deleted file, skipping</error>'); |
|
536 | 536 | } catch (\Throwable $e) { |
537 | - $output->writeln('<error>Could not restore share with id ' . $share->getId() . ':' . $e->getMessage() . ' : ' . $e->getTraceAsString() . '</error>'); |
|
537 | + $output->writeln('<error>Could not restore share with id '.$share->getId().':'.$e->getMessage().' : '.$e->getTraceAsString().'</error>'); |
|
538 | 538 | } |
539 | 539 | $progress->advance(); |
540 | 540 | } |
@@ -562,13 +562,13 @@ discard block |
||
562 | 562 | // Only restore if share is in given path. |
563 | 563 | $pathToCheck = '/'; |
564 | 564 | if (trim($path, '/') !== '') { |
565 | - $pathToCheck = '/' . trim($path) . '/'; |
|
565 | + $pathToCheck = '/'.trim($path).'/'; |
|
566 | 566 | } |
567 | 567 | if (!str_starts_with($share->getTarget(), $pathToCheck)) { |
568 | 568 | continue; |
569 | 569 | } |
570 | 570 | $shareTarget = $share->getTarget(); |
571 | - $shareTarget = $finalShareTarget . $shareTarget; |
|
571 | + $shareTarget = $finalShareTarget.$shareTarget; |
|
572 | 572 | if ($share->getShareType() === IShare::TYPE_USER |
573 | 573 | && $share->getSharedBy() === $destinationUid) { |
574 | 574 | $this->shareManager->deleteShare($share); |
@@ -612,9 +612,9 @@ discard block |
||
612 | 612 | continue; |
613 | 613 | } |
614 | 614 | } catch (NotFoundException $e) { |
615 | - $output->writeln('<error>Share with id ' . $share->getId() . ' points at deleted file, skipping</error>'); |
|
615 | + $output->writeln('<error>Share with id '.$share->getId().' points at deleted file, skipping</error>'); |
|
616 | 616 | } catch (\Throwable $e) { |
617 | - $output->writeln('<error>Could not restore share with id ' . $share->getId() . ':' . $e->getTraceAsString() . '</error>'); |
|
617 | + $output->writeln('<error>Could not restore share with id '.$share->getId().':'.$e->getTraceAsString().'</error>'); |
|
618 | 618 | } |
619 | 619 | $progress->advance(); |
620 | 620 | } |