Skip to content

Check for MariaDB 10.5+ binaries, fall back to MySQL versions#6316

Merged
swissspidy merged 2 commits into
wp-cli:mainfrom
todeveni:feature/mariadb-commands
May 14, 2026
Merged

Check for MariaDB 10.5+ binaries, fall back to MySQL versions#6316
swissspidy merged 2 commits into
wp-cli:mainfrom
todeveni:feature/mariadb-commands

Conversation

@todeveni

Copy link
Copy Markdown
Contributor

Fixes #6097

@todeveni todeveni requested a review from a team as a code owner May 12, 2026 12:33
@codecov

codecov Bot commented May 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 27.77778% with 13 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
php/utils.php 27.77% 13 Missing ⚠️

📢 Thoughts on this report? Let us know!

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the database command retrieval logic to prefer MariaDB-specific binaries (mariadb-dump and mariadb-check) when available, falling back to standard MySQL commands otherwise. The implementation includes static caching to avoid repeated system calls. Feedback suggests refactoring the duplicated detection logic into a single helper function to adhere to DRY principles and improve maintainability.

Comment thread php/utils.php

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates WP-CLI’s SQL helper utilities to better support MariaDB installations where the newer MariaDB-specific client binaries (introduced in MariaDB 10.5+) may not be present, addressing issue #6097.

Changes:

  • Update get_sql_dump_command() to prefer mariadb-dump on MariaDB, with a fallback to mysqldump when not available.
  • Update get_sql_check_command() to prefer mariadb-check on MariaDB, with a fallback to mysqlcheck when not available.
  • Cache the detected command in each helper to avoid repeated lookups.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread php/utils.php
Comment thread php/utils.php
Comment thread php/utils.php
@swissspidy swissspidy added this to the 3.0.0 milestone May 14, 2026
@swissspidy swissspidy merged commit 230ed78 into wp-cli:main May 14, 2026
72 of 73 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mariadb less then 10.5 command detection

3 participants