File tree Expand file tree Collapse file tree 5 files changed +40
-3
lines changed
Expand file tree Collapse file tree 5 files changed +40
-3
lines changed Original file line number Diff line number Diff line change 1+ root = true
2+
3+ [* ]
4+ charset = utf-8
5+ end_of_line = lf
6+ insert_final_newline = true
7+ indent_style = space
8+ indent_size = 4
9+ trim_trailing_whitespace = true
10+
11+ [* .md ]
12+ trim_trailing_whitespace = false
13+
14+ [* .{yml,yaml} ]
15+ indent_size = 2
16+
17+ [Makefile ]
18+ indent_style = tab
Original file line number Diff line number Diff line change 1+ FROM https://github.com/javanile/php-package 1.x
Original file line number Diff line number Diff line change 1+ # !make
2+
3+ readme-standard :
4+ @curl -s https://www.javanile.org/readme-standard/checker.sh? t=$$(date +%s ) | bash
Original file line number Diff line number Diff line change 77
88The best way to import SQL file on your database.
99
10+ ## UsageA
11+
1012## Get started
1113
1214``` bash
@@ -17,6 +19,11 @@ $ composer require javanile/mysql-import
1719$ ./vendor/bin/mysql-import database.sql
1820```
1921
22+ ## Usage
23+ This is how to use this
24+ This is how to use this
25+
26+
2027## Testing
2128
2229``` bash
Original file line number Diff line number Diff line change @@ -74,6 +74,11 @@ class MysqlImport
7474 */
7575 protected $ doWhile ;
7676
77+ /**
78+ * @var boolean
79+ */
80+ protected $ force ;
81+
7782 /**
7883 * @var boolean
7984 */
@@ -95,6 +100,7 @@ public function __construct($env, $argv)
95100 $ this ->exitCode = 0 ;
96101 $ this ->loader = '/\______ ' ;
97102 $ this ->doWhile = in_array ('--do-while ' , $ argv );
103+ $ this ->force = in_array ('--force ' , $ argv );
98104
99105 $ defaultDatabase = isset ($ env ['WORDPRESS_DB_PASSWORD ' ]) ? 'wordpress ' : 'database ' ;
100106
@@ -118,6 +124,7 @@ public function __construct($env, $argv)
118124
119125 // Get value from command-line argument
120126 if ($ opt [2 ] && $ arg = preg_grep ('/^ ' .$ opt [2 ].'[\S]*/ ' , $ argv )) {
127+ var_dump ($ arg );
121128 $ value = substr (end ($ arg ), strlen ($ opt [2 ]));
122129 }
123130
@@ -152,7 +159,7 @@ public function __construct($env, $argv)
152159 }
153160
154161 /**
155- * Command entrypoint .
162+ * Command entry-point .
156163 */
157164 public function run ()
158165 {
@@ -207,7 +214,7 @@ protected function tryUserAndPassword()
207214 }
208215
209216 //
210- if (!$ this ->blank ()) {
217+ if (!$ this ->blank () && ! $ this -> force ) {
211218 return $ this ->messageDatabaseNotBlank ();
212219 }
213220
@@ -238,7 +245,7 @@ protected function tryRootPassword()
238245
239246 // try to import
240247 if ($ this ->exists ()) {
241- if ($ this ->blank ()) {
248+ if ($ this ->blank () || $ this -> force ) {
242249 return $ this ->import ();
243250 }
244251
You can’t perform that action at this time.
0 commit comments