[2.x] fix: normalize database version strings in admin dashboard#4466
Merged
[2.x] fix: normalize database version strings in admin dashboard#4466
Conversation
MySQL/MariaDB's version() includes distribution suffixes like "-MariaDB-0+deb12u2", and PostgreSQL's version() returns a full platform description. Trim these to display clean version numbers. - MySQL/MariaDB: strip everything after the first "-" - PostgreSQL: use SHOW server_version instead of SELECT version(), which returns a clean semver string without platform info - SQLite: unchanged (already returns a clean version)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The admin dashboard Status widget displays database versions inconsistently:
version()returns10.11.14-MariaDB-0+deb12u2— the distribution suffix is noisy and redundant given the driver label already says "MariaDB"version()returns a full platform string likePostgreSQL 15.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 12.2.0, 64-bit— far too verbose for a status widgetversion()can include distro suffixes like8.0.32-0ubuntu0.20.04.1sqlite_version()already returns a clean3.45.0— no change neededFix
-onwards viaStr::before()SELECT version()toSHOW server_version, which returns a clean version string (e.g.15.3), consistent with what the installer already uses inConnectToDatabaseResult
10.11.14-MariaDB-0+deb12u210.11.14PostgreSQL 15.3 on x86_64-pc-linux-gnu, compiled by...15.38.0.32-0ubuntu0.20.04.18.0.323.45.03.45.0