@@ -127,9 +127,9 @@ discard block |
||
| 127 | 127 | $path = '/'; |
| 128 | 128 | } |
| 129 | 129 | if ($path[0] !== '/') { |
| 130 | - $path = '/' . $path; |
|
| 130 | + $path = '/'.$path; |
|
| 131 | 131 | } |
| 132 | - return $this->fakeRoot . $path; |
|
| 132 | + return $this->fakeRoot.$path; |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | public function chroot($fakeRoot) { |
| 142 | 142 | if (!$fakeRoot == '') { |
| 143 | 143 | if ($fakeRoot[0] !== '/') { |
| 144 | - $fakeRoot = '/' . $fakeRoot; |
|
| 144 | + $fakeRoot = '/'.$fakeRoot; |
|
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | $this->fakeRoot = $fakeRoot; |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | // missing slashes can cause wrong matches! |
| 176 | - $root = rtrim($this->fakeRoot, '/') . '/'; |
|
| 176 | + $root = rtrim($this->fakeRoot, '/').'/'; |
|
| 177 | 177 | |
| 178 | 178 | if (strpos($path, $root) !== 0) { |
| 179 | 179 | return null; |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | if ($mount instanceof MoveableMount) { |
| 280 | 280 | // cut of /user/files to get the relative path to data/user/files |
| 281 | 281 | $pathParts = explode('/', $path, 4); |
| 282 | - $relPath = '/' . $pathParts[3]; |
|
| 282 | + $relPath = '/'.$pathParts[3]; |
|
| 283 | 283 | $this->lockFile($relPath, ILockingProvider::LOCK_SHARED, true); |
| 284 | 284 | \OC_Hook::emit( |
| 285 | 285 | Filesystem::CLASSNAME, "umount", |
@@ -699,7 +699,7 @@ discard block |
||
| 699 | 699 | } |
| 700 | 700 | $postFix = (substr($path, -1) === '/') ? '/' : ''; |
| 701 | 701 | $absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path)); |
| 702 | - $mount = Filesystem::getMountManager()->find($absolutePath . $postFix); |
|
| 702 | + $mount = Filesystem::getMountManager()->find($absolutePath.$postFix); |
|
| 703 | 703 | if ($mount and $mount->getInternalPath($absolutePath) === '') { |
| 704 | 704 | return $this->removeMount($mount, $absolutePath); |
| 705 | 705 | } |
@@ -819,7 +819,7 @@ discard block |
||
| 819 | 819 | $this->renameUpdate($storage1, $storage2, $internalPath1, $internalPath2); |
| 820 | 820 | } |
| 821 | 821 | } |
| 822 | - } catch(\Exception $e) { |
|
| 822 | + } catch (\Exception $e) { |
|
| 823 | 823 | throw $e; |
| 824 | 824 | } finally { |
| 825 | 825 | $this->changeLock($path1, ILockingProvider::LOCK_SHARED, true); |
@@ -843,7 +843,7 @@ discard block |
||
| 843 | 843 | } |
| 844 | 844 | } |
| 845 | 845 | } |
| 846 | - } catch(\Exception $e) { |
|
| 846 | + } catch (\Exception $e) { |
|
| 847 | 847 | throw $e; |
| 848 | 848 | } finally { |
| 849 | 849 | $this->unlockFile($path1, ILockingProvider::LOCK_SHARED, true); |
@@ -976,7 +976,7 @@ discard block |
||
| 976 | 976 | $hooks[] = 'write'; |
| 977 | 977 | break; |
| 978 | 978 | default: |
| 979 | - \OCP\Util::writeLog('core', 'invalid mode (' . $mode . ') for ' . $path, ILogger::ERROR); |
|
| 979 | + \OCP\Util::writeLog('core', 'invalid mode ('.$mode.') for '.$path, ILogger::ERROR); |
|
| 980 | 980 | } |
| 981 | 981 | |
| 982 | 982 | if ($mode !== 'r' && $mode !== 'w') { |
@@ -1080,7 +1080,7 @@ discard block |
||
| 1080 | 1080 | array(Filesystem::signal_param_path => $this->getHookPath($path)) |
| 1081 | 1081 | ); |
| 1082 | 1082 | } |
| 1083 | - list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix); |
|
| 1083 | + list($storage, $internalPath) = Filesystem::resolvePath($absolutePath.$postFix); |
|
| 1084 | 1084 | if ($storage) { |
| 1085 | 1085 | return $storage->hash($type, $internalPath, $raw); |
| 1086 | 1086 | } |
@@ -1134,7 +1134,7 @@ discard block |
||
| 1134 | 1134 | |
| 1135 | 1135 | $run = $this->runHooks($hooks, $path); |
| 1136 | 1136 | /** @var \OC\Files\Storage\Storage $storage */ |
| 1137 | - list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix); |
|
| 1137 | + list($storage, $internalPath) = Filesystem::resolvePath($absolutePath.$postFix); |
|
| 1138 | 1138 | if ($run and $storage) { |
| 1139 | 1139 | if (in_array('write', $hooks) || in_array('delete', $hooks)) { |
| 1140 | 1140 | try { |
@@ -1163,7 +1163,7 @@ discard block |
||
| 1163 | 1163 | if ($result && in_array('delete', $hooks) and $result) { |
| 1164 | 1164 | $this->removeUpdate($storage, $internalPath); |
| 1165 | 1165 | } |
| 1166 | - if ($result && in_array('write', $hooks, true) && $operation !== 'fopen' && $operation !== 'touch') { |
|
| 1166 | + if ($result && in_array('write', $hooks, true) && $operation !== 'fopen' && $operation !== 'touch') { |
|
| 1167 | 1167 | $this->writeUpdate($storage, $internalPath); |
| 1168 | 1168 | } |
| 1169 | 1169 | if ($result && in_array('touch', $hooks)) { |
@@ -1179,7 +1179,7 @@ discard block |
||
| 1179 | 1179 | $unlockLater = true; |
| 1180 | 1180 | // make sure our unlocking callback will still be called if connection is aborted |
| 1181 | 1181 | ignore_user_abort(true); |
| 1182 | - $result = CallbackWrapper::wrap($result, null, null, function () use ($hooks, $path) { |
|
| 1182 | + $result = CallbackWrapper::wrap($result, null, null, function() use ($hooks, $path) { |
|
| 1183 | 1183 | if (in_array('write', $hooks)) { |
| 1184 | 1184 | $this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE); |
| 1185 | 1185 | } else if (in_array('read', $hooks)) { |
@@ -1240,7 +1240,7 @@ discard block |
||
| 1240 | 1240 | return true; |
| 1241 | 1241 | } |
| 1242 | 1242 | |
| 1243 | - return (strlen($fullPath) > strlen($defaultRoot)) && (substr($fullPath, 0, strlen($defaultRoot) + 1) === $defaultRoot . '/'); |
|
| 1243 | + return (strlen($fullPath) > strlen($defaultRoot)) && (substr($fullPath, 0, strlen($defaultRoot) + 1) === $defaultRoot.'/'); |
|
| 1244 | 1244 | } |
| 1245 | 1245 | |
| 1246 | 1246 | /** |
@@ -1259,7 +1259,7 @@ discard block |
||
| 1259 | 1259 | if ($hook != 'read') { |
| 1260 | 1260 | \OC_Hook::emit( |
| 1261 | 1261 | Filesystem::CLASSNAME, |
| 1262 | - $prefix . $hook, |
|
| 1262 | + $prefix.$hook, |
|
| 1263 | 1263 | array( |
| 1264 | 1264 | Filesystem::signal_param_run => &$run, |
| 1265 | 1265 | Filesystem::signal_param_path => $path |
@@ -1268,7 +1268,7 @@ discard block |
||
| 1268 | 1268 | } elseif (!$post) { |
| 1269 | 1269 | \OC_Hook::emit( |
| 1270 | 1270 | Filesystem::CLASSNAME, |
| 1271 | - $prefix . $hook, |
|
| 1271 | + $prefix.$hook, |
|
| 1272 | 1272 | array( |
| 1273 | 1273 | Filesystem::signal_param_path => $path |
| 1274 | 1274 | ) |
@@ -1361,11 +1361,11 @@ discard block |
||
| 1361 | 1361 | return $this->getPartFileInfo($path); |
| 1362 | 1362 | } |
| 1363 | 1363 | $relativePath = $path; |
| 1364 | - $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path); |
|
| 1364 | + $path = Filesystem::normalizePath($this->fakeRoot.'/'.$path); |
|
| 1365 | 1365 | |
| 1366 | 1366 | $mount = Filesystem::getMountManager()->find($path); |
| 1367 | 1367 | if (!$mount) { |
| 1368 | - \OC::$server->getLogger()->warning('Mountpoint not found for path: ' . $path); |
|
| 1368 | + \OC::$server->getLogger()->warning('Mountpoint not found for path: '.$path); |
|
| 1369 | 1369 | return false; |
| 1370 | 1370 | } |
| 1371 | 1371 | $storage = $mount->getStorage(); |
@@ -1393,7 +1393,7 @@ discard block |
||
| 1393 | 1393 | //add the sizes of other mount points to the folder |
| 1394 | 1394 | $extOnly = ($includeMountPoints === 'ext'); |
| 1395 | 1395 | $mounts = Filesystem::getMountManager()->findIn($path); |
| 1396 | - $info->setSubMounts(array_filter($mounts, function (IMountPoint $mount) use ($extOnly) { |
|
| 1396 | + $info->setSubMounts(array_filter($mounts, function(IMountPoint $mount) use ($extOnly) { |
|
| 1397 | 1397 | $subStorage = $mount->getStorage(); |
| 1398 | 1398 | return !($extOnly && $subStorage instanceof \OCA\Files_Sharing\SharedStorage); |
| 1399 | 1399 | })); |
@@ -1402,7 +1402,7 @@ discard block |
||
| 1402 | 1402 | |
| 1403 | 1403 | return $info; |
| 1404 | 1404 | } else { |
| 1405 | - \OC::$server->getLogger()->warning('Storage not valid for mountpoint: ' . $mount->getMountPoint()); |
|
| 1405 | + \OC::$server->getLogger()->warning('Storage not valid for mountpoint: '.$mount->getMountPoint()); |
|
| 1406 | 1406 | } |
| 1407 | 1407 | |
| 1408 | 1408 | return false; |
@@ -1449,12 +1449,12 @@ discard block |
||
| 1449 | 1449 | /** |
| 1450 | 1450 | * @var \OC\Files\FileInfo[] $fileInfos |
| 1451 | 1451 | */ |
| 1452 | - $fileInfos = array_map(function (ICacheEntry $content) use ($path, $storage, $mount, $sharingDisabled) { |
|
| 1452 | + $fileInfos = array_map(function(ICacheEntry $content) use ($path, $storage, $mount, $sharingDisabled) { |
|
| 1453 | 1453 | if ($sharingDisabled) { |
| 1454 | 1454 | $content['permissions'] = $content['permissions'] & ~\OCP\Constants::PERMISSION_SHARE; |
| 1455 | 1455 | } |
| 1456 | 1456 | $owner = $this->getUserObjectForOwner($storage->getOwner($content['path'])); |
| 1457 | - return new FileInfo($path . '/' . $content['name'], $storage, $content['path'], $content, $mount, $owner); |
|
| 1457 | + return new FileInfo($path.'/'.$content['name'], $storage, $content['path'], $content, $mount, $owner); |
|
| 1458 | 1458 | }, $contents); |
| 1459 | 1459 | $files = array_combine($fileNames, $fileInfos); |
| 1460 | 1460 | |
@@ -1479,7 +1479,7 @@ discard block |
||
| 1479 | 1479 | } catch (\Exception $e) { |
| 1480 | 1480 | // sometimes when the storage is not available it can be any exception |
| 1481 | 1481 | \OC::$server->getLogger()->logException($e, [ |
| 1482 | - 'message' => 'Exception while scanning storage "' . $subStorage->getId() . '"', |
|
| 1482 | + 'message' => 'Exception while scanning storage "'.$subStorage->getId().'"', |
|
| 1483 | 1483 | 'level' => ILogger::ERROR, |
| 1484 | 1484 | 'app' => 'lib', |
| 1485 | 1485 | ]); |
@@ -1510,7 +1510,7 @@ discard block |
||
| 1510 | 1510 | $rootEntry['permissions'] = $permissions & (\OCP\Constants::PERMISSION_ALL - (\OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE)); |
| 1511 | 1511 | } |
| 1512 | 1512 | |
| 1513 | - $rootEntry['path'] = substr(Filesystem::normalizePath($path . '/' . $rootEntry['name']), strlen($user) + 2); // full path without /$user/ |
|
| 1513 | + $rootEntry['path'] = substr(Filesystem::normalizePath($path.'/'.$rootEntry['name']), strlen($user) + 2); // full path without /$user/ |
|
| 1514 | 1514 | |
| 1515 | 1515 | // if sharing was disabled for the user we remove the share permissions |
| 1516 | 1516 | if (\OCP\Util::isSharingDisabledForUser()) { |
@@ -1518,14 +1518,14 @@ discard block |
||
| 1518 | 1518 | } |
| 1519 | 1519 | |
| 1520 | 1520 | $owner = $this->getUserObjectForOwner($subStorage->getOwner('')); |
| 1521 | - $files[$rootEntry->getName()] = new FileInfo($path . '/' . $rootEntry['name'], $subStorage, '', $rootEntry, $mount, $owner); |
|
| 1521 | + $files[$rootEntry->getName()] = new FileInfo($path.'/'.$rootEntry['name'], $subStorage, '', $rootEntry, $mount, $owner); |
|
| 1522 | 1522 | } |
| 1523 | 1523 | } |
| 1524 | 1524 | } |
| 1525 | 1525 | } |
| 1526 | 1526 | |
| 1527 | 1527 | if ($mimetype_filter) { |
| 1528 | - $files = array_filter($files, function (FileInfo $file) use ($mimetype_filter) { |
|
| 1528 | + $files = array_filter($files, function(FileInfo $file) use ($mimetype_filter) { |
|
| 1529 | 1529 | if (strpos($mimetype_filter, '/')) { |
| 1530 | 1530 | return $file->getMimetype() === $mimetype_filter; |
| 1531 | 1531 | } else { |
@@ -1554,7 +1554,7 @@ discard block |
||
| 1554 | 1554 | if ($data instanceof FileInfo) { |
| 1555 | 1555 | $data = $data->getData(); |
| 1556 | 1556 | } |
| 1557 | - $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path); |
|
| 1557 | + $path = Filesystem::normalizePath($this->fakeRoot.'/'.$path); |
|
| 1558 | 1558 | /** |
| 1559 | 1559 | * @var \OC\Files\Storage\Storage $storage |
| 1560 | 1560 | * @var string $internalPath |
@@ -1581,7 +1581,7 @@ discard block |
||
| 1581 | 1581 | * @return FileInfo[] |
| 1582 | 1582 | */ |
| 1583 | 1583 | public function search($query) { |
| 1584 | - return $this->searchCommon('search', array('%' . $query . '%')); |
|
| 1584 | + return $this->searchCommon('search', array('%'.$query.'%')); |
|
| 1585 | 1585 | } |
| 1586 | 1586 | |
| 1587 | 1587 | /** |
@@ -1632,10 +1632,10 @@ discard block |
||
| 1632 | 1632 | |
| 1633 | 1633 | $results = call_user_func_array(array($cache, $method), $args); |
| 1634 | 1634 | foreach ($results as $result) { |
| 1635 | - if (substr($mountPoint . $result['path'], 0, $rootLength + 1) === $this->fakeRoot . '/') { |
|
| 1635 | + if (substr($mountPoint.$result['path'], 0, $rootLength + 1) === $this->fakeRoot.'/') { |
|
| 1636 | 1636 | $internalPath = $result['path']; |
| 1637 | - $path = $mountPoint . $result['path']; |
|
| 1638 | - $result['path'] = substr($mountPoint . $result['path'], $rootLength); |
|
| 1637 | + $path = $mountPoint.$result['path']; |
|
| 1638 | + $result['path'] = substr($mountPoint.$result['path'], $rootLength); |
|
| 1639 | 1639 | $owner = \OC::$server->getUserManager()->get($storage->getOwner($internalPath)); |
| 1640 | 1640 | $files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner); |
| 1641 | 1641 | } |
@@ -1653,8 +1653,8 @@ discard block |
||
| 1653 | 1653 | if ($results) { |
| 1654 | 1654 | foreach ($results as $result) { |
| 1655 | 1655 | $internalPath = $result['path']; |
| 1656 | - $result['path'] = rtrim($relativeMountPoint . $result['path'], '/'); |
|
| 1657 | - $path = rtrim($mountPoint . $internalPath, '/'); |
|
| 1656 | + $result['path'] = rtrim($relativeMountPoint.$result['path'], '/'); |
|
| 1657 | + $path = rtrim($mountPoint.$internalPath, '/'); |
|
| 1658 | 1658 | $owner = \OC::$server->getUserManager()->get($storage->getOwner($internalPath)); |
| 1659 | 1659 | $files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner); |
| 1660 | 1660 | } |
@@ -1675,7 +1675,7 @@ discard block |
||
| 1675 | 1675 | public function getOwner($path) { |
| 1676 | 1676 | $info = $this->getFileInfo($path); |
| 1677 | 1677 | if (!$info) { |
| 1678 | - throw new NotFoundException($path . ' not found while trying to get owner'); |
|
| 1678 | + throw new NotFoundException($path.' not found while trying to get owner'); |
|
| 1679 | 1679 | } |
| 1680 | 1680 | return $info->getOwner()->getUID(); |
| 1681 | 1681 | } |
@@ -1709,7 +1709,7 @@ discard block |
||
| 1709 | 1709 | * @return string |
| 1710 | 1710 | */ |
| 1711 | 1711 | public function getPath($id) { |
| 1712 | - $id = (int)$id; |
|
| 1712 | + $id = (int) $id; |
|
| 1713 | 1713 | $manager = Filesystem::getMountManager(); |
| 1714 | 1714 | $mounts = $manager->findIn($this->fakeRoot); |
| 1715 | 1715 | $mounts[] = $manager->find($this->fakeRoot); |
@@ -1724,7 +1724,7 @@ discard block |
||
| 1724 | 1724 | $cache = $mount->getStorage()->getCache(); |
| 1725 | 1725 | $internalPath = $cache->getPathById($id); |
| 1726 | 1726 | if (is_string($internalPath)) { |
| 1727 | - $fullPath = $mount->getMountPoint() . $internalPath; |
|
| 1727 | + $fullPath = $mount->getMountPoint().$internalPath; |
|
| 1728 | 1728 | if (!is_null($path = $this->getRelativePath($fullPath))) { |
| 1729 | 1729 | return $path; |
| 1730 | 1730 | } |
@@ -1767,10 +1767,10 @@ discard block |
||
| 1767 | 1767 | } |
| 1768 | 1768 | |
| 1769 | 1769 | // note: cannot use the view because the target is already locked |
| 1770 | - $fileId = (int)$targetStorage->getCache()->getId($targetInternalPath); |
|
| 1770 | + $fileId = (int) $targetStorage->getCache()->getId($targetInternalPath); |
|
| 1771 | 1771 | if ($fileId === -1) { |
| 1772 | 1772 | // target might not exist, need to check parent instead |
| 1773 | - $fileId = (int)$targetStorage->getCache()->getId(dirname($targetInternalPath)); |
|
| 1773 | + $fileId = (int) $targetStorage->getCache()->getId(dirname($targetInternalPath)); |
|
| 1774 | 1774 | } |
| 1775 | 1775 | |
| 1776 | 1776 | // check if any of the parents were shared by the current owner (include collections) |
@@ -1870,7 +1870,7 @@ discard block |
||
| 1870 | 1870 | $resultPath = ''; |
| 1871 | 1871 | foreach ($parts as $part) { |
| 1872 | 1872 | if ($part) { |
| 1873 | - $resultPath .= '/' . $part; |
|
| 1873 | + $resultPath .= '/'.$part; |
|
| 1874 | 1874 | $result[] = $resultPath; |
| 1875 | 1875 | } |
| 1876 | 1876 | } |
@@ -2133,16 +2133,16 @@ discard block |
||
| 2133 | 2133 | public function getUidAndFilename($filename) { |
| 2134 | 2134 | $info = $this->getFileInfo($filename); |
| 2135 | 2135 | if (!$info instanceof \OCP\Files\FileInfo) { |
| 2136 | - throw new NotFoundException($this->getAbsolutePath($filename) . ' not found'); |
|
| 2136 | + throw new NotFoundException($this->getAbsolutePath($filename).' not found'); |
|
| 2137 | 2137 | } |
| 2138 | 2138 | $uid = $info->getOwner()->getUID(); |
| 2139 | 2139 | if ($uid != \OCP\User::getUser()) { |
| 2140 | 2140 | Filesystem::initMountPoints($uid); |
| 2141 | - $ownerView = new View('/' . $uid . '/files'); |
|
| 2141 | + $ownerView = new View('/'.$uid.'/files'); |
|
| 2142 | 2142 | try { |
| 2143 | 2143 | $filename = $ownerView->getPath($info['fileid']); |
| 2144 | 2144 | } catch (NotFoundException $e) { |
| 2145 | - throw new NotFoundException('File with id ' . $info['fileid'] . ' not found for user ' . $uid); |
|
| 2145 | + throw new NotFoundException('File with id '.$info['fileid'].' not found for user '.$uid); |
|
| 2146 | 2146 | } |
| 2147 | 2147 | } |
| 2148 | 2148 | return [$uid, $filename]; |
@@ -2159,7 +2159,7 @@ discard block |
||
| 2159 | 2159 | $directoryParts = array_filter($directoryParts); |
| 2160 | 2160 | foreach ($directoryParts as $key => $part) { |
| 2161 | 2161 | $currentPathElements = array_slice($directoryParts, 0, $key); |
| 2162 | - $currentPath = '/' . implode('/', $currentPathElements); |
|
| 2162 | + $currentPath = '/'.implode('/', $currentPathElements); |
|
| 2163 | 2163 | if ($this->is_file($currentPath)) { |
| 2164 | 2164 | return false; |
| 2165 | 2165 | } |