@@ -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 | $this->changeLock($path, ILockingProvider::LOCK_EXCLUSIVE); |
@@ -1173,7 +1173,7 @@ discard block |
||
| 1173 | 1173 | $unlockLater = true; |
| 1174 | 1174 | // make sure our unlocking callback will still be called if connection is aborted |
| 1175 | 1175 | ignore_user_abort(true); |
| 1176 | - $result = CallbackWrapper::wrap($result, null, null, function () use ($hooks, $path) { |
|
| 1176 | + $result = CallbackWrapper::wrap($result, null, null, function() use ($hooks, $path) { |
|
| 1177 | 1177 | if (in_array('write', $hooks)) { |
| 1178 | 1178 | $this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE); |
| 1179 | 1179 | } else if (in_array('read', $hooks)) { |
@@ -1234,7 +1234,7 @@ discard block |
||
| 1234 | 1234 | return true; |
| 1235 | 1235 | } |
| 1236 | 1236 | |
| 1237 | - return (strlen($fullPath) > strlen($defaultRoot)) && (substr($fullPath, 0, strlen($defaultRoot) + 1) === $defaultRoot . '/'); |
|
| 1237 | + return (strlen($fullPath) > strlen($defaultRoot)) && (substr($fullPath, 0, strlen($defaultRoot) + 1) === $defaultRoot.'/'); |
|
| 1238 | 1238 | } |
| 1239 | 1239 | |
| 1240 | 1240 | /** |
@@ -1253,7 +1253,7 @@ discard block |
||
| 1253 | 1253 | if ($hook != 'read') { |
| 1254 | 1254 | \OC_Hook::emit( |
| 1255 | 1255 | Filesystem::CLASSNAME, |
| 1256 | - $prefix . $hook, |
|
| 1256 | + $prefix.$hook, |
|
| 1257 | 1257 | array( |
| 1258 | 1258 | Filesystem::signal_param_run => &$run, |
| 1259 | 1259 | Filesystem::signal_param_path => $path |
@@ -1262,7 +1262,7 @@ discard block |
||
| 1262 | 1262 | } elseif (!$post) { |
| 1263 | 1263 | \OC_Hook::emit( |
| 1264 | 1264 | Filesystem::CLASSNAME, |
| 1265 | - $prefix . $hook, |
|
| 1265 | + $prefix.$hook, |
|
| 1266 | 1266 | array( |
| 1267 | 1267 | Filesystem::signal_param_path => $path |
| 1268 | 1268 | ) |
@@ -1357,11 +1357,11 @@ 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) { |
| 1364 | - \OC::$server->getLogger()->warning('Mountpoint not found for path: ' . $path); |
|
| 1364 | + \OC::$server->getLogger()->warning('Mountpoint not found for path: '.$path); |
|
| 1365 | 1365 | return false; |
| 1366 | 1366 | } |
| 1367 | 1367 | $storage = $mount->getStorage(); |
@@ -1385,7 +1385,7 @@ discard block |
||
| 1385 | 1385 | //add the sizes of other mount points to the folder |
| 1386 | 1386 | $extOnly = ($includeMountPoints === 'ext'); |
| 1387 | 1387 | $mounts = Filesystem::getMountManager()->findIn($path); |
| 1388 | - $info->setSubMounts(array_filter($mounts, function (IMountPoint $mount) use ($extOnly) { |
|
| 1388 | + $info->setSubMounts(array_filter($mounts, function(IMountPoint $mount) use ($extOnly) { |
|
| 1389 | 1389 | $subStorage = $mount->getStorage(); |
| 1390 | 1390 | return !($extOnly && $subStorage instanceof \OCA\Files_Sharing\SharedStorage); |
| 1391 | 1391 | })); |
@@ -1394,7 +1394,7 @@ discard block |
||
| 1394 | 1394 | |
| 1395 | 1395 | return $info; |
| 1396 | 1396 | } else { |
| 1397 | - \OC::$server->getLogger()->warning('Storage not valid for mountpoint: ' . $mount->getMountPoint()); |
|
| 1397 | + \OC::$server->getLogger()->warning('Storage not valid for mountpoint: '.$mount->getMountPoint()); |
|
| 1398 | 1398 | } |
| 1399 | 1399 | |
| 1400 | 1400 | return false; |
@@ -1437,12 +1437,12 @@ discard block |
||
| 1437 | 1437 | /** |
| 1438 | 1438 | * @var \OC\Files\FileInfo[] $files |
| 1439 | 1439 | */ |
| 1440 | - $files = array_map(function (ICacheEntry $content) use ($path, $storage, $mount, $sharingDisabled) { |
|
| 1440 | + $files = array_map(function(ICacheEntry $content) use ($path, $storage, $mount, $sharingDisabled) { |
|
| 1441 | 1441 | if ($sharingDisabled) { |
| 1442 | 1442 | $content['permissions'] = $content['permissions'] & ~\OCP\Constants::PERMISSION_SHARE; |
| 1443 | 1443 | } |
| 1444 | 1444 | $owner = $this->getUserObjectForOwner($storage->getOwner($content['path'])); |
| 1445 | - return new FileInfo($path . '/' . $content['name'], $storage, $content['path'], $content, $mount, $owner); |
|
| 1445 | + return new FileInfo($path.'/'.$content['name'], $storage, $content['path'], $content, $mount, $owner); |
|
| 1446 | 1446 | }, $contents); |
| 1447 | 1447 | |
| 1448 | 1448 | //add a folder for any mountpoint in this directory and add the sizes of other mountpoints to the folders |
@@ -1466,7 +1466,7 @@ discard block |
||
| 1466 | 1466 | } catch (\Exception $e) { |
| 1467 | 1467 | // sometimes when the storage is not available it can be any exception |
| 1468 | 1468 | \OC::$server->getLogger()->logException($e, [ |
| 1469 | - 'message' => 'Exception while scanning storage "' . $subStorage->getId() . '"', |
|
| 1469 | + 'message' => 'Exception while scanning storage "'.$subStorage->getId().'"', |
|
| 1470 | 1470 | 'level' => ILogger::ERROR, |
| 1471 | 1471 | 'app' => 'lib', |
| 1472 | 1472 | ]); |
@@ -1504,7 +1504,7 @@ discard block |
||
| 1504 | 1504 | break; |
| 1505 | 1505 | } |
| 1506 | 1506 | } |
| 1507 | - $rootEntry['path'] = substr(Filesystem::normalizePath($path . '/' . $rootEntry['name']), strlen($user) + 2); // full path without /$user/ |
|
| 1507 | + $rootEntry['path'] = substr(Filesystem::normalizePath($path.'/'.$rootEntry['name']), strlen($user) + 2); // full path without /$user/ |
|
| 1508 | 1508 | |
| 1509 | 1509 | // if sharing was disabled for the user we remove the share permissions |
| 1510 | 1510 | if (\OCP\Util::isSharingDisabledForUser()) { |
@@ -1512,14 +1512,14 @@ discard block |
||
| 1512 | 1512 | } |
| 1513 | 1513 | |
| 1514 | 1514 | $owner = $this->getUserObjectForOwner($subStorage->getOwner('')); |
| 1515 | - $files[] = new FileInfo($path . '/' . $rootEntry['name'], $subStorage, '', $rootEntry, $mount, $owner); |
|
| 1515 | + $files[] = new FileInfo($path.'/'.$rootEntry['name'], $subStorage, '', $rootEntry, $mount, $owner); |
|
| 1516 | 1516 | } |
| 1517 | 1517 | } |
| 1518 | 1518 | } |
| 1519 | 1519 | } |
| 1520 | 1520 | |
| 1521 | 1521 | if ($mimetype_filter) { |
| 1522 | - $files = array_filter($files, function (FileInfo $file) use ($mimetype_filter) { |
|
| 1522 | + $files = array_filter($files, function(FileInfo $file) use ($mimetype_filter) { |
|
| 1523 | 1523 | if (strpos($mimetype_filter, '/')) { |
| 1524 | 1524 | return $file->getMimetype() === $mimetype_filter; |
| 1525 | 1525 | } else { |
@@ -1548,7 +1548,7 @@ discard block |
||
| 1548 | 1548 | if ($data instanceof FileInfo) { |
| 1549 | 1549 | $data = $data->getData(); |
| 1550 | 1550 | } |
| 1551 | - $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path); |
|
| 1551 | + $path = Filesystem::normalizePath($this->fakeRoot.'/'.$path); |
|
| 1552 | 1552 | /** |
| 1553 | 1553 | * @var \OC\Files\Storage\Storage $storage |
| 1554 | 1554 | * @var string $internalPath |
@@ -1575,7 +1575,7 @@ discard block |
||
| 1575 | 1575 | * @return FileInfo[] |
| 1576 | 1576 | */ |
| 1577 | 1577 | public function search($query) { |
| 1578 | - return $this->searchCommon('search', array('%' . $query . '%')); |
|
| 1578 | + return $this->searchCommon('search', array('%'.$query.'%')); |
|
| 1579 | 1579 | } |
| 1580 | 1580 | |
| 1581 | 1581 | /** |
@@ -1626,10 +1626,10 @@ discard block |
||
| 1626 | 1626 | |
| 1627 | 1627 | $results = call_user_func_array(array($cache, $method), $args); |
| 1628 | 1628 | foreach ($results as $result) { |
| 1629 | - if (substr($mountPoint . $result['path'], 0, $rootLength + 1) === $this->fakeRoot . '/') { |
|
| 1629 | + if (substr($mountPoint.$result['path'], 0, $rootLength + 1) === $this->fakeRoot.'/') { |
|
| 1630 | 1630 | $internalPath = $result['path']; |
| 1631 | - $path = $mountPoint . $result['path']; |
|
| 1632 | - $result['path'] = substr($mountPoint . $result['path'], $rootLength); |
|
| 1631 | + $path = $mountPoint.$result['path']; |
|
| 1632 | + $result['path'] = substr($mountPoint.$result['path'], $rootLength); |
|
| 1633 | 1633 | $owner = \OC::$server->getUserManager()->get($storage->getOwner($internalPath)); |
| 1634 | 1634 | $files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner); |
| 1635 | 1635 | } |
@@ -1647,8 +1647,8 @@ discard block |
||
| 1647 | 1647 | if ($results) { |
| 1648 | 1648 | foreach ($results as $result) { |
| 1649 | 1649 | $internalPath = $result['path']; |
| 1650 | - $result['path'] = rtrim($relativeMountPoint . $result['path'], '/'); |
|
| 1651 | - $path = rtrim($mountPoint . $internalPath, '/'); |
|
| 1650 | + $result['path'] = rtrim($relativeMountPoint.$result['path'], '/'); |
|
| 1651 | + $path = rtrim($mountPoint.$internalPath, '/'); |
|
| 1652 | 1652 | $owner = \OC::$server->getUserManager()->get($storage->getOwner($internalPath)); |
| 1653 | 1653 | $files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner); |
| 1654 | 1654 | } |
@@ -1669,7 +1669,7 @@ discard block |
||
| 1669 | 1669 | public function getOwner($path) { |
| 1670 | 1670 | $info = $this->getFileInfo($path); |
| 1671 | 1671 | if (!$info) { |
| 1672 | - throw new NotFoundException($path . ' not found while trying to get owner'); |
|
| 1672 | + throw new NotFoundException($path.' not found while trying to get owner'); |
|
| 1673 | 1673 | } |
| 1674 | 1674 | return $info->getOwner()->getUID(); |
| 1675 | 1675 | } |
@@ -1703,7 +1703,7 @@ discard block |
||
| 1703 | 1703 | * @return string |
| 1704 | 1704 | */ |
| 1705 | 1705 | public function getPath($id) { |
| 1706 | - $id = (int)$id; |
|
| 1706 | + $id = (int) $id; |
|
| 1707 | 1707 | $manager = Filesystem::getMountManager(); |
| 1708 | 1708 | $mounts = $manager->findIn($this->fakeRoot); |
| 1709 | 1709 | $mounts[] = $manager->find($this->fakeRoot); |
@@ -1718,7 +1718,7 @@ discard block |
||
| 1718 | 1718 | $cache = $mount->getStorage()->getCache(); |
| 1719 | 1719 | $internalPath = $cache->getPathById($id); |
| 1720 | 1720 | if (is_string($internalPath)) { |
| 1721 | - $fullPath = $mount->getMountPoint() . $internalPath; |
|
| 1721 | + $fullPath = $mount->getMountPoint().$internalPath; |
|
| 1722 | 1722 | if (!is_null($path = $this->getRelativePath($fullPath))) { |
| 1723 | 1723 | return $path; |
| 1724 | 1724 | } |
@@ -1761,10 +1761,10 @@ discard block |
||
| 1761 | 1761 | } |
| 1762 | 1762 | |
| 1763 | 1763 | // note: cannot use the view because the target is already locked |
| 1764 | - $fileId = (int)$targetStorage->getCache()->getId($targetInternalPath); |
|
| 1764 | + $fileId = (int) $targetStorage->getCache()->getId($targetInternalPath); |
|
| 1765 | 1765 | if ($fileId === -1) { |
| 1766 | 1766 | // target might not exist, need to check parent instead |
| 1767 | - $fileId = (int)$targetStorage->getCache()->getId(dirname($targetInternalPath)); |
|
| 1767 | + $fileId = (int) $targetStorage->getCache()->getId(dirname($targetInternalPath)); |
|
| 1768 | 1768 | } |
| 1769 | 1769 | |
| 1770 | 1770 | // check if any of the parents were shared by the current owner (include collections) |
@@ -1864,7 +1864,7 @@ discard block |
||
| 1864 | 1864 | $resultPath = ''; |
| 1865 | 1865 | foreach ($parts as $part) { |
| 1866 | 1866 | if ($part) { |
| 1867 | - $resultPath .= '/' . $part; |
|
| 1867 | + $resultPath .= '/'.$part; |
|
| 1868 | 1868 | $result[] = $resultPath; |
| 1869 | 1869 | } |
| 1870 | 1870 | } |
@@ -2127,16 +2127,16 @@ discard block |
||
| 2127 | 2127 | public function getUidAndFilename($filename) { |
| 2128 | 2128 | $info = $this->getFileInfo($filename); |
| 2129 | 2129 | if (!$info instanceof \OCP\Files\FileInfo) { |
| 2130 | - throw new NotFoundException($this->getAbsolutePath($filename) . ' not found'); |
|
| 2130 | + throw new NotFoundException($this->getAbsolutePath($filename).' not found'); |
|
| 2131 | 2131 | } |
| 2132 | 2132 | $uid = $info->getOwner()->getUID(); |
| 2133 | 2133 | if ($uid != \OCP\User::getUser()) { |
| 2134 | 2134 | Filesystem::initMountPoints($uid); |
| 2135 | - $ownerView = new View('/' . $uid . '/files'); |
|
| 2135 | + $ownerView = new View('/'.$uid.'/files'); |
|
| 2136 | 2136 | try { |
| 2137 | 2137 | $filename = $ownerView->getPath($info['fileid']); |
| 2138 | 2138 | } catch (NotFoundException $e) { |
| 2139 | - throw new NotFoundException('File with id ' . $info['fileid'] . ' not found for user ' . $uid); |
|
| 2139 | + throw new NotFoundException('File with id '.$info['fileid'].' not found for user '.$uid); |
|
| 2140 | 2140 | } |
| 2141 | 2141 | } |
| 2142 | 2142 | return [$uid, $filename]; |
@@ -2153,7 +2153,7 @@ discard block |
||
| 2153 | 2153 | $directoryParts = array_filter($directoryParts); |
| 2154 | 2154 | foreach ($directoryParts as $key => $part) { |
| 2155 | 2155 | $currentPathElements = array_slice($directoryParts, 0, $key); |
| 2156 | - $currentPath = '/' . implode('/', $currentPathElements); |
|
| 2156 | + $currentPath = '/'.implode('/', $currentPathElements); |
|
| 2157 | 2157 | if ($this->is_file($currentPath)) { |
| 2158 | 2158 | return false; |
| 2159 | 2159 | } |