You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/SQLite_Command.php
+61-9Lines changed: 61 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -9,32 +9,84 @@ class SQLite_Command extends WP_CLI_Command {
9
9
10
10
11
11
/**
12
-
* Imports the database to SQLite.
12
+
* Imports the database to SQLite from an MySQL dump file or from STDIN.
13
13
*
14
14
* ## OPTIONS
15
15
*
16
16
* <file>
17
-
* : The file to import or - for stdin.
17
+
* : The name of the SQL file to import. If '-', then reads from STDIN. If omitted, it will look for '{dbname}.sql'.
18
+
*
19
+
* ## EXAMPLES
20
+
* # Import the database from a file
21
+
* $ wp sqlite import wordpress_dbase.sql
22
+
* Success: Imported from 'import wordpress_dbase.sql'.
18
23
*/
19
24
publicfunctionimport( $args, $assoc_args ) {
20
-
WP_CLI::success( 'Importing database...' );
25
+
26
+
if ( empty( $args[0] ) ) {
27
+
WP_CLI::error( 'Please provide a file to import.' );
28
+
}
29
+
30
+
if ( ! Import::get_sqlite_plugin_version() ) {
31
+
WP_CLI::error( 'The SQLite integration plugin is not installed or activated.' );
32
+
}
33
+
21
34
$import = newImport();
22
-
$file = $args[0];
23
-
$import->run( $file, $assoc_args );
35
+
$import->run( $args[0], $assoc_args );
24
36
}
25
37
26
38
27
39
/**
28
-
* Exports the database from SQLite
40
+
* Exports the database from SQLite to a file or to STDOUT.
29
41
*
30
42
* ## OPTIONS
31
43
*
32
-
* <file>
33
-
* : The file to export to or - for stdout.
44
+
* [<file>]
45
+
* : The name of the SQL file to export. If '-', then outputs to STDOUT. If
46
+
* omitted, it will be '{dbname}-{Y-m-d}-{random-hash}.sql'.
47
+
*
48
+
* [--tables=<tables>]
49
+
* : The tables to export. Separate multiple tables with a comma. If omitted, all tables will be exported.
50
+
*
51
+
* [--exclude_tables=<tables>]
52
+
* : The comma separated list of specific tables that should be skipped from exporting. Excluding this parameter will export all tables in the database.
0 commit comments