Skip to content

Commit

Permalink
Added local_mysql_auth_echo
Browse files Browse the repository at this point in the history
  • Loading branch information
ronnorthrip committed Dec 1, 2023
1 parent c03eab6 commit 0fc077d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Commands/DBPull.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class DBPull extends Command
protected $local_mysql_database = '';
protected $local_mysql_user = '';
protected $local_mysql_password = '';
protected $local_mysql_auth_echo = '';
protected $from = '';
protected $from_lc = '';
protected $from_uc = '';
Expand Down Expand Up @@ -94,6 +95,7 @@ protected function setup()
$this->local_mysql_user = config('dbpull.local.username', '');
$this->local_mysql_password = config('dbpull.local.password', '');
$this->local_mysql_database = config('dbpull.local.database', '');
$this->local_mysql_auth_echo = "echo -e \"[client]\nuser=$this->local_mysql_password\npassword=$this->local_mysql_database\"";
$this->remote_ssh = config('dbpull.'.$this->from.'.ssh', '');
$this->remote_mysql_host = config('dbpull.'.$this->from.'.host', '');
$this->remote_mysql_port = config('dbpull.'.$this->from.'.port', '');
Expand Down Expand Up @@ -513,7 +515,7 @@ public function local_flush_pulls_dir()

public function local_sql_import($file)
{
exec("mysql -u$this->local_mysql_user -p$this->local_mysql_password $this->local_mysql_database < ".$this->local_pulls_path.$file);
exec("$this->local_mysql_auth_echo | mysql --defaults-file=/dev/stdin $this->local_mysql_database < ".$this->local_pulls_path.$file);
}

public function has_old_data()
Expand Down

0 comments on commit 0fc077d

Please sign in to comment.