@@ -472,8 +472,8 @@ public function cli( $_, $assoc_args ) {
472472 }
473473
474474 $ command = sprintf (
475- '/usr/bin/env %s%s --no-auto-rehash ' ,
476- $ this -> get_mysql_command (),
475+ '%s%s --no-auto-rehash ' ,
476+ Utils \get_mysql_binary_path (),
477477 $ this ->get_defaults_flag_string ( $ assoc_args )
478478 );
479479 WP_CLI ::debug ( "Running shell command: {$ command }" , 'db ' );
@@ -593,8 +593,8 @@ public function query( $args, $assoc_args ) {
593593 }
594594
595595 $ command = sprintf (
596- '/usr/bin/env %s%s --no-auto-rehash ' ,
597- $ this -> get_mysql_command (),
596+ '%s%s --no-auto-rehash ' ,
597+ Utils \get_mysql_binary_path (),
598598 $ this ->get_defaults_flag_string ( $ assoc_args )
599599 );
600600 WP_CLI ::debug ( "Running shell command: {$ command }" , 'db ' );
@@ -837,7 +837,7 @@ private function get_posts_table_charset( $assoc_args ) {
837837 list ( $ stdout , $ stderr , $ exit_code ) = self ::run (
838838 sprintf (
839839 '%s%s --no-auto-rehash --batch --skip-column-names ' ,
840- $ this -> get_mysql_command (),
840+ Utils \get_mysql_binary_path (),
841841 $ this ->get_defaults_flag_string ( $ assoc_args )
842842 ),
843843 [ 'execute ' => $ query ],
@@ -945,8 +945,8 @@ public function import( $args, $assoc_args ) {
945945 }
946946
947947 $ command = sprintf (
948- '/usr/bin/env %s%s --no-auto-rehash ' ,
949- $ this -> get_mysql_command (),
948+ '%s%s --no-auto-rehash ' ,
949+ Utils \get_mysql_binary_path (),
950950 $ this ->get_defaults_flag_string ( $ assoc_args )
951951 );
952952 WP_CLI ::debug ( "Running shell command: {$ command }" , 'db ' );
@@ -1939,7 +1939,7 @@ protected function run_query( $query, $assoc_args = [] ) {
19391939 self ::run (
19401940 sprintf (
19411941 '%s%s --no-auto-rehash ' ,
1942- $ this -> get_mysql_command (),
1942+ Utils \get_mysql_binary_path (),
19431943 $ this ->get_defaults_flag_string ( $ assoc_args )
19441944 ),
19451945 array_merge ( [ 'execute ' => $ query ], $ mysql_args )
@@ -2360,7 +2360,7 @@ protected function get_current_sql_modes( $assoc_args ) {
23602360 list ( $ stdout , $ stderr , $ exit_code ) = self ::run (
23612361 sprintf (
23622362 '%s%s --no-auto-rehash --batch --skip-column-names ' ,
2363- $ this -> get_mysql_command (),
2363+ Utils \get_mysql_binary_path (),
23642364 $ this ->get_defaults_flag_string ( $ assoc_args )
23652365 ),
23662366 array_merge ( $ args , [ 'execute ' => 'SELECT @@SESSION.sql_mode ' ] ),
@@ -2388,13 +2388,4 @@ protected function get_current_sql_modes( $assoc_args ) {
23882388
23892389 return $ modes ;
23902390 }
2391-
2392- /**
2393- * Returns the correct `mysql` command based on the detected database type.
2394- *
2395- * @return string The appropriate check command.
2396- */
2397- private function get_mysql_command () {
2398- return 'mariadb ' === Utils \get_db_type () ? 'mariadb ' : 'mysql ' ;
2399- }
24002391}
0 commit comments