Skip to content

Commit e4abe55

Browse files
committed
Partial revert
1 parent 70fc73b commit e4abe55

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/DB_Command.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ public function cli( $_, $assoc_args ) {
399399

400400
$command = sprintf(
401401
'%s%s --no-auto-rehash',
402-
Utils\get_mysql_binary_path(),
402+
$this->get_mysql_command(),
403403
$this->get_defaults_flag_string( $assoc_args )
404404
);
405405
WP_CLI::debug( "Running shell command: {$command}", 'db' );
@@ -502,7 +502,7 @@ public function query( $args, $assoc_args ) {
502502

503503
$command = sprintf(
504504
'%s%s --no-auto-rehash',
505-
Utils\get_mysql_binary_path(),
505+
$this->get_mysql_command(),
506506
$this->get_defaults_flag_string( $assoc_args )
507507
);
508508
WP_CLI::debug( "Running shell command: {$command}", 'db' );
@@ -741,7 +741,7 @@ private function get_posts_table_charset( $assoc_args ) {
741741
list( $stdout, $stderr, $exit_code ) = self::run(
742742
sprintf(
743743
'%s%s --no-auto-rehash --batch --skip-column-names',
744-
Utils\get_mysql_binary_path(),
744+
$this->get_mysql_command(),
745745
$this->get_defaults_flag_string( $assoc_args )
746746
),
747747
[ 'execute' => $query ],
@@ -830,7 +830,7 @@ public function import( $args, $assoc_args ) {
830830

831831
$command = sprintf(
832832
'%s%s --no-auto-rehash',
833-
Utils\get_mysql_binary_path(),
833+
$this->get_mysql_command(),
834834
$this->get_defaults_flag_string( $assoc_args )
835835
);
836836
WP_CLI::debug( "Running shell command: {$command}", 'db' );
@@ -1766,7 +1766,7 @@ protected function run_query( $query, $assoc_args = [] ) {
17661766
self::run(
17671767
sprintf(
17681768
'%s%s --no-auto-rehash',
1769-
Utils\get_mysql_binary_path(),
1769+
$this->get_mysql_command(),
17701770
$this->get_defaults_flag_string( $assoc_args )
17711771
),
17721772
array_merge( [ 'execute' => $query ], $mysql_args )
@@ -2167,7 +2167,7 @@ protected function get_current_sql_modes( $assoc_args ) {
21672167
list( $stdout, $stderr, $exit_code ) = self::run(
21682168
sprintf(
21692169
'%s%s --no-auto-rehash --batch --skip-column-names',
2170-
Utils\get_mysql_binary_path(),
2170+
$this->get_mysql_command(),
21712171
$this->get_defaults_flag_string( $assoc_args )
21722172
),
21732173
array_merge( $args, [ 'execute' => 'SELECT @@SESSION.sql_mode' ] ),
@@ -2199,6 +2199,15 @@ protected function get_current_sql_modes( $assoc_args ) {
21992199
return $modes;
22002200
}
22012201

2202+
/**
2203+
* Returns the correct `mysql` command based on the detected database type.
2204+
*
2205+
* @return string The appropriate check command.
2206+
*/
2207+
private function get_mysql_command() {
2208+
return 'mariadb' === Utils\get_db_type() ? 'mariadb' : 'mysql';
2209+
}
2210+
22022211
/**
22032212
* Returns the correct `check` command based on the detected database type.
22042213
*

0 commit comments

Comments
 (0)