File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 1616 }
1717 ],
1818 "require" : {
19+ "php" : " >=7.1" ,
1920 "mikehaertl/php-shellcommand" : " 1.*" ,
2021 "yiisoft/yii2" : " 2.*" ,
2122 "schmunk42/retry" : " *"
Original file line number Diff line number Diff line change 77 * file that was distributed with this source code.
88 */
99
10-
1110namespace dmstr \db \helper ;
1211
13-
1412use mikehaertl \shellcommand \Command ;
13+ use yii \base \Exception ;
1514use yii \db \Connection ;
1615
1716/**
2423 */
2524class CliHelper
2625{
26+ public static function getMysqlCommand ($ mysqlExecutable = 'mysql ' , ?Connection $ db = null )
27+ {
28+ if ($ db === null ) {
29+ throw new Exception ('Invalid database config ' );
30+ }
2731
28-
29- public static function getMysqlCommand ($ mysqlExecutable = 'mysql ' , $ db ){
3032 $ dsnOpts = CliHelper::getMysqlOptsFromDsn ($ db );
3133
3234 $ command = new Command ($ mysqlExecutable );
@@ -54,7 +56,7 @@ public static function getMysqlOptsFromDsn(Connection $db)
5456
5557 $ cliArgs = [
5658 'host ' => null ,
57- 'db ' => null ,
59+ 'db ' => null ,
5860 'port ' => 3306 ,
5961 ];
6062
@@ -101,4 +103,4 @@ public static function getMysqlCliArgsFromPdo(Connection $db)
101103 return $ cliArgs ;
102104 }
103105
104- }
106+ }
You can’t perform that action at this time.
0 commit comments