From aee5fa895578b899cf8d7cce66788d479ab17079 Mon Sep 17 00:00:00 2001 From: Ben Sheldon Date: Wed, 11 Jan 2017 11:55:11 -0800 Subject: [PATCH] Add MySQL App (#17) --- src/Apps/MySQLApp.php | 57 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/Apps/MySQLApp.php diff --git a/src/Apps/MySQLApp.php b/src/Apps/MySQLApp.php new file mode 100644 index 0000000..7d873b0 --- /dev/null +++ b/src/Apps/MySQLApp.php @@ -0,0 +1,57 @@ +escapeShellArg($this->connection_info['mysql_host']), + '-P ' . $this->escapeShellArg($this->connection_info['mysql_port']), + '-u ' . $this->escapeShellArg($this->connection_info['mysql_username']), + '-p' . $this->escapeShellArg($this->connection_info['mysql_password']), + $this->connection_info['mysql_database'], + ]); + + $process = proc_open( + $cmd, + [ + 0 => STDIN, + 1 => STDOUT, + 2 => STDERR, + ], + $pipes + ); + proc_close($process); + } + + /** + * Validates the app can be used + */ + public function validate() { + if ($this->isWindows()) { + return FALSE; + } + + $this->app_location = 'mysql'; + return $this->which($this->app_location); + } +}