Skip to content
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

MariaDB version not displayed correctly #11934

Open
christine-kaminski opened this issue Aug 4, 2017 · 5 comments
Open

MariaDB version not displayed correctly #11934

christine-kaminski opened this issue Aug 4, 2017 · 5 comments

Comments

@christine-kaminski
Copy link

We are using Piwik vs 3.0.2 on CentOS 7 with MariaDB 10.0.31. It works fine so far. Unfortunately the system information in the settings show MySQL 5.5.5 instead. Though Piwik and PHP version are displayed correctly. Any idea how to fix this?

@christine-kaminski
Copy link
Author

piwik

@mneudert
Copy link
Member

mneudert commented Aug 4, 2017

tl;dr: The version you are seeing is not "wrong".

You could set a custom version string from MariaDB 10.2.6 onwards (see here) but not earlier. And just fixing the version displayed might break other things yet to be known...

As long as MariaDB stays reasonably compatible with MySQL there should be no problems.


In detail this is a result of how MariaDB reports it's version. Take for example the following code:

$db = new PDO('mysql:host=127.0.0.1', 'root', 'password');
echo $db->getAttribute(PDO::ATTR_SERVER_VERSION);

If you execute this on your server in an interactive PHP shell (php -a) you should receive something like 5.5.5-10.0.31-MariaDB (an Ubuntu 16.04 installation I just looked this up in returned 5.5.5-10.0.29-MariaDB-0ubuntu0.16.04.1).

After receiving this value the underlying Zend_Db_Adapter_Pdo_Abstract extracts and returns (see here) just the first part of it. That is where your 5.5.5 is coming from.

Even further down the rabbit hole you see the MariaDB source code with an explanation (see here) about why they did that. Also mentioning they manually patched their clients to just strip this version from getting printed.

@sgiehl
Copy link
Member

sgiehl commented Aug 6, 2017

@mneudert do you think there is something we could improve in version detection for MariaDB? Or would that require changes to Zend_Db_Adapter_Pdo_Abstract?

@mneudert
Copy link
Member

mneudert commented Aug 6, 2017

As modifying external libraries is always a bad idea the most promising change seems be extending Piwik\Db\Adapter\Pdo\Mysql with something like a getRawServerVersion.

Changing getServerVersion would mess with the version requirement checks as we would not compare a "MySQL compatibility promise" but a totally different versioning scheme.

Having a custom display version could provide something really specific like MariaDB 10.0.2 (MySQL 5.5.5 compatible).

@christine-kaminski
Copy link
Author

Thanks guys!

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

No branches or pull requests

4 participants