Skip to content

Commit 1c6f7f4

Browse files
committed
Test with framework changes
1 parent ef928ea commit 1c6f7f4

File tree

2 files changed

+14
-23
lines changed

2 files changed

+14
-23
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
}
1313
],
1414
"require": {
15-
"wp-cli/wp-cli": "^2.12"
15+
"wp-cli/wp-cli": "dev-try/mariadb-detection as 2.12"
1616
},
1717
"require-dev": {
1818
"wp-cli/entity-command": "^1.3 || ^2",

src/DB_Command.php

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,8 @@ public function repair( $_, $assoc_args ) {
398398
public function cli( $_, $assoc_args ) {
399399

400400
$command = sprintf(
401-
'/usr/bin/env %s%s --no-auto-rehash',
402-
$this->get_mysql_command(),
401+
'%s%s --no-auto-rehash',
402+
Utils\get_mysql_binary_path(),
403403
$this->get_defaults_flag_string( $assoc_args )
404404
);
405405
WP_CLI::debug( "Running shell command: {$command}", 'db' );
@@ -501,8 +501,8 @@ public function cli( $_, $assoc_args ) {
501501
public function query( $args, $assoc_args ) {
502502

503503
$command = sprintf(
504-
'/usr/bin/env %s%s --no-auto-rehash',
505-
$this->get_mysql_command(),
504+
'%s%s --no-auto-rehash',
505+
Utils\get_mysql_binary_path(),
506506
$this->get_defaults_flag_string( $assoc_args )
507507
);
508508
WP_CLI::debug( "Running shell command: {$command}", 'db' );
@@ -740,8 +740,8 @@ private function get_posts_table_charset( $assoc_args ) {
740740

741741
list( $stdout, $stderr, $exit_code ) = self::run(
742742
sprintf(
743-
'/usr/bin/env %s%s --no-auto-rehash --batch --skip-column-names',
744-
$this->get_mysql_command(),
743+
'%s%s --no-auto-rehash --batch --skip-column-names',
744+
Utils\get_mysql_binary_path(),
745745
$this->get_defaults_flag_string( $assoc_args )
746746
),
747747
[ 'execute' => $query ],
@@ -829,8 +829,8 @@ public function import( $args, $assoc_args ) {
829829
}
830830

831831
$command = sprintf(
832-
'/usr/bin/env %s%s --no-auto-rehash',
833-
$this->get_mysql_command(),
832+
'%s%s --no-auto-rehash',
833+
Utils\get_mysql_binary_path(),
834834
$this->get_defaults_flag_string( $assoc_args )
835835
);
836836
WP_CLI::debug( "Running shell command: {$command}", 'db' );
@@ -1765,8 +1765,8 @@ protected function run_query( $query, $assoc_args = [] ) {
17651765

17661766
self::run(
17671767
sprintf(
1768-
'/usr/bin/env %s%s --no-auto-rehash',
1769-
$this->get_mysql_command(),
1768+
'%s%s --no-auto-rehash',
1769+
Utils\get_mysql_binary_path(),
17701770
$this->get_defaults_flag_string( $assoc_args )
17711771
),
17721772
array_merge( [ 'execute' => $query ], $mysql_args )
@@ -2166,7 +2166,7 @@ protected function get_current_sql_modes( $assoc_args ) {
21662166

21672167
list( $stdout, $stderr, $exit_code ) = self::run(
21682168
sprintf(
2169-
'/usr/bin/env %s%s --no-auto-rehash --batch --skip-column-names',
2169+
'%s%s --no-auto-rehash --batch --skip-column-names',
21702170
$this->get_mysql_command(),
21712171
$this->get_defaults_flag_string( $assoc_args )
21722172
),
@@ -2199,22 +2199,13 @@ 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 ( strpos( Utils\get_mysql_version(), 'MariaDB' ) !== false ) ? 'mariadb' : 'mysql';
2209-
}
2210-
22112202
/**
22122203
* Returns the correct `check` command based on the detected database type.
22132204
*
22142205
* @return string The appropriate check command.
22152206
*/
22162207
private function get_check_command() {
2217-
return ( strpos( Utils\get_mysql_version(), 'MariaDB' ) !== false ) ? 'mariadb-check' : 'mysqlcheck';
2208+
return 'mariadb' === Utils\get_db_type() ? 'mariadb-check' : 'mysqlcheck';
22182209
}
22192210

22202211
/**
@@ -2223,6 +2214,6 @@ private function get_check_command() {
22232214
* @return string The appropriate dump command.
22242215
*/
22252216
private function get_dump_command() {
2226-
return ( strpos( Utils\get_mysql_version(), 'MariaDB' ) !== false ) ? 'mariadb-dump' : 'mysqldump';
2217+
return 'mariadb' === Utils\get_db_type() ? 'mariadb-dump' : 'mysqldump';
22272218
}
22282219
}

0 commit comments

Comments
 (0)