@@ -128,9 +128,9 @@ discard block |
||
| 128 | 128 | $path = '/'; |
| 129 | 129 | } |
| 130 | 130 | if ($path[0] !== '/') { |
| 131 | - $path = '/' . $path; |
|
| 131 | + $path = '/'.$path; |
|
| 132 | 132 | } |
| 133 | - return $this->fakeRoot . $path; |
|
| 133 | + return $this->fakeRoot.$path; |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | public function chroot($fakeRoot) { |
| 143 | 143 | if (!$fakeRoot == '') { |
| 144 | 144 | if ($fakeRoot[0] !== '/') { |
| 145 | - $fakeRoot = '/' . $fakeRoot; |
|
| 145 | + $fakeRoot = '/'.$fakeRoot; |
|
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | $this->fakeRoot = $fakeRoot; |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | // missing slashes can cause wrong matches! |
| 177 | - $root = rtrim($this->fakeRoot, '/') . '/'; |
|
| 177 | + $root = rtrim($this->fakeRoot, '/').'/'; |
|
| 178 | 178 | |
| 179 | 179 | if (strpos($path, $root) !== 0) { |
| 180 | 180 | return null; |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | if ($mount instanceof MoveableMount) { |
| 281 | 281 | // cut of /user/files to get the relative path to data/user/files |
| 282 | 282 | $pathParts = explode('/', $path, 4); |
| 283 | - $relPath = '/' . $pathParts[3]; |
|
| 283 | + $relPath = '/'.$pathParts[3]; |
|
| 284 | 284 | $this->lockFile($relPath, ILockingProvider::LOCK_SHARED, true); |
| 285 | 285 | \OC_Hook::emit( |
| 286 | 286 | Filesystem::CLASSNAME, "umount", |
@@ -700,7 +700,7 @@ discard block |
||
| 700 | 700 | } |
| 701 | 701 | $postFix = (substr($path, -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 | } |
@@ -821,7 +821,7 @@ discard block |
||
| 821 | 821 | $this->renameUpdate($storage1, $storage2, $internalPath1, $internalPath2); |
| 822 | 822 | } |
| 823 | 823 | } |
| 824 | - } catch(\Exception $e) { |
|
| 824 | + } catch (\Exception $e) { |
|
| 825 | 825 | throw $e; |
| 826 | 826 | } finally { |
| 827 | 827 | $this->changeLock($path1, ILockingProvider::LOCK_SHARED, true); |
@@ -845,7 +845,7 @@ discard block |
||
| 845 | 845 | } |
| 846 | 846 | } |
| 847 | 847 | } |
| 848 | - } catch(\Exception $e) { |
|
| 848 | + } catch (\Exception $e) { |
|
| 849 | 849 | throw $e; |
| 850 | 850 | } finally { |
| 851 | 851 | $this->unlockFile($path1, ILockingProvider::LOCK_SHARED, true); |
@@ -978,7 +978,7 @@ discard block |
||
| 978 | 978 | $hooks[] = 'write'; |
| 979 | 979 | break; |
| 980 | 980 | default: |
| 981 | - \OCP\Util::writeLog('core', 'invalid mode (' . $mode . ') for ' . $path, ILogger::ERROR); |
|
| 981 | + \OCP\Util::writeLog('core', 'invalid mode ('.$mode.') for '.$path, ILogger::ERROR); |
|
| 982 | 982 | } |
| 983 | 983 | |
| 984 | 984 | if ($mode !== 'r' && $mode !== 'w') { |
@@ -1082,7 +1082,7 @@ discard block |
||
| 1082 | 1082 | array(Filesystem::signal_param_path => $this->getHookPath($path)) |
| 1083 | 1083 | ); |
| 1084 | 1084 | } |
| 1085 | - list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix); |
|
| 1085 | + list($storage, $internalPath) = Filesystem::resolvePath($absolutePath.$postFix); |
|
| 1086 | 1086 | if ($storage) { |
| 1087 | 1087 | return $storage->hash($type, $internalPath, $raw); |
| 1088 | 1088 | } |
@@ -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 | try { |
@@ -1165,7 +1165,7 @@ discard block |
||
| 1165 | 1165 | if ($result && in_array('delete', $hooks) and $result) { |
| 1166 | 1166 | $this->removeUpdate($storage, $internalPath); |
| 1167 | 1167 | } |
| 1168 | - if ($result && in_array('write', $hooks, true) && $operation !== 'fopen' && $operation !== 'touch') { |
|
| 1168 | + if ($result && in_array('write', $hooks, true) && $operation !== 'fopen' && $operation !== 'touch') { |
|
| 1169 | 1169 | $this->writeUpdate($storage, $internalPath); |
| 1170 | 1170 | } |
| 1171 | 1171 | if ($result && in_array('touch', $hooks)) { |
@@ -1181,7 +1181,7 @@ discard block |
||
| 1181 | 1181 | $unlockLater = true; |
| 1182 | 1182 | // make sure our unlocking callback will still be called if connection is aborted |
| 1183 | 1183 | ignore_user_abort(true); |
| 1184 | - $result = CallbackWrapper::wrap($result, null, null, function () use ($hooks, $path) { |
|
| 1184 | + $result = CallbackWrapper::wrap($result, null, null, function() use ($hooks, $path) { |
|
| 1185 | 1185 | if (in_array('write', $hooks)) { |
| 1186 | 1186 | $this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE); |
| 1187 | 1187 | } else if (in_array('read', $hooks)) { |
@@ -1242,7 +1242,7 @@ discard block |
||
| 1242 | 1242 | return true; |
| 1243 | 1243 | } |
| 1244 | 1244 | |
| 1245 | - return (strlen($fullPath) > strlen($defaultRoot)) && (substr($fullPath, 0, strlen($defaultRoot) + 1) === $defaultRoot . '/'); |
|
| 1245 | + return (strlen($fullPath) > strlen($defaultRoot)) && (substr($fullPath, 0, strlen($defaultRoot) + 1) === $defaultRoot.'/'); |
|
| 1246 | 1246 | } |
| 1247 | 1247 | |
| 1248 | 1248 | /** |
@@ -1261,7 +1261,7 @@ discard block |
||
| 1261 | 1261 | if ($hook != 'read') { |
| 1262 | 1262 | \OC_Hook::emit( |
| 1263 | 1263 | Filesystem::CLASSNAME, |
| 1264 | - $prefix . $hook, |
|
| 1264 | + $prefix.$hook, |
|
| 1265 | 1265 | array( |
| 1266 | 1266 | Filesystem::signal_param_run => &$run, |
| 1267 | 1267 | Filesystem::signal_param_path => $path |
@@ -1270,7 +1270,7 @@ discard block |
||
| 1270 | 1270 | } elseif (!$post) { |
| 1271 | 1271 | \OC_Hook::emit( |
| 1272 | 1272 | Filesystem::CLASSNAME, |
| 1273 | - $prefix . $hook, |
|
| 1273 | + $prefix.$hook, |
|
| 1274 | 1274 | array( |
| 1275 | 1275 | Filesystem::signal_param_path => $path |
| 1276 | 1276 | ) |
@@ -1363,11 +1363,11 @@ discard block |
||
| 1363 | 1363 | return $this->getPartFileInfo($path); |
| 1364 | 1364 | } |
| 1365 | 1365 | $relativePath = $path; |
| 1366 | - $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path); |
|
| 1366 | + $path = Filesystem::normalizePath($this->fakeRoot.'/'.$path); |
|
| 1367 | 1367 | |
| 1368 | 1368 | $mount = Filesystem::getMountManager()->find($path); |
| 1369 | 1369 | if (!$mount) { |
| 1370 | - \OC::$server->getLogger()->warning('Mountpoint not found for path: ' . $path); |
|
| 1370 | + \OC::$server->getLogger()->warning('Mountpoint not found for path: '.$path); |
|
| 1371 | 1371 | return false; |
| 1372 | 1372 | } |
| 1373 | 1373 | $storage = $mount->getStorage(); |
@@ -1395,7 +1395,7 @@ discard block |
||
| 1395 | 1395 | //add the sizes of other mount points to the folder |
| 1396 | 1396 | $extOnly = ($includeMountPoints === 'ext'); |
| 1397 | 1397 | $mounts = Filesystem::getMountManager()->findIn($path); |
| 1398 | - $info->setSubMounts(array_filter($mounts, function (IMountPoint $mount) use ($extOnly) { |
|
| 1398 | + $info->setSubMounts(array_filter($mounts, function(IMountPoint $mount) use ($extOnly) { |
|
| 1399 | 1399 | $subStorage = $mount->getStorage(); |
| 1400 | 1400 | return !($extOnly && $subStorage instanceof \OCA\Files_Sharing\SharedStorage); |
| 1401 | 1401 | })); |
@@ -1404,7 +1404,7 @@ discard block |
||
| 1404 | 1404 | |
| 1405 | 1405 | return $info; |
| 1406 | 1406 | } else { |
| 1407 | - \OC::$server->getLogger()->warning('Storage not valid for mountpoint: ' . $mount->getMountPoint()); |
|
| 1407 | + \OC::$server->getLogger()->warning('Storage not valid for mountpoint: '.$mount->getMountPoint()); |
|
| 1408 | 1408 | } |
| 1409 | 1409 | |
| 1410 | 1410 | return false; |
@@ -1451,12 +1451,12 @@ discard block |
||
| 1451 | 1451 | /** |
| 1452 | 1452 | * @var \OC\Files\FileInfo[] $fileInfos |
| 1453 | 1453 | */ |
| 1454 | - $fileInfos = array_map(function (ICacheEntry $content) use ($path, $storage, $mount, $sharingDisabled) { |
|
| 1454 | + $fileInfos = array_map(function(ICacheEntry $content) use ($path, $storage, $mount, $sharingDisabled) { |
|
| 1455 | 1455 | if ($sharingDisabled) { |
| 1456 | 1456 | $content['permissions'] = $content['permissions'] & ~\OCP\Constants::PERMISSION_SHARE; |
| 1457 | 1457 | } |
| 1458 | 1458 | $owner = $this->getUserObjectForOwner($storage->getOwner($content['path'])); |
| 1459 | - return new FileInfo($path . '/' . $content['name'], $storage, $content['path'], $content, $mount, $owner); |
|
| 1459 | + return new FileInfo($path.'/'.$content['name'], $storage, $content['path'], $content, $mount, $owner); |
|
| 1460 | 1460 | }, $contents); |
| 1461 | 1461 | $files = array_combine($fileNames, $fileInfos); |
| 1462 | 1462 | |
@@ -1481,7 +1481,7 @@ discard block |
||
| 1481 | 1481 | } catch (\Exception $e) { |
| 1482 | 1482 | // sometimes when the storage is not available it can be any exception |
| 1483 | 1483 | \OC::$server->getLogger()->logException($e, [ |
| 1484 | - 'message' => 'Exception while scanning storage "' . $subStorage->getId() . '"', |
|
| 1484 | + 'message' => 'Exception while scanning storage "'.$subStorage->getId().'"', |
|
| 1485 | 1485 | 'level' => ILogger::ERROR, |
| 1486 | 1486 | 'app' => 'lib', |
| 1487 | 1487 | ]); |
@@ -1512,7 +1512,7 @@ discard block |
||
| 1512 | 1512 | $rootEntry['permissions'] = $permissions & (\OCP\Constants::PERMISSION_ALL - (\OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE)); |
| 1513 | 1513 | } |
| 1514 | 1514 | |
| 1515 | - $rootEntry['path'] = substr(Filesystem::normalizePath($path . '/' . $rootEntry['name']), strlen($user) + 2); // full path without /$user/ |
|
| 1515 | + $rootEntry['path'] = substr(Filesystem::normalizePath($path.'/'.$rootEntry['name']), strlen($user) + 2); // full path without /$user/ |
|
| 1516 | 1516 | |
| 1517 | 1517 | // if sharing was disabled for the user we remove the share permissions |
| 1518 | 1518 | if (\OCP\Util::isSharingDisabledForUser()) { |
@@ -1520,14 +1520,14 @@ discard block |
||
| 1520 | 1520 | } |
| 1521 | 1521 | |
| 1522 | 1522 | $owner = $this->getUserObjectForOwner($subStorage->getOwner('')); |
| 1523 | - $files[$rootEntry->getName()] = new FileInfo($path . '/' . $rootEntry['name'], $subStorage, '', $rootEntry, $mount, $owner); |
|
| 1523 | + $files[$rootEntry->getName()] = new FileInfo($path.'/'.$rootEntry['name'], $subStorage, '', $rootEntry, $mount, $owner); |
|
| 1524 | 1524 | } |
| 1525 | 1525 | } |
| 1526 | 1526 | } |
| 1527 | 1527 | } |
| 1528 | 1528 | |
| 1529 | 1529 | if ($mimetype_filter) { |
| 1530 | - $files = array_filter($files, function (FileInfo $file) use ($mimetype_filter) { |
|
| 1530 | + $files = array_filter($files, function(FileInfo $file) use ($mimetype_filter) { |
|
| 1531 | 1531 | if (strpos($mimetype_filter, '/')) { |
| 1532 | 1532 | return $file->getMimetype() === $mimetype_filter; |
| 1533 | 1533 | } else { |
@@ -1556,7 +1556,7 @@ discard block |
||
| 1556 | 1556 | if ($data instanceof FileInfo) { |
| 1557 | 1557 | $data = $data->getData(); |
| 1558 | 1558 | } |
| 1559 | - $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path); |
|
| 1559 | + $path = Filesystem::normalizePath($this->fakeRoot.'/'.$path); |
|
| 1560 | 1560 | /** |
| 1561 | 1561 | * @var \OC\Files\Storage\Storage $storage |
| 1562 | 1562 | * @var string $internalPath |
@@ -1583,7 +1583,7 @@ discard block |
||
| 1583 | 1583 | * @return FileInfo[] |
| 1584 | 1584 | */ |
| 1585 | 1585 | public function search($query) { |
| 1586 | - return $this->searchCommon('search', array('%' . $query . '%')); |
|
| 1586 | + return $this->searchCommon('search', array('%'.$query.'%')); |
|
| 1587 | 1587 | } |
| 1588 | 1588 | |
| 1589 | 1589 | /** |
@@ -1634,10 +1634,10 @@ discard block |
||
| 1634 | 1634 | |
| 1635 | 1635 | $results = call_user_func_array(array($cache, $method), $args); |
| 1636 | 1636 | foreach ($results as $result) { |
| 1637 | - if (substr($mountPoint . $result['path'], 0, $rootLength + 1) === $this->fakeRoot . '/') { |
|
| 1637 | + if (substr($mountPoint.$result['path'], 0, $rootLength + 1) === $this->fakeRoot.'/') { |
|
| 1638 | 1638 | $internalPath = $result['path']; |
| 1639 | - $path = $mountPoint . $result['path']; |
|
| 1640 | - $result['path'] = substr($mountPoint . $result['path'], $rootLength); |
|
| 1639 | + $path = $mountPoint.$result['path']; |
|
| 1640 | + $result['path'] = substr($mountPoint.$result['path'], $rootLength); |
|
| 1641 | 1641 | $owner = \OC::$server->getUserManager()->get($storage->getOwner($internalPath)); |
| 1642 | 1642 | $files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner); |
| 1643 | 1643 | } |
@@ -1655,8 +1655,8 @@ discard block |
||
| 1655 | 1655 | if ($results) { |
| 1656 | 1656 | foreach ($results as $result) { |
| 1657 | 1657 | $internalPath = $result['path']; |
| 1658 | - $result['path'] = rtrim($relativeMountPoint . $result['path'], '/'); |
|
| 1659 | - $path = rtrim($mountPoint . $internalPath, '/'); |
|
| 1658 | + $result['path'] = rtrim($relativeMountPoint.$result['path'], '/'); |
|
| 1659 | + $path = rtrim($mountPoint.$internalPath, '/'); |
|
| 1660 | 1660 | $owner = \OC::$server->getUserManager()->get($storage->getOwner($internalPath)); |
| 1661 | 1661 | $files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner); |
| 1662 | 1662 | } |
@@ -1677,7 +1677,7 @@ discard block |
||
| 1677 | 1677 | public function getOwner($path) { |
| 1678 | 1678 | $info = $this->getFileInfo($path); |
| 1679 | 1679 | if (!$info) { |
| 1680 | - throw new NotFoundException($path . ' not found while trying to get owner'); |
|
| 1680 | + throw new NotFoundException($path.' not found while trying to get owner'); |
|
| 1681 | 1681 | } |
| 1682 | 1682 | return $info->getOwner()->getUID(); |
| 1683 | 1683 | } |
@@ -1711,7 +1711,7 @@ discard block |
||
| 1711 | 1711 | * @return string |
| 1712 | 1712 | */ |
| 1713 | 1713 | public function getPath($id) { |
| 1714 | - $id = (int)$id; |
|
| 1714 | + $id = (int) $id; |
|
| 1715 | 1715 | $manager = Filesystem::getMountManager(); |
| 1716 | 1716 | $mounts = $manager->findIn($this->fakeRoot); |
| 1717 | 1717 | $mounts[] = $manager->find($this->fakeRoot); |
@@ -1726,7 +1726,7 @@ discard block |
||
| 1726 | 1726 | $cache = $mount->getStorage()->getCache(); |
| 1727 | 1727 | $internalPath = $cache->getPathById($id); |
| 1728 | 1728 | if (is_string($internalPath)) { |
| 1729 | - $fullPath = $mount->getMountPoint() . $internalPath; |
|
| 1729 | + $fullPath = $mount->getMountPoint().$internalPath; |
|
| 1730 | 1730 | if (!is_null($path = $this->getRelativePath($fullPath))) { |
| 1731 | 1731 | return $path; |
| 1732 | 1732 | } |
@@ -1762,10 +1762,10 @@ discard block |
||
| 1762 | 1762 | private function targetIsNotShared(IStorage $targetStorage, string $targetInternalPath) { |
| 1763 | 1763 | |
| 1764 | 1764 | // note: cannot use the view because the target is already locked |
| 1765 | - $fileId = (int)$targetStorage->getCache()->getId($targetInternalPath); |
|
| 1765 | + $fileId = (int) $targetStorage->getCache()->getId($targetInternalPath); |
|
| 1766 | 1766 | if ($fileId === -1) { |
| 1767 | 1767 | // target might not exist, need to check parent instead |
| 1768 | - $fileId = (int)$targetStorage->getCache()->getId(dirname($targetInternalPath)); |
|
| 1768 | + $fileId = (int) $targetStorage->getCache()->getId(dirname($targetInternalPath)); |
|
| 1769 | 1769 | } |
| 1770 | 1770 | |
| 1771 | 1771 | // check if any of the parents were shared by the current owner (include collections) |
@@ -1865,7 +1865,7 @@ discard block |
||
| 1865 | 1865 | $resultPath = ''; |
| 1866 | 1866 | foreach ($parts as $part) { |
| 1867 | 1867 | if ($part) { |
| 1868 | - $resultPath .= '/' . $part; |
|
| 1868 | + $resultPath .= '/'.$part; |
|
| 1869 | 1869 | $result[] = $resultPath; |
| 1870 | 1870 | } |
| 1871 | 1871 | } |
@@ -2128,16 +2128,16 @@ discard block |
||
| 2128 | 2128 | public function getUidAndFilename($filename) { |
| 2129 | 2129 | $info = $this->getFileInfo($filename); |
| 2130 | 2130 | if (!$info instanceof \OCP\Files\FileInfo) { |
| 2131 | - throw new NotFoundException($this->getAbsolutePath($filename) . ' not found'); |
|
| 2131 | + throw new NotFoundException($this->getAbsolutePath($filename).' not found'); |
|
| 2132 | 2132 | } |
| 2133 | 2133 | $uid = $info->getOwner()->getUID(); |
| 2134 | 2134 | if ($uid != \OCP\User::getUser()) { |
| 2135 | 2135 | Filesystem::initMountPoints($uid); |
| 2136 | - $ownerView = new View('/' . $uid . '/files'); |
|
| 2136 | + $ownerView = new View('/'.$uid.'/files'); |
|
| 2137 | 2137 | try { |
| 2138 | 2138 | $filename = $ownerView->getPath($info['fileid']); |
| 2139 | 2139 | } catch (NotFoundException $e) { |
| 2140 | - throw new NotFoundException('File with id ' . $info['fileid'] . ' not found for user ' . $uid); |
|
| 2140 | + throw new NotFoundException('File with id '.$info['fileid'].' not found for user '.$uid); |
|
| 2141 | 2141 | } |
| 2142 | 2142 | } |
| 2143 | 2143 | return [$uid, $filename]; |
@@ -2154,7 +2154,7 @@ discard block |
||
| 2154 | 2154 | $directoryParts = array_filter($directoryParts); |
| 2155 | 2155 | foreach ($directoryParts as $key => $part) { |
| 2156 | 2156 | $currentPathElements = array_slice($directoryParts, 0, $key); |
| 2157 | - $currentPath = '/' . implode('/', $currentPathElements); |
|
| 2157 | + $currentPath = '/'.implode('/', $currentPathElements); |
|
| 2158 | 2158 | if ($this->is_file($currentPath)) { |
| 2159 | 2159 | return false; |
| 2160 | 2160 | } |