| @@ -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", | 
| @@ -706,7 +706,7 @@ discard block | ||
| 706 | 706 | } | 
| 707 | 707 | $postFix = (substr($path, -1) === '/') ? '/' : ''; | 
| 708 | 708 | $absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path)); | 
| 709 | - $mount = Filesystem::getMountManager()->find($absolutePath . $postFix); | |
| 709 | + $mount = Filesystem::getMountManager()->find($absolutePath.$postFix); | |
| 710 | 710 |  		if ($mount and $mount->getInternalPath($absolutePath) === '') { | 
| 711 | 711 | return $this->removeMount($mount, $absolutePath); | 
| 712 | 712 | } | 
| @@ -828,7 +828,7 @@ discard block | ||
| 828 | 828 | $this->renameUpdate($storage1, $storage2, $internalPath1, $internalPath2); | 
| 829 | 829 | } | 
| 830 | 830 | } | 
| 831 | -					} catch(\Exception $e) { | |
| 831 | +					} catch (\Exception $e) { | |
| 832 | 832 | throw $e; | 
| 833 | 833 |  					} finally { | 
| 834 | 834 | $this->changeLock($path1, ILockingProvider::LOCK_SHARED, true); | 
| @@ -852,7 +852,7 @@ discard block | ||
| 852 | 852 | } | 
| 853 | 853 | } | 
| 854 | 854 | } | 
| 855 | -			} catch(\Exception $e) { | |
| 855 | +			} catch (\Exception $e) { | |
| 856 | 856 | throw $e; | 
| 857 | 857 |  			} finally { | 
| 858 | 858 | $this->unlockFile($path1, ILockingProvider::LOCK_SHARED, true); | 
| @@ -986,7 +986,7 @@ discard block | ||
| 986 | 986 | $hooks[] = 'write'; | 
| 987 | 987 | break; | 
| 988 | 988 | default: | 
| 989 | -				\OCP\Util::writeLog('core', 'invalid mode (' . $mode . ') for ' . $path, ILogger::ERROR); | |
| 989 | +				\OCP\Util::writeLog('core', 'invalid mode ('.$mode.') for '.$path, ILogger::ERROR); | |
| 990 | 990 | } | 
| 991 | 991 | |
| 992 | 992 |  		if ($mode !== 'r' && $mode !== 'w') { | 
| @@ -1090,7 +1090,7 @@ discard block | ||
| 1090 | 1090 | array(Filesystem::signal_param_path => $this->getHookPath($path)) | 
| 1091 | 1091 | ); | 
| 1092 | 1092 | } | 
| 1093 | - list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix); | |
| 1093 | + list($storage, $internalPath) = Filesystem::resolvePath($absolutePath.$postFix); | |
| 1094 | 1094 |  			if ($storage) { | 
| 1095 | 1095 | return $storage->hash($type, $internalPath, $raw); | 
| 1096 | 1096 | } | 
| @@ -1144,7 +1144,7 @@ discard block | ||
| 1144 | 1144 | |
| 1145 | 1145 | $run = $this->runHooks($hooks, $path); | 
| 1146 | 1146 | /** @var \OC\Files\Storage\Storage $storage */ | 
| 1147 | - list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix); | |
| 1147 | + list($storage, $internalPath) = Filesystem::resolvePath($absolutePath.$postFix); | |
| 1148 | 1148 |  			if ($run and $storage) { | 
| 1149 | 1149 |  				if (in_array('write', $hooks) || in_array('delete', $hooks)) { | 
| 1150 | 1150 |  					try { | 
| @@ -1173,7 +1173,7 @@ discard block | ||
| 1173 | 1173 |  				if ($result && in_array('delete', $hooks) and $result) { | 
| 1174 | 1174 | $this->removeUpdate($storage, $internalPath); | 
| 1175 | 1175 | } | 
| 1176 | -				if ($result && in_array('write', $hooks,  true) && $operation !== 'fopen' && $operation !== 'touch') { | |
| 1176 | +				if ($result && in_array('write', $hooks, true) && $operation !== 'fopen' && $operation !== 'touch') { | |
| 1177 | 1177 | $this->writeUpdate($storage, $internalPath); | 
| 1178 | 1178 | } | 
| 1179 | 1179 |  				if ($result && in_array('touch', $hooks)) { | 
| @@ -1189,7 +1189,7 @@ discard block | ||
| 1189 | 1189 | $unlockLater = true; | 
| 1190 | 1190 | // make sure our unlocking callback will still be called if connection is aborted | 
| 1191 | 1191 | ignore_user_abort(true); | 
| 1192 | -					$result = CallbackWrapper::wrap($result, null, null, function () use ($hooks, $path) { | |
| 1192 | +					$result = CallbackWrapper::wrap($result, null, null, function() use ($hooks, $path) { | |
| 1193 | 1193 |  						if (in_array('write', $hooks)) { | 
| 1194 | 1194 | $this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE); | 
| 1195 | 1195 |  						} else if (in_array('read', $hooks)) { | 
| @@ -1250,7 +1250,7 @@ discard block | ||
| 1250 | 1250 | return true; | 
| 1251 | 1251 | } | 
| 1252 | 1252 | |
| 1253 | - return (strlen($fullPath) > strlen($defaultRoot)) && (substr($fullPath, 0, strlen($defaultRoot) + 1) === $defaultRoot . '/'); | |
| 1253 | + return (strlen($fullPath) > strlen($defaultRoot)) && (substr($fullPath, 0, strlen($defaultRoot) + 1) === $defaultRoot.'/'); | |
| 1254 | 1254 | } | 
| 1255 | 1255 | |
| 1256 | 1256 | /** | 
| @@ -1269,7 +1269,7 @@ discard block | ||
| 1269 | 1269 |  				if ($hook != 'read') { | 
| 1270 | 1270 | \OC_Hook::emit( | 
| 1271 | 1271 | Filesystem::CLASSNAME, | 
| 1272 | - $prefix . $hook, | |
| 1272 | + $prefix.$hook, | |
| 1273 | 1273 | array( | 
| 1274 | 1274 | Filesystem::signal_param_run => &$run, | 
| 1275 | 1275 | Filesystem::signal_param_path => $path | 
| @@ -1278,7 +1278,7 @@ discard block | ||
| 1278 | 1278 |  				} elseif (!$post) { | 
| 1279 | 1279 | \OC_Hook::emit( | 
| 1280 | 1280 | Filesystem::CLASSNAME, | 
| 1281 | - $prefix . $hook, | |
| 1281 | + $prefix.$hook, | |
| 1282 | 1282 | array( | 
| 1283 | 1283 | Filesystem::signal_param_path => $path | 
| 1284 | 1284 | ) | 
| @@ -1371,11 +1371,11 @@ discard block | ||
| 1371 | 1371 | return $this->getPartFileInfo($path); | 
| 1372 | 1372 | } | 
| 1373 | 1373 | $relativePath = $path; | 
| 1374 | - $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path); | |
| 1374 | + $path = Filesystem::normalizePath($this->fakeRoot.'/'.$path); | |
| 1375 | 1375 | |
| 1376 | 1376 | $mount = Filesystem::getMountManager()->find($path); | 
| 1377 | 1377 |  		if (!$mount) { | 
| 1378 | -			\OC::$server->getLogger()->warning('Mountpoint not found for path: ' . $path); | |
| 1378 | +			\OC::$server->getLogger()->warning('Mountpoint not found for path: '.$path); | |
| 1379 | 1379 | return false; | 
| 1380 | 1380 | } | 
| 1381 | 1381 | $storage = $mount->getStorage(); | 
| @@ -1403,7 +1403,7 @@ discard block | ||
| 1403 | 1403 | //add the sizes of other mount points to the folder | 
| 1404 | 1404 | $extOnly = ($includeMountPoints === 'ext'); | 
| 1405 | 1405 | $mounts = Filesystem::getMountManager()->findIn($path); | 
| 1406 | -					$info->setSubMounts(array_filter($mounts, function (IMountPoint $mount) use ($extOnly) { | |
| 1406 | +					$info->setSubMounts(array_filter($mounts, function(IMountPoint $mount) use ($extOnly) { | |
| 1407 | 1407 | $subStorage = $mount->getStorage(); | 
| 1408 | 1408 | return !($extOnly && $subStorage instanceof \OCA\Files_Sharing\SharedStorage); | 
| 1409 | 1409 | })); | 
| @@ -1412,7 +1412,7 @@ discard block | ||
| 1412 | 1412 | |
| 1413 | 1413 | return $info; | 
| 1414 | 1414 |  		} else { | 
| 1415 | -			\OC::$server->getLogger()->warning('Storage not valid for mountpoint: ' . $mount->getMountPoint()); | |
| 1415 | +			\OC::$server->getLogger()->warning('Storage not valid for mountpoint: '.$mount->getMountPoint()); | |
| 1416 | 1416 | } | 
| 1417 | 1417 | |
| 1418 | 1418 | return false; | 
| @@ -1459,12 +1459,12 @@ discard block | ||
| 1459 | 1459 | /** | 
| 1460 | 1460 | * @var \OC\Files\FileInfo[] $fileInfos | 
| 1461 | 1461 | */ | 
| 1462 | -			$fileInfos = array_map(function (ICacheEntry $content) use ($path, $storage, $mount, $sharingDisabled) { | |
| 1462 | +			$fileInfos = array_map(function(ICacheEntry $content) use ($path, $storage, $mount, $sharingDisabled) { | |
| 1463 | 1463 |  				if ($sharingDisabled) { | 
| 1464 | 1464 | $content['permissions'] = $content['permissions'] & ~\OCP\Constants::PERMISSION_SHARE; | 
| 1465 | 1465 | } | 
| 1466 | 1466 | $owner = $this->getUserObjectForOwner($storage->getOwner($content['path'])); | 
| 1467 | - return new FileInfo($path . '/' . $content['name'], $storage, $content['path'], $content, $mount, $owner); | |
| 1467 | + return new FileInfo($path.'/'.$content['name'], $storage, $content['path'], $content, $mount, $owner); | |
| 1468 | 1468 | }, $contents); | 
| 1469 | 1469 | $files = array_combine($fileNames, $fileInfos); | 
| 1470 | 1470 | |
| @@ -1489,7 +1489,7 @@ discard block | ||
| 1489 | 1489 |  						} catch (\Exception $e) { | 
| 1490 | 1490 | // sometimes when the storage is not available it can be any exception | 
| 1491 | 1491 | \OC::$server->getLogger()->logException($e, [ | 
| 1492 | - 'message' => 'Exception while scanning storage "' . $subStorage->getId() . '"', | |
| 1492 | + 'message' => 'Exception while scanning storage "'.$subStorage->getId().'"', | |
| 1493 | 1493 | 'level' => ILogger::ERROR, | 
| 1494 | 1494 | 'app' => 'lib', | 
| 1495 | 1495 | ]); | 
| @@ -1520,7 +1520,7 @@ discard block | ||
| 1520 | 1520 | $rootEntry['permissions'] = $permissions & (\OCP\Constants::PERMISSION_ALL - (\OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE)); | 
| 1521 | 1521 | } | 
| 1522 | 1522 | |
| 1523 | - $rootEntry['path'] = substr(Filesystem::normalizePath($path . '/' . $rootEntry['name']), strlen($user) + 2); // full path without /$user/ | |
| 1523 | + $rootEntry['path'] = substr(Filesystem::normalizePath($path.'/'.$rootEntry['name']), strlen($user) + 2); // full path without /$user/ | |
| 1524 | 1524 | |
| 1525 | 1525 | // if sharing was disabled for the user we remove the share permissions | 
| 1526 | 1526 |  							if (\OCP\Util::isSharingDisabledForUser()) { | 
| @@ -1528,14 +1528,14 @@ discard block | ||
| 1528 | 1528 | } | 
| 1529 | 1529 | |
| 1530 | 1530 |  							$owner = $this->getUserObjectForOwner($subStorage->getOwner('')); | 
| 1531 | - $files[$rootEntry->getName()] = new FileInfo($path . '/' . $rootEntry['name'], $subStorage, '', $rootEntry, $mount, $owner); | |
| 1531 | + $files[$rootEntry->getName()] = new FileInfo($path.'/'.$rootEntry['name'], $subStorage, '', $rootEntry, $mount, $owner); | |
| 1532 | 1532 | } | 
| 1533 | 1533 | } | 
| 1534 | 1534 | } | 
| 1535 | 1535 | } | 
| 1536 | 1536 | |
| 1537 | 1537 |  			if ($mimetype_filter) { | 
| 1538 | -				$files = array_filter($files, function (FileInfo $file) use ($mimetype_filter) { | |
| 1538 | +				$files = array_filter($files, function(FileInfo $file) use ($mimetype_filter) { | |
| 1539 | 1539 |  					if (strpos($mimetype_filter, '/')) { | 
| 1540 | 1540 | return $file->getMimetype() === $mimetype_filter; | 
| 1541 | 1541 |  					} else { | 
| @@ -1564,7 +1564,7 @@ discard block | ||
| 1564 | 1564 |  		if ($data instanceof FileInfo) { | 
| 1565 | 1565 | $data = $data->getData(); | 
| 1566 | 1566 | } | 
| 1567 | - $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path); | |
| 1567 | + $path = Filesystem::normalizePath($this->fakeRoot.'/'.$path); | |
| 1568 | 1568 | /** | 
| 1569 | 1569 | * @var \OC\Files\Storage\Storage $storage | 
| 1570 | 1570 | * @var string $internalPath | 
| @@ -1591,7 +1591,7 @@ discard block | ||
| 1591 | 1591 | * @return FileInfo[] | 
| 1592 | 1592 | */ | 
| 1593 | 1593 |  	public function search($query) { | 
| 1594 | -		return $this->searchCommon('search', array('%' . $query . '%')); | |
| 1594 | +		return $this->searchCommon('search', array('%'.$query.'%')); | |
| 1595 | 1595 | } | 
| 1596 | 1596 | |
| 1597 | 1597 | /** | 
| @@ -1642,10 +1642,10 @@ discard block | ||
| 1642 | 1642 | |
| 1643 | 1643 | $results = call_user_func_array(array($cache, $method), $args); | 
| 1644 | 1644 |  			foreach ($results as $result) { | 
| 1645 | -				if (substr($mountPoint . $result['path'], 0, $rootLength + 1) === $this->fakeRoot . '/') { | |
| 1645 | +				if (substr($mountPoint.$result['path'], 0, $rootLength + 1) === $this->fakeRoot.'/') { | |
| 1646 | 1646 | $internalPath = $result['path']; | 
| 1647 | - $path = $mountPoint . $result['path']; | |
| 1648 | - $result['path'] = substr($mountPoint . $result['path'], $rootLength); | |
| 1647 | + $path = $mountPoint.$result['path']; | |
| 1648 | + $result['path'] = substr($mountPoint.$result['path'], $rootLength); | |
| 1649 | 1649 | $owner = \OC::$server->getUserManager()->get($storage->getOwner($internalPath)); | 
| 1650 | 1650 | $files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner); | 
| 1651 | 1651 | } | 
| @@ -1663,8 +1663,8 @@ discard block | ||
| 1663 | 1663 |  					if ($results) { | 
| 1664 | 1664 |  						foreach ($results as $result) { | 
| 1665 | 1665 | $internalPath = $result['path']; | 
| 1666 | - $result['path'] = rtrim($relativeMountPoint . $result['path'], '/'); | |
| 1667 | - $path = rtrim($mountPoint . $internalPath, '/'); | |
| 1666 | + $result['path'] = rtrim($relativeMountPoint.$result['path'], '/'); | |
| 1667 | + $path = rtrim($mountPoint.$internalPath, '/'); | |
| 1668 | 1668 | $owner = \OC::$server->getUserManager()->get($storage->getOwner($internalPath)); | 
| 1669 | 1669 | $files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner); | 
| 1670 | 1670 | } | 
| @@ -1685,11 +1685,11 @@ discard block | ||
| 1685 | 1685 |  	public function getOwner($path) { | 
| 1686 | 1686 | $info = $this->getFileInfo($path); | 
| 1687 | 1687 |  		if (!$info) { | 
| 1688 | - throw new NotFoundException($path . ' not found while trying to get owner'); | |
| 1688 | + throw new NotFoundException($path.' not found while trying to get owner'); | |
| 1689 | 1689 | } | 
| 1690 | 1690 | |
| 1691 | 1691 |  		if ($info->getOwner() === null) { | 
| 1692 | - throw new NotFoundException($path . ' has no owner'); | |
| 1692 | + throw new NotFoundException($path.' has no owner'); | |
| 1693 | 1693 | } | 
| 1694 | 1694 | |
| 1695 | 1695 | return $info->getOwner()->getUID(); | 
| @@ -1724,7 +1724,7 @@ discard block | ||
| 1724 | 1724 | * @return string | 
| 1725 | 1725 | */ | 
| 1726 | 1726 |  	public function getPath($id) { | 
| 1727 | - $id = (int)$id; | |
| 1727 | + $id = (int) $id; | |
| 1728 | 1728 | $manager = Filesystem::getMountManager(); | 
| 1729 | 1729 | $mounts = $manager->findIn($this->fakeRoot); | 
| 1730 | 1730 | $mounts[] = $manager->find($this->fakeRoot); | 
| @@ -1746,7 +1746,7 @@ discard block | ||
| 1746 | 1746 | $cache = $mount->getStorage()->getCache(); | 
| 1747 | 1747 | $internalPath = $cache->getPathById($id); | 
| 1748 | 1748 |  				if (is_string($internalPath)) { | 
| 1749 | - $fullPath = $mount->getMountPoint() . $internalPath; | |
| 1749 | + $fullPath = $mount->getMountPoint().$internalPath; | |
| 1750 | 1750 |  					if (!is_null($path = $this->getRelativePath($fullPath))) { | 
| 1751 | 1751 | return $path; | 
| 1752 | 1752 | } | 
| @@ -1782,10 +1782,10 @@ discard block | ||
| 1782 | 1782 |  	private function targetIsNotShared(IStorage $targetStorage, string $targetInternalPath) { | 
| 1783 | 1783 | |
| 1784 | 1784 | // note: cannot use the view because the target is already locked | 
| 1785 | - $fileId = (int)$targetStorage->getCache()->getId($targetInternalPath); | |
| 1785 | + $fileId = (int) $targetStorage->getCache()->getId($targetInternalPath); | |
| 1786 | 1786 |  		if ($fileId === -1) { | 
| 1787 | 1787 | // target might not exist, need to check parent instead | 
| 1788 | - $fileId = (int)$targetStorage->getCache()->getId(dirname($targetInternalPath)); | |
| 1788 | + $fileId = (int) $targetStorage->getCache()->getId(dirname($targetInternalPath)); | |
| 1789 | 1789 | } | 
| 1790 | 1790 | |
| 1791 | 1791 | // check if any of the parents were shared by the current owner (include collections) | 
| @@ -1885,7 +1885,7 @@ discard block | ||
| 1885 | 1885 | $resultPath = ''; | 
| 1886 | 1886 |  		foreach ($parts as $part) { | 
| 1887 | 1887 |  			if ($part) { | 
| 1888 | - $resultPath .= '/' . $part; | |
| 1888 | + $resultPath .= '/'.$part; | |
| 1889 | 1889 | $result[] = $resultPath; | 
| 1890 | 1890 | } | 
| 1891 | 1891 | } | 
| @@ -2154,16 +2154,16 @@ discard block | ||
| 2154 | 2154 |  	public function getUidAndFilename($filename) { | 
| 2155 | 2155 | $info = $this->getFileInfo($filename); | 
| 2156 | 2156 |  		if (!$info instanceof \OCP\Files\FileInfo) { | 
| 2157 | - throw new NotFoundException($this->getAbsolutePath($filename) . ' not found'); | |
| 2157 | + throw new NotFoundException($this->getAbsolutePath($filename).' not found'); | |
| 2158 | 2158 | } | 
| 2159 | 2159 | $uid = $info->getOwner()->getUID(); | 
| 2160 | 2160 |  		if ($uid != \OCP\User::getUser()) { | 
| 2161 | 2161 | Filesystem::initMountPoints($uid); | 
| 2162 | -			$ownerView = new View('/' . $uid . '/files'); | |
| 2162 | +			$ownerView = new View('/'.$uid.'/files'); | |
| 2163 | 2163 |  			try { | 
| 2164 | 2164 | $filename = $ownerView->getPath($info['fileid']); | 
| 2165 | 2165 |  			} catch (NotFoundException $e) { | 
| 2166 | -				throw new NotFoundException('File with id ' . $info['fileid'] . ' not found for user ' . $uid); | |
| 2166 | +				throw new NotFoundException('File with id '.$info['fileid'].' not found for user '.$uid); | |
| 2167 | 2167 | } | 
| 2168 | 2168 | } | 
| 2169 | 2169 | return [$uid, $filename]; | 
| @@ -2180,7 +2180,7 @@ discard block | ||
| 2180 | 2180 | $directoryParts = array_filter($directoryParts); | 
| 2181 | 2181 |  		foreach ($directoryParts as $key => $part) { | 
| 2182 | 2182 | $currentPathElements = array_slice($directoryParts, 0, $key); | 
| 2183 | -			$currentPath = '/' . implode('/', $currentPathElements); | |
| 2183 | +			$currentPath = '/'.implode('/', $currentPathElements); | |
| 2184 | 2184 |  			if ($this->is_file($currentPath)) { | 
| 2185 | 2185 | return false; | 
| 2186 | 2186 | } |