Skip to content

Update CouchBase driver connection function with new couchbase PHP SDK 2.4 #599

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

git-webmaster
Copy link
Contributor

Port and bucket passwords are no longer required as of CouchBase 5.0, and old connection code is not working due to the new authentification model.

I am using this code right now with new CouchBase server 5.1.0.

It is still possible to use "$port" in configuration array (despite it is no longer required), i leave a check for it - maybe will be useful in some non-standart environment.

Some links:
https://developer.couchbase.com/documentation/server/current/sdk/php/start-using-sdk.html

Andrey Voronin added 2 commits May 18, 2018 01:50
@Geolim4
Copy link
Member

Geolim4 commented May 17, 2018

Hello @git-webmaster

Thanks you for the contribution but I would prefer to make the pull request to the V7 rather than the "final" branch to preserve backward compatibility as Phpfastcache is Semver compliant ;)

However you can add a notice in the driver class in the "final" branch to warn the users about this deprecations.

Much appreciated,
Cheers,
Georges

@git-webmaster
Copy link
Contributor Author

git-webmaster commented May 17, 2018

Hello @Geolim4
Sorry, not sure if i get you right - you want me to make some changes, or make a pull request to another branch?

Thanks.

@Geolim4
Copy link
Member

Geolim4 commented May 17, 2018

Make a new pull request to the V7 with those changes (please test it carefully), the V7 being almost production ready it's not too late to apply this fix right now.

The V6 (final) is now freezed to preserve backward compatibility.
So I would close this actual pull request and made a new one to the v7 with the right changes.

You can still make another PR to the v6 if you want with the only purpose to warn user about this deprecated behavior.

@git-webmaster
Copy link
Contributor Author

Ok, i will make new PR.
I am using this exact code right now in production on https://unilocal.net with new CouchBase server 5.1.0, so it is fairly tested.

@Geolim4
Copy link
Member

Geolim4 commented May 17, 2018

Good thing, I do love fairly tested code, thanks you for your contribution <3

@git-webmaster
Copy link
Contributor Author

git-webmaster commented May 17, 2018

Looks like you have changed the driver for CouchBase in V7.
And i think that MAYBE your new code will not work with CouchBase 5.

Example:

you use
$authenticator = new \Couchbase\ClassicAuthenticator();

According to url:
https://forums.couchbase.com/t/how-to-connect-to-the-server-correctly/13956

This will not work with CouchBase 5 and you have to use

$authenticator = new \Couchbase\PasswordAuthenticator();, which i also use.

Also, you use this approach:

            $authenticator = new \Couchbase\ClassicAuthenticator();
            $authenticator->cluster($clientConfig->getUsername(), $clientConfig->getPassword());
            //$authenticator->bucket('protected', 'secret');
            $this->instance->authenticate($authenticator);

while i use this:

            $authenticator = new \Couchbase\PasswordAuthenticator();
            $authenticator->username($username)->password($password);
            $cluster = new CouchbaseClient("couchbase://" . $host); 
            $cluster->authenticate($authenticator);
            $this->instance = $this->instance ?: $cluster;

Unfortunatly, i am not able to test that new code you have, because i have different one and not allowed to break things on my side, so i think that PR with my code is no longer required.

If you wish, i may change this connection function to new SDK, but this changes will not be tested.

@Geolim4
Copy link
Member

Geolim4 commented May 18, 2018

Then, don't PR now, you can do it someday when you will upgrade your code.
Don't you have a "test" server on your hand where I can test that ?
I burned my Vagrant box that was my one and only Couchbase server :(

@git-webmaster
Copy link
Contributor Author

git-webmaster commented May 18, 2018

Good morning @Geolim4

Here is the new 2 GB RAM Linode i just ordered:

172.104.xxx.xxx
root:xxxxxx

It has CouchBase Enterprise Edition 5.1.0 build 5552, apache2 mod_php , php 7.2 with composer installed.

Web root is /var/www/html

Test file with couchbase connection and credentials: http://172.104.xxx.xxx/cb.php

Couchbase admin is at: http://172.104..xxx.xxx:8091 login:xxx same.

Feel free to do anything you need with this box.

When you finish testing - please let me know, i will delete this linode in order not to waste money :)

@Geolim4
Copy link
Member

Geolim4 commented May 18, 2018

Hello,

Can you send me all the sensitive information at "contact [nospam] geolim4.com" please ?

Thanks you very much for providing me such resources !

Cheers,
Georges

@git-webmaster
Copy link
Contributor Author

Sent you a mail.
No problem, im really enjoying your software and hope to see V7 to be released soon :)

Thank you.

@Geolim4
Copy link
Member

Geolim4 commented May 18, 2018

I will probably begin my tests this weekend or in the very beginning of the next week, thanks.

Geolim4 added a commit that referenced this pull request May 19, 2018
@Geolim4
Copy link
Member

Geolim4 commented May 19, 2018

I just made the V7 update, hope it'll work on the first shoot :P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants