Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use new util
  • Loading branch information
swissspidy committed Mar 28, 2025
commit bdc03d7a310585f726a66577db33eb5bc613ed88
26 changes: 4 additions & 22 deletions src/DB_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public function check( $_, $assoc_args ) {

$command = sprintf(
'/usr/bin/env %s%s %s',
$this->get_check_command(),
Utils\get_sql_check_command(),
$this->get_defaults_flag_string( $assoc_args ),
'%s'
);
Expand Down Expand Up @@ -300,7 +300,7 @@ public function check( $_, $assoc_args ) {
public function optimize( $_, $assoc_args ) {
$command = sprintf(
'/usr/bin/env %s%s %s',
$this->get_check_command(),
Utils\get_sql_check_command(),
$this->get_defaults_flag_string( $assoc_args ),
'%s'
);
Expand Down Expand Up @@ -348,7 +348,7 @@ public function optimize( $_, $assoc_args ) {
public function repair( $_, $assoc_args ) {
$command = sprintf(
'/usr/bin/env %s%s %s',
$this->get_check_command(),
Utils\get_sql_check_command(),
$this->get_defaults_flag_string( $assoc_args ),
'%s'
);
Expand Down Expand Up @@ -650,7 +650,7 @@ public function export( $args, $assoc_args ) {
$assoc_args['result-file'] = $result_file;
}

$mysqldump_binary = Utils\force_env_on_nix_systems( $this->get_dump_command() );
$mysqldump_binary = Utils\force_env_on_nix_systems( Utils\get_sql_dump_command() );

$support_column_statistics = exec( $mysqldump_binary . ' --help | grep "column-statistics"' );

Expand Down Expand Up @@ -2207,22 +2207,4 @@ protected function get_current_sql_modes( $assoc_args ) {
private function get_mysql_command() {
return 'mariadb' === Utils\get_db_type() ? 'mariadb' : 'mysql';
}

/**
* Returns the correct `check` command based on the detected database type.
*
* @return string The appropriate check command.
*/
private function get_check_command() {
return 'mariadb' === Utils\get_db_type() ? 'mariadb-check' : 'mysqlcheck';
}

/**
* Returns the correct `dump` command based on the detected database type.
*
* @return string The appropriate dump command.
*/
private function get_dump_command() {
return 'mariadb' === Utils\get_db_type() ? 'mariadb-dump' : 'mysqldump';
}
}