@@ -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", |
@@ -682,7 +682,7 @@ discard block |
||
| 682 | 682 | } |
| 683 | 683 | $postFix = (substr($path, -1, 1) === '/') ? '/' : ''; |
| 684 | 684 | $absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path)); |
| 685 | - $mount = Filesystem::getMountManager()->find($absolutePath . $postFix); |
|
| 685 | + $mount = Filesystem::getMountManager()->find($absolutePath.$postFix); |
|
| 686 | 686 | if ($mount and $mount->getInternalPath($absolutePath) === '') { |
| 687 | 687 | return $this->removeMount($mount, $absolutePath); |
| 688 | 688 | } |
@@ -802,7 +802,7 @@ discard block |
||
| 802 | 802 | $this->renameUpdate($storage1, $storage2, $internalPath1, $internalPath2); |
| 803 | 803 | } |
| 804 | 804 | } |
| 805 | - } catch(\Exception $e) { |
|
| 805 | + } catch (\Exception $e) { |
|
| 806 | 806 | throw $e; |
| 807 | 807 | } finally { |
| 808 | 808 | $this->changeLock($path1, ILockingProvider::LOCK_SHARED, true); |
@@ -826,7 +826,7 @@ discard block |
||
| 826 | 826 | } |
| 827 | 827 | } |
| 828 | 828 | } |
| 829 | - } catch(\Exception $e) { |
|
| 829 | + } catch (\Exception $e) { |
|
| 830 | 830 | throw $e; |
| 831 | 831 | } finally { |
| 832 | 832 | $this->unlockFile($path1, ILockingProvider::LOCK_SHARED, true); |
@@ -959,7 +959,7 @@ discard block |
||
| 959 | 959 | $hooks[] = 'write'; |
| 960 | 960 | break; |
| 961 | 961 | default: |
| 962 | - \OCP\Util::writeLog('core', 'invalid mode (' . $mode . ') for ' . $path, \OCP\Util::ERROR); |
|
| 962 | + \OCP\Util::writeLog('core', 'invalid mode ('.$mode.') for '.$path, \OCP\Util::ERROR); |
|
| 963 | 963 | } |
| 964 | 964 | |
| 965 | 965 | if ($mode !== 'r' && $mode !== 'w') { |
@@ -1063,7 +1063,7 @@ discard block |
||
| 1063 | 1063 | array(Filesystem::signal_param_path => $this->getHookPath($path)) |
| 1064 | 1064 | ); |
| 1065 | 1065 | } |
| 1066 | - list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix); |
|
| 1066 | + list($storage, $internalPath) = Filesystem::resolvePath($absolutePath.$postFix); |
|
| 1067 | 1067 | if ($storage) { |
| 1068 | 1068 | $result = $storage->hash($type, $internalPath, $raw); |
| 1069 | 1069 | return $result; |
@@ -1118,7 +1118,7 @@ discard block |
||
| 1118 | 1118 | |
| 1119 | 1119 | $run = $this->runHooks($hooks, $path); |
| 1120 | 1120 | /** @var \OC\Files\Storage\Storage $storage */ |
| 1121 | - list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix); |
|
| 1121 | + list($storage, $internalPath) = Filesystem::resolvePath($absolutePath.$postFix); |
|
| 1122 | 1122 | if ($run and $storage) { |
| 1123 | 1123 | if (in_array('write', $hooks) || in_array('delete', $hooks)) { |
| 1124 | 1124 | $this->changeLock($path, ILockingProvider::LOCK_EXCLUSIVE); |
@@ -1157,7 +1157,7 @@ discard block |
||
| 1157 | 1157 | $unlockLater = true; |
| 1158 | 1158 | // make sure our unlocking callback will still be called if connection is aborted |
| 1159 | 1159 | ignore_user_abort(true); |
| 1160 | - $result = CallbackWrapper::wrap($result, null, null, function () use ($hooks, $path) { |
|
| 1160 | + $result = CallbackWrapper::wrap($result, null, null, function() use ($hooks, $path) { |
|
| 1161 | 1161 | if (in_array('write', $hooks)) { |
| 1162 | 1162 | $this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE); |
| 1163 | 1163 | } else if (in_array('read', $hooks)) { |
@@ -1218,7 +1218,7 @@ discard block |
||
| 1218 | 1218 | return true; |
| 1219 | 1219 | } |
| 1220 | 1220 | |
| 1221 | - return (strlen($fullPath) > strlen($defaultRoot)) && (substr($fullPath, 0, strlen($defaultRoot) + 1) === $defaultRoot . '/'); |
|
| 1221 | + return (strlen($fullPath) > strlen($defaultRoot)) && (substr($fullPath, 0, strlen($defaultRoot) + 1) === $defaultRoot.'/'); |
|
| 1222 | 1222 | } |
| 1223 | 1223 | |
| 1224 | 1224 | /** |
@@ -1237,7 +1237,7 @@ discard block |
||
| 1237 | 1237 | if ($hook != 'read') { |
| 1238 | 1238 | \OC_Hook::emit( |
| 1239 | 1239 | Filesystem::CLASSNAME, |
| 1240 | - $prefix . $hook, |
|
| 1240 | + $prefix.$hook, |
|
| 1241 | 1241 | array( |
| 1242 | 1242 | Filesystem::signal_param_run => &$run, |
| 1243 | 1243 | Filesystem::signal_param_path => $path |
@@ -1246,7 +1246,7 @@ discard block |
||
| 1246 | 1246 | } elseif (!$post) { |
| 1247 | 1247 | \OC_Hook::emit( |
| 1248 | 1248 | Filesystem::CLASSNAME, |
| 1249 | - $prefix . $hook, |
|
| 1249 | + $prefix.$hook, |
|
| 1250 | 1250 | array( |
| 1251 | 1251 | Filesystem::signal_param_path => $path |
| 1252 | 1252 | ) |
@@ -1341,7 +1341,7 @@ discard block |
||
| 1341 | 1341 | return $this->getPartFileInfo($path); |
| 1342 | 1342 | } |
| 1343 | 1343 | $relativePath = $path; |
| 1344 | - $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path); |
|
| 1344 | + $path = Filesystem::normalizePath($this->fakeRoot.'/'.$path); |
|
| 1345 | 1345 | |
| 1346 | 1346 | $mount = Filesystem::getMountManager()->find($path); |
| 1347 | 1347 | $storage = $mount->getStorage(); |
@@ -1365,7 +1365,7 @@ discard block |
||
| 1365 | 1365 | //add the sizes of other mount points to the folder |
| 1366 | 1366 | $extOnly = ($includeMountPoints === 'ext'); |
| 1367 | 1367 | $mounts = Filesystem::getMountManager()->findIn($path); |
| 1368 | - $info->setSubMounts(array_filter($mounts, function (IMountPoint $mount) use ($extOnly) { |
|
| 1368 | + $info->setSubMounts(array_filter($mounts, function(IMountPoint $mount) use ($extOnly) { |
|
| 1369 | 1369 | $subStorage = $mount->getStorage(); |
| 1370 | 1370 | return !($extOnly && $subStorage instanceof \OCA\Files_Sharing\SharedStorage); |
| 1371 | 1371 | })); |
@@ -1412,12 +1412,12 @@ discard block |
||
| 1412 | 1412 | /** |
| 1413 | 1413 | * @var \OC\Files\FileInfo[] $files |
| 1414 | 1414 | */ |
| 1415 | - $files = array_map(function (ICacheEntry $content) use ($path, $storage, $mount, $sharingDisabled) { |
|
| 1415 | + $files = array_map(function(ICacheEntry $content) use ($path, $storage, $mount, $sharingDisabled) { |
|
| 1416 | 1416 | if ($sharingDisabled) { |
| 1417 | 1417 | $content['permissions'] = $content['permissions'] & ~\OCP\Constants::PERMISSION_SHARE; |
| 1418 | 1418 | } |
| 1419 | 1419 | $owner = $this->getUserObjectForOwner($storage->getOwner($content['path'])); |
| 1420 | - return new FileInfo($path . '/' . $content['name'], $storage, $content['path'], $content, $mount, $owner); |
|
| 1420 | + return new FileInfo($path.'/'.$content['name'], $storage, $content['path'], $content, $mount, $owner); |
|
| 1421 | 1421 | }, $contents); |
| 1422 | 1422 | |
| 1423 | 1423 | //add a folder for any mountpoint in this directory and add the sizes of other mountpoints to the folders |
@@ -1442,8 +1442,8 @@ discard block |
||
| 1442 | 1442 | // sometimes when the storage is not available it can be any exception |
| 1443 | 1443 | \OCP\Util::writeLog( |
| 1444 | 1444 | 'core', |
| 1445 | - 'Exception while scanning storage "' . $subStorage->getId() . '": ' . |
|
| 1446 | - get_class($e) . ': ' . $e->getMessage(), |
|
| 1445 | + 'Exception while scanning storage "'.$subStorage->getId().'": '. |
|
| 1446 | + get_class($e).': '.$e->getMessage(), |
|
| 1447 | 1447 | \OCP\Util::ERROR |
| 1448 | 1448 | ); |
| 1449 | 1449 | continue; |
@@ -1480,7 +1480,7 @@ discard block |
||
| 1480 | 1480 | break; |
| 1481 | 1481 | } |
| 1482 | 1482 | } |
| 1483 | - $rootEntry['path'] = substr(Filesystem::normalizePath($path . '/' . $rootEntry['name']), strlen($user) + 2); // full path without /$user/ |
|
| 1483 | + $rootEntry['path'] = substr(Filesystem::normalizePath($path.'/'.$rootEntry['name']), strlen($user) + 2); // full path without /$user/ |
|
| 1484 | 1484 | |
| 1485 | 1485 | // if sharing was disabled for the user we remove the share permissions |
| 1486 | 1486 | if (\OCP\Util::isSharingDisabledForUser()) { |
@@ -1488,14 +1488,14 @@ discard block |
||
| 1488 | 1488 | } |
| 1489 | 1489 | |
| 1490 | 1490 | $owner = $this->getUserObjectForOwner($subStorage->getOwner('')); |
| 1491 | - $files[] = new FileInfo($path . '/' . $rootEntry['name'], $subStorage, '', $rootEntry, $mount, $owner); |
|
| 1491 | + $files[] = new FileInfo($path.'/'.$rootEntry['name'], $subStorage, '', $rootEntry, $mount, $owner); |
|
| 1492 | 1492 | } |
| 1493 | 1493 | } |
| 1494 | 1494 | } |
| 1495 | 1495 | } |
| 1496 | 1496 | |
| 1497 | 1497 | if ($mimetype_filter) { |
| 1498 | - $files = array_filter($files, function (FileInfo $file) use ($mimetype_filter) { |
|
| 1498 | + $files = array_filter($files, function(FileInfo $file) use ($mimetype_filter) { |
|
| 1499 | 1499 | if (strpos($mimetype_filter, '/')) { |
| 1500 | 1500 | return $file->getMimetype() === $mimetype_filter; |
| 1501 | 1501 | } else { |
@@ -1524,7 +1524,7 @@ discard block |
||
| 1524 | 1524 | if ($data instanceof FileInfo) { |
| 1525 | 1525 | $data = $data->getData(); |
| 1526 | 1526 | } |
| 1527 | - $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path); |
|
| 1527 | + $path = Filesystem::normalizePath($this->fakeRoot.'/'.$path); |
|
| 1528 | 1528 | /** |
| 1529 | 1529 | * @var \OC\Files\Storage\Storage $storage |
| 1530 | 1530 | * @var string $internalPath |
@@ -1551,7 +1551,7 @@ discard block |
||
| 1551 | 1551 | * @return FileInfo[] |
| 1552 | 1552 | */ |
| 1553 | 1553 | public function search($query) { |
| 1554 | - return $this->searchCommon('search', array('%' . $query . '%')); |
|
| 1554 | + return $this->searchCommon('search', array('%'.$query.'%')); |
|
| 1555 | 1555 | } |
| 1556 | 1556 | |
| 1557 | 1557 | /** |
@@ -1602,10 +1602,10 @@ discard block |
||
| 1602 | 1602 | |
| 1603 | 1603 | $results = call_user_func_array(array($cache, $method), $args); |
| 1604 | 1604 | foreach ($results as $result) { |
| 1605 | - if (substr($mountPoint . $result['path'], 0, $rootLength + 1) === $this->fakeRoot . '/') { |
|
| 1605 | + if (substr($mountPoint.$result['path'], 0, $rootLength + 1) === $this->fakeRoot.'/') { |
|
| 1606 | 1606 | $internalPath = $result['path']; |
| 1607 | - $path = $mountPoint . $result['path']; |
|
| 1608 | - $result['path'] = substr($mountPoint . $result['path'], $rootLength); |
|
| 1607 | + $path = $mountPoint.$result['path']; |
|
| 1608 | + $result['path'] = substr($mountPoint.$result['path'], $rootLength); |
|
| 1609 | 1609 | $owner = \OC::$server->getUserManager()->get($storage->getOwner($internalPath)); |
| 1610 | 1610 | $files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner); |
| 1611 | 1611 | } |
@@ -1623,8 +1623,8 @@ discard block |
||
| 1623 | 1623 | if ($results) { |
| 1624 | 1624 | foreach ($results as $result) { |
| 1625 | 1625 | $internalPath = $result['path']; |
| 1626 | - $result['path'] = rtrim($relativeMountPoint . $result['path'], '/'); |
|
| 1627 | - $path = rtrim($mountPoint . $internalPath, '/'); |
|
| 1626 | + $result['path'] = rtrim($relativeMountPoint.$result['path'], '/'); |
|
| 1627 | + $path = rtrim($mountPoint.$internalPath, '/'); |
|
| 1628 | 1628 | $owner = \OC::$server->getUserManager()->get($storage->getOwner($internalPath)); |
| 1629 | 1629 | $files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner); |
| 1630 | 1630 | } |
@@ -1645,7 +1645,7 @@ discard block |
||
| 1645 | 1645 | public function getOwner($path) { |
| 1646 | 1646 | $info = $this->getFileInfo($path); |
| 1647 | 1647 | if (!$info) { |
| 1648 | - throw new NotFoundException($path . ' not found while trying to get owner'); |
|
| 1648 | + throw new NotFoundException($path.' not found while trying to get owner'); |
|
| 1649 | 1649 | } |
| 1650 | 1650 | return $info->getOwner()->getUID(); |
| 1651 | 1651 | } |
@@ -1679,7 +1679,7 @@ discard block |
||
| 1679 | 1679 | * @return string |
| 1680 | 1680 | */ |
| 1681 | 1681 | public function getPath($id) { |
| 1682 | - $id = (int)$id; |
|
| 1682 | + $id = (int) $id; |
|
| 1683 | 1683 | $manager = Filesystem::getMountManager(); |
| 1684 | 1684 | $mounts = $manager->findIn($this->fakeRoot); |
| 1685 | 1685 | $mounts[] = $manager->find($this->fakeRoot); |
@@ -1694,7 +1694,7 @@ discard block |
||
| 1694 | 1694 | $cache = $mount->getStorage()->getCache(); |
| 1695 | 1695 | $internalPath = $cache->getPathById($id); |
| 1696 | 1696 | if (is_string($internalPath)) { |
| 1697 | - $fullPath = $mount->getMountPoint() . $internalPath; |
|
| 1697 | + $fullPath = $mount->getMountPoint().$internalPath; |
|
| 1698 | 1698 | if (!is_null($path = $this->getRelativePath($fullPath))) { |
| 1699 | 1699 | return $path; |
| 1700 | 1700 | } |
@@ -1737,10 +1737,10 @@ discard block |
||
| 1737 | 1737 | } |
| 1738 | 1738 | |
| 1739 | 1739 | // note: cannot use the view because the target is already locked |
| 1740 | - $fileId = (int)$targetStorage->getCache()->getId($targetInternalPath); |
|
| 1740 | + $fileId = (int) $targetStorage->getCache()->getId($targetInternalPath); |
|
| 1741 | 1741 | if ($fileId === -1) { |
| 1742 | 1742 | // target might not exist, need to check parent instead |
| 1743 | - $fileId = (int)$targetStorage->getCache()->getId(dirname($targetInternalPath)); |
|
| 1743 | + $fileId = (int) $targetStorage->getCache()->getId(dirname($targetInternalPath)); |
|
| 1744 | 1744 | } |
| 1745 | 1745 | |
| 1746 | 1746 | // check if any of the parents were shared by the current owner (include collections) |
@@ -1840,7 +1840,7 @@ discard block |
||
| 1840 | 1840 | $resultPath = ''; |
| 1841 | 1841 | foreach ($parts as $part) { |
| 1842 | 1842 | if ($part) { |
| 1843 | - $resultPath .= '/' . $part; |
|
| 1843 | + $resultPath .= '/'.$part; |
|
| 1844 | 1844 | $result[] = $resultPath; |
| 1845 | 1845 | } |
| 1846 | 1846 | } |
@@ -2103,16 +2103,16 @@ discard block |
||
| 2103 | 2103 | public function getUidAndFilename($filename) { |
| 2104 | 2104 | $info = $this->getFileInfo($filename); |
| 2105 | 2105 | if (!$info instanceof \OCP\Files\FileInfo) { |
| 2106 | - throw new NotFoundException($this->getAbsolutePath($filename) . ' not found'); |
|
| 2106 | + throw new NotFoundException($this->getAbsolutePath($filename).' not found'); |
|
| 2107 | 2107 | } |
| 2108 | 2108 | $uid = $info->getOwner()->getUID(); |
| 2109 | 2109 | if ($uid != \OCP\User::getUser()) { |
| 2110 | 2110 | Filesystem::initMountPoints($uid); |
| 2111 | - $ownerView = new View('/' . $uid . '/files'); |
|
| 2111 | + $ownerView = new View('/'.$uid.'/files'); |
|
| 2112 | 2112 | try { |
| 2113 | 2113 | $filename = $ownerView->getPath($info['fileid']); |
| 2114 | 2114 | } catch (NotFoundException $e) { |
| 2115 | - throw new NotFoundException('File with id ' . $info['fileid'] . ' not found for user ' . $uid); |
|
| 2115 | + throw new NotFoundException('File with id '.$info['fileid'].' not found for user '.$uid); |
|
| 2116 | 2116 | } |
| 2117 | 2117 | } |
| 2118 | 2118 | return [$uid, $filename]; |
@@ -2129,7 +2129,7 @@ discard block |
||
| 2129 | 2129 | $directoryParts = array_filter($directoryParts); |
| 2130 | 2130 | foreach ($directoryParts as $key => $part) { |
| 2131 | 2131 | $currentPathElements = array_slice($directoryParts, 0, $key); |
| 2132 | - $currentPath = '/' . implode('/', $currentPathElements); |
|
| 2132 | + $currentPath = '/'.implode('/', $currentPathElements); |
|
| 2133 | 2133 | if ($this->is_file($currentPath)) { |
| 2134 | 2134 | return false; |
| 2135 | 2135 | } |