private function updateFilePermissions(ConnectionAdapterInterface $connection, $releasePath, $path, $pathSettings)
    {
        $path = $releasePath.'/'.$path;

        if (isset($pathSettings['permissions']) === false) {
            return false;
        }

        $permissions = FilePermissionCalculator::fromStringRepresentation(str_pad($pathSettings['permissions'], 10, '-'))->getMode();

        $recursive = false;
        if (isset($pathSettings['recursive'])) {
            $recursive = $pathSettings['recursive'];
        }

        return $connection->changePermissions($path, $permissions, $recursive);
    }