File tree Expand file tree Collapse file tree
webfiori/framework/cli/commands Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,12 +75,16 @@ private function addDbConnection(): int {
7575 $ this ->println ('Trying to connect to the database... ' );
7676
7777 $ addConnection = $ this ->tryConnect ($ connInfoObj );
78-
78+ $ orgHost = $ connInfoObj ->getHost ();
79+ $ orgErr = $ addConnection !== true ? $ addConnection ->getMessage () : '' ;
80+
7981 if ($ addConnection !== true ) {
8082 if ($ connInfoObj ->getHost () == '127.0.0.1 ' ) {
83+ $ this ->println ("Trying with 'localhost'... " );
8184 $ connInfoObj ->setHost ('localhost ' );
8285 $ addConnection = $ this ->tryConnect ($ connInfoObj );
8386 } else if ($ connInfoObj ->getHost () == 'localhost ' ) {
87+ $ this ->println ("Trying with '127.0.0.1'... " );
8488 $ connInfoObj ->setHost ('127.0.0.1 ' );
8589 $ addConnection = $ this ->tryConnect ($ connInfoObj );
8690 }
@@ -92,8 +96,9 @@ private function addDbConnection(): int {
9296 App::getConfig ()->addOrUpdateDBConnection ($ connInfoObj );
9397 $ this ->success ('Connection information was stored in application configuration. ' );
9498 } else {
99+ $ connInfoObj ->setHost ($ orgHost );
95100 $ this ->error ('Unable to connect to the database. ' );
96- $ this ->error ($ addConnection -> getMessage () );
101+ $ this ->error ($ orgErr );
97102 $ this ->confirmAdd ($ connInfoObj );
98103 }
99104
You can’t perform that action at this time.
0 commit comments