-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
[3.x] Allow to specify port number or UNIX socket in host option also for MySQL (PDO) and PostgreSQL (PDO) #310
[3.x] Allow to specify port number or UNIX socket in host option also for MySQL (PDO) and PostgreSQL (PDO) #310
Conversation
Extract host and port number or socket name from host option for mysql and pgsql drivers
i've tested successfully with a non standard port with pgsql |
@alikon Thanks a lot, that’s much appreciated. Could you also test with MySQLi and MySQL (PDO if that still works? That would be really great. |
yes they still works like before with or without port, standard or not |
Thanks @alikon for testing. Would be good if @muhme could test with his docker scenario and if the changes for the system tests proposed with CMS PR joomla/joomla-cms#43968 work with the changes from this PR here. |
First test with PostgreSQL (PDO) using host.docker.internal:7013 was ✅ 👍 😄 I'll continue testing ... As this was my 1st time I tested Joomla Framework Database, here are the steps after cloning
|
Edited: There is nothing wrong with #33 - only the hack for 33 in JBT is to fix. Tested all five variants mariadb, mariadbi, mysql, mysqli and pgsql with Joomla 5.3-dev + this PR #310 + joomla-projects/joomla-cypress#33 + joomla/joomla-cms#43968 + hacked version of JBT which is using
Note: With this PR #310 we have host:port in Joomla backend, Web Installer and I'll continue with IPv6 tests ... |
thanks |
Thanks for merging and thanks to all testers and reviewers. |
I continued testing and as warm-up I tested simple IPv6 addresses for database host. Warming-up environment is 5.3-dev, without this #310 and with joomla-projects/joomla-cypress#33 (irrelevant, but already included) and joomla-projects/joomla-cypress#36 (mandataroy, new created for this test). I found that square brackets are mandatory for IPv6 addresses when using MariaDB and MySQL (MySQLi or DBO) drivers, even without specifying a port. However, square brackets do not work with the PostgreSQL driver. The Joomla Web Installer simply passes this through without modification. Tested successfully with joomla-projects/joomla-cypress#36 all five database variants by editing
Now, I'm going to test this PR #310 with IPv6 addresses only and IPv6 addresses with port number ... |
IPv6 addresses are working with PostgreSQL in installation step (PHP driver), but I have to correct myself, IPv6 addresses are not working with PostgreSQL in Cypress custom database command (with JavaScript module |
Still testing without this #310 PR – now IPv6 addresses with port numbers – to see the problem. Test env is 5.3-dev + joomla-projects/joomla-cypress#33 (irrelevant, but already included) + joomla-projects/joomla-cypress#36 (mandatory, new created for this test) + using pg module. (To ensure not using default database server port running e.g.
Tested sucessfully MariaDB and MySQL (MySQLi and DBO) drivers with Joomla Web Installaler and System Tests (with the new System Tests for PostgreSQL with
PostgreSQL with Joomla Web Installer (PHP) is not running. Verified with and without square brackets : Next is to test this PR #310 with IPv6 addresses and port numbers ... |
I still have one more test without this #310 PR – now sockets. Test env JBT:
Web Installation fails for all five database variants: In Joomla web server container
Also System Tests for four database variants are failing (after installation via host):
The only one working is PostgreSQL (PDO) with the new The results are poor; am I doing something wrong? Could someone please re-check one database variant with a Unix socket in their own installation using the Joomla Web Installer? |
Yes, needed format prefix for using sockets is Therefore without this #310 PR – sockets are working for: mariadb ✅, mariadbi ✅, mysql ✅, mysqli ✅, pgsql (with today postgres driver) ✅ and pgsql (with new pg driver) ✅ in Joomla Web Installer running from Cypress System Tests. But not working for System Tests with custom database commands (error e.g. So, I am now ready to test this PR 😅 |
7 test cases x 5 database variants (mysqli, mysql, mariadbi, mariadb and pgsql) = 35 Joomla installations Based on https://github.com/muhme/joomla-cms/tree/pg-for-postgres + this PR #310 + joomla-projects/joomla-cypress#33 + joomla-projects/joomla-cypress#36 + joomla/joomla-cms#43968 Running Joomla installation
Verified from Joomla web server container, command line client access is possible:
Out of scope of this PR: parallel tested one spec with custom database commands
|
Pull Request for CMS Issue joomla/joomla-cms#43902 .
Summary of Changes
This pull request (PR) makes it possible to specify a port number or UNIX socket in the host option for MySQL (PDO) and PostgreSQL (PDO) drivers in the same way as it is already possible for the MySQLi driver.
All these drivers already allow to specify a port number or a UNIX socket name with separate options.
But the CMS does not use these parameters. It does not have any fields in the configuration or installation form for that. Instead of that, it allows to append a port number to the host name separated by a colon, or to specify a UNIX socket with the
host
parameter.The MySQLi driver contains code in its connect method to extract the port number or UNIX socket from the
host
parameter if that parameter contains one of these.The MySQL (PDO) and PostgreSQL (PDO) drivers don't have such code.
It seems that for the MySQL (PDO) this is not a problem and it can handle such a
host
string as it is.But the PostgreSQL (PDO) driver doesn't work with that, see the referred CMS issue.
This PR moves the code for extracting the port number or UNIX socket from the MySQLi driver's connect method to a new method in the base database driver so it can be used by any kind of database driver. The default port number is passed as a parameter to that method.
The PDO driver is changed so that it uses the new method for the MySQL (PDO) and PostgreSQL (PDO) drivers.
So it should work the same way for all database drivers used by the CMS: If the
host
option specifies a port number or UNIX socket, the port number or socket name from thehost
option are used (and override the corresponding parameters), otherwise port number or socket name from the options are used, if given, or the default port if nothing is given.Testing Instructions
See CMS issue joomla/joomla-cms#43902 .
Documentation Changes Required
None.