@@ -286,9 +286,14 @@ public function check( $_, $assoc_args ) {
286286 return ;
287287 }
288288
289+ $ check_command = Utils \get_sql_check_command ();
290+ if ( '' === $ check_command ) {
291+ WP_CLI ::error ( 'The mysqlcheck or mariadb-check binary is not available. ' );
292+ }
293+
289294 $ command = sprintf (
290- '/usr/bin/env %s%s %s ' ,
291- Utils \get_sql_check_command () ,
295+ '%s%s %s ' ,
296+ $ check_command ,
292297 $ this ->get_defaults_flag_string ( $ assoc_args ),
293298 '%s '
294299 );
@@ -347,9 +352,14 @@ public function optimize( $_, $assoc_args ) {
347352 return ;
348353 }
349354
355+ $ check_command = Utils \get_sql_check_command ();
356+ if ( '' === $ check_command ) {
357+ WP_CLI ::error ( 'The mysqlcheck or mariadb-check binary is not available. ' );
358+ }
359+
350360 $ command = sprintf (
351- '/usr/bin/env %s%s %s ' ,
352- Utils \get_sql_check_command () ,
361+ '%s%s %s ' ,
362+ $ check_command ,
353363 $ this ->get_defaults_flag_string ( $ assoc_args ),
354364 '%s '
355365 );
@@ -408,9 +418,14 @@ public function repair( $_, $assoc_args ) {
408418 return ;
409419 }
410420
421+ $ check_command = Utils \get_sql_check_command ();
422+ if ( '' === $ check_command ) {
423+ WP_CLI ::error ( 'The mysqlcheck or mariadb-check binary is not available. ' );
424+ }
425+
411426 $ command = sprintf (
412- '/usr/bin/env %s%s %s ' ,
413- Utils \get_sql_check_command () ,
427+ '%s%s %s ' ,
428+ $ check_command ,
414429 $ this ->get_defaults_flag_string ( $ assoc_args ),
415430 '%s '
416431 );
@@ -756,7 +771,12 @@ public function export( $args, $assoc_args ) {
756771 $ assoc_args ['result-file ' ] = $ result_file ;
757772 }
758773
759- $ mysqldump_binary = Utils \force_env_on_nix_systems ( Utils \get_sql_dump_command () );
774+ $ dump_command = Utils \get_sql_dump_command ();
775+ if ( '' === $ dump_command ) {
776+ WP_CLI ::error ( 'The mysqldump or mariadb-dump binary is not available. ' );
777+ }
778+
779+ $ mysqldump_binary = $ dump_command ;
760780
761781 $ support_column_statistics = $ this ->command_supports_option ( $ mysqldump_binary , 'column-statistics ' );
762782
0 commit comments