@@ -110,7 +110,7 @@ public function reset( $_, $assoc_args ) {
110
110
* Success: Database checked.
111
111
*/
112
112
public function check () {
113
- self ::run ( Utils \esc_cmd ( 'mysqlcheck --no-defaults %s ' , DB_NAME ), array (
113
+ self ::run ( Utils \esc_cmd ( '/usr/bin/env mysqlcheck --no-defaults %s ' , DB_NAME ), array (
114
114
'check ' => true ,
115
115
) );
116
116
@@ -133,7 +133,7 @@ public function check() {
133
133
* Success: Database optimized.
134
134
*/
135
135
public function optimize () {
136
- self ::run ( Utils \esc_cmd ( 'mysqlcheck --no-defaults %s ' , DB_NAME ), array (
136
+ self ::run ( Utils \esc_cmd ( '/usr/bin/env mysqlcheck --no-defaults %s ' , DB_NAME ), array (
137
137
'optimize ' => true ,
138
138
) );
139
139
@@ -156,7 +156,7 @@ public function optimize() {
156
156
* Success: Database repaired.
157
157
*/
158
158
public function repair () {
159
- self ::run ( Utils \esc_cmd ( 'mysqlcheck --no-defaults %s ' , DB_NAME ), array (
159
+ self ::run ( Utils \esc_cmd ( '/usr/bin/env mysqlcheck --no-defaults %s ' , DB_NAME ), array (
160
160
'repair ' => true ,
161
161
) );
162
162
@@ -190,7 +190,7 @@ public function cli( $args, $assoc_args ) {
190
190
$ assoc_args ['database ' ] = DB_NAME ;
191
191
}
192
192
193
- self ::run ( 'mysql --no-defaults --no-auto-rehash ' , $ assoc_args );
193
+ self ::run ( '/usr/bin/env mysql --no-defaults --no-auto-rehash ' , $ assoc_args );
194
194
}
195
195
196
196
/**
@@ -245,7 +245,7 @@ public function query( $args, $assoc_args ) {
245
245
$ assoc_args ['execute ' ] = $ args [0 ];
246
246
}
247
247
248
- self ::run ( 'mysql --no-defaults --no-auto-rehash ' , $ assoc_args );
248
+ self ::run ( '/usr/bin/env mysql --no-defaults --no-auto-rehash ' , $ assoc_args );
249
249
}
250
250
251
251
/**
@@ -307,7 +307,7 @@ public function export( $args, $assoc_args ) {
307
307
$ assoc_args ['result-file ' ] = $ result_file ;
308
308
}
309
309
310
- $ command = 'mysqldump --no-defaults %s ' ;
310
+ $ command = '/usr/bin/env mysqldump --no-defaults %s ' ;
311
311
$ command_esc_args = array ( DB_NAME );
312
312
313
313
if ( isset ( $ assoc_args ['tables ' ] ) ) {
@@ -382,7 +382,7 @@ public function import( $args, $assoc_args ) {
382
382
$ mysql_args ['execute ' ] = sprintf ( $ query , $ result_file );
383
383
}
384
384
385
- self ::run ( 'mysql --no-defaults --no-auto-rehash ' , $ mysql_args );
385
+ self ::run ( '/usr/bin/env mysql --no-defaults --no-auto-rehash ' , $ mysql_args );
386
386
387
387
WP_CLI ::success ( sprintf ( "Imported from '%s'. " , $ result_file ) );
388
388
}
@@ -469,7 +469,7 @@ private static function get_create_query() {
469
469
}
470
470
471
471
private static function run_query ( $ query ) {
472
- self ::run ( 'mysql --no-defaults --no-auto-rehash ' , array ( 'execute ' => $ query ) );
472
+ self ::run ( '/usr/bin/env mysql --no-defaults --no-auto-rehash ' , array ( 'execute ' => $ query ) );
473
473
}
474
474
475
475
private static function run ( $ cmd , $ assoc_args = array (), $ descriptors = null ) {
0 commit comments