@@ -149,9 +149,34 @@ protected function initializeConfiguration()
149149 // Read configuration
150150 $ this ->readConfiguration ();
151151
152+ $ this ->initDatabaseConfiguration ();
152153 $ this ->initDockerContainer ();
153154 }
154155
156+ /**
157+ * Init database configuration (for local one)
158+ */
159+ protected function initDatabaseConfiguration ()
160+ {
161+ $ hostname = DatabaseConnection::getDbHostname ();
162+ $ username = DatabaseConnection::getDbUsername ();
163+ $ password = DatabaseConnection::getDbPassword ();
164+
165+ if ($ this ->config ->exists ('LOCAL.mysql.hostname ' )) {
166+ $ hostname = $ this ->config ->get ('LOCAL.mysql.hostname ' );
167+ }
168+
169+ if ($ this ->config ->exists ('LOCAL.mysql.username ' )) {
170+ $ username = $ this ->config ->get ('LOCAL.mysql.username ' );
171+ }
172+
173+ if ($ this ->config ->exists ('LOCAL.mysql.password ' )) {
174+ $ password = $ this ->config ->get ('LOCAL.mysql.password ' );
175+ }
176+
177+ DatabaseConnection::setDsn ('mysql:host= ' . $ hostname , $ username , $ password );
178+ }
179+
155180 /**
156181 * Init docker container setting
157182 */
@@ -883,6 +908,10 @@ protected function createMysqlRestoreCommand($database, $dumpFile)
883908 $ command ->addArgumentTemplate ('--password %s ' , $ this ->config ->get ('LOCAL.mysql.password ' ));
884909 }
885910
911+ if ($ this ->output ->isVerbose ()) {
912+ $ command ->addArgument ('-v ' );
913+ }
914+
886915 return $ command ;
887916 }
888917
@@ -923,6 +952,10 @@ protected function createMysqlBackupCommand($database, $dumpFile, $filterNameBla
923952 $ command ->addArgumentTemplate ('--whitelist=%s ' , $ filterNameWhitelist );
924953 }
925954
955+ if ($ this ->output ->isVerbose ()) {
956+ $ command ->addArgument ('-v ' );
957+ }
958+
926959 return $ command ;
927960 }
928961
@@ -985,6 +1018,14 @@ protected function createRemoteMySqlCommand($database = null)
9851018 return $ command ;
9861019 }
9871020
1021+ protected function localMysqlPing ()
1022+ {
1023+ $ echoCommand = new CommandBuilder ('echo ' , 'SELECT 1 ' );
1024+ $ mysqlCommand = $ this ->createLocalMySqlCommand ();
1025+ $ mysqlCommand ->setOutputRedirect ('> /dev/null ' );
1026+ $ echoCommand ->addPipeCommand ($ mysqlCommand );
1027+ $ echoCommand ->executeInteractive ();
1028+ }
9881029
9891030 /**
9901031 * Create new mysql command
@@ -1013,7 +1054,7 @@ protected function createLocalMySqlCommand($database = null)
10131054 $ command ->addArgumentTemplate ('-h%s ' , DatabaseConnection::getDbHostname ());
10141055 }
10151056
1016- // Add hostname
1057+ // Add port
10171058 if (DatabaseConnection::getDbPort ()) {
10181059 $ command ->addArgumentTemplate ('-P%s ' , DatabaseConnection::getDbPort ());
10191060 }
0 commit comments