Add PostgreSQL and Percona Server detection
- Add PostgreSQL detection via psql command * Detects version from psql --version * Sets SYS_DB_TYPE="postgresql" - Add Percona Server detection as MySQL variant * Checks for 'Percona' in mysql --version output * Sets SYS_DB_TYPE="percona" * Distinguishes from standard MySQL and MariaDB Impact: Toolkit now supports three database types: - MySQL (traditional) - MariaDB (drop-in replacement) - Percona Server (high-performance variant) - PostgreSQL (RDBMS alternative) Makes toolkit compatible with broader range of server configurations.
This commit is contained in:
+15
-1
@@ -203,6 +203,7 @@ detect_web_server() {
|
|||||||
detect_database() {
|
detect_database() {
|
||||||
[ -n "$SYS_DETECTION_COMPLETE" ] || print_info "Detecting database server..."
|
[ -n "$SYS_DETECTION_COMPLETE" ] || print_info "Detecting database server..."
|
||||||
|
|
||||||
|
# Check for MySQL/MariaDB/Percona
|
||||||
if command_exists mysql; then
|
if command_exists mysql; then
|
||||||
local version_output=$(mysql --version 2>/dev/null)
|
local version_output=$(mysql --version 2>/dev/null)
|
||||||
|
|
||||||
@@ -210,6 +211,10 @@ detect_database() {
|
|||||||
SYS_DB_TYPE="mariadb"
|
SYS_DB_TYPE="mariadb"
|
||||||
SYS_DB_VERSION=$(echo "$version_output" | grep -oP '\d+\.\d+\.\d+' | head -1)
|
SYS_DB_VERSION=$(echo "$version_output" | grep -oP '\d+\.\d+\.\d+' | head -1)
|
||||||
print_success "Detected MariaDB ${SYS_DB_VERSION}"
|
print_success "Detected MariaDB ${SYS_DB_VERSION}"
|
||||||
|
elif echo "$version_output" | grep -qi "percona"; then
|
||||||
|
SYS_DB_TYPE="percona"
|
||||||
|
SYS_DB_VERSION=$(echo "$version_output" | grep -oP '\d+\.\d+\.\d+' | head -1)
|
||||||
|
print_success "Detected Percona Server ${SYS_DB_VERSION}"
|
||||||
else
|
else
|
||||||
SYS_DB_TYPE="mysql"
|
SYS_DB_TYPE="mysql"
|
||||||
SYS_DB_VERSION=$(echo "$version_output" | grep -oP '\d+\.\d+\.\d+' | head -1)
|
SYS_DB_VERSION=$(echo "$version_output" | grep -oP '\d+\.\d+\.\d+' | head -1)
|
||||||
@@ -218,8 +223,17 @@ detect_database() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check for PostgreSQL
|
||||||
|
if command_exists psql; then
|
||||||
|
local version_output=$(psql --version 2>/dev/null)
|
||||||
|
SYS_DB_TYPE="postgresql"
|
||||||
|
SYS_DB_VERSION=$(echo "$version_output" | grep -oP '\d+\.\d+' | head -1)
|
||||||
|
print_success "Detected PostgreSQL ${SYS_DB_VERSION}"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
SYS_DB_TYPE="none"
|
SYS_DB_TYPE="none"
|
||||||
print_warning "No MySQL/MariaDB detected"
|
print_warning "No MySQL/MariaDB/PostgreSQL detected"
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user