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
{{ message }}
Repository navigation
Commit e09d28a
Browse filesBrowse the repository at this point in the historyBrowse files
authored
Allow importing WXR files via HTTP/HTTPS/FTP and STDIN (#104)
Copy file name to clipboardExpand all lines: features/import.feature
+62Lines changed: 62 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -458,3 +458,65 @@ Feature: Import content.
458
458
Then STDOUT should not be empty
459
459
And STDERR should be empty
460
460
461
+
@require-wp-5.2@require-mysql
462
+
Scenario: Import from STDIN
463
+
Given a WP install
464
+
And I run `wp plugin install wordpress-importer --activate`
465
+
And I run `wp site empty --yes`
466
+
And I run `wp post generate --post_type=post --count=2`
467
+
468
+
When I run `wp post list --post_type=post --format=count`
469
+
Then STDOUT should be:
470
+
"""
471
+
2
472
+
"""
473
+
474
+
When I run `wp export`
475
+
Then save STDOUT 'Writing to file %s' as {EXPORT_FILE}
476
+
477
+
When I run `wp site empty --yes`
478
+
Then STDOUT should not be empty
479
+
480
+
When I run `wp post list --post_type=post --format=count`
481
+
Then STDOUT should be:
482
+
"""
483
+
0
484
+
"""
485
+
486
+
When I run `cat {EXPORT_FILE} | wp import - --authors=skip`
487
+
Then STDOUT should contain:
488
+
"""
489
+
Starting the import process...
490
+
"""
491
+
And STDOUT should contain:
492
+
"""
493
+
Finished importing from 'STDIN' file.
494
+
"""
495
+
And STDERR should be empty
496
+
497
+
When I run `wp post list --post_type=post --format=count`
498
+
Then STDOUT should be:
499
+
"""
500
+
2
501
+
"""
502
+
503
+
@require-wp-5.2@require-mysql
504
+
Scenario: Import from a URL
505
+
Given a WP install
506
+
And I run `wp plugin install wordpress-importer --activate`
507
+
508
+
When I run `wp import https://raw.githubusercontent.com/WordPress/theme-test-data/b47acf980696897936265182cb684dca648476c7/theme-preview.xml --authors=skip`
@@ -18,6 +18,7 @@ class Import_Command extends WP_CLI_Command {
18
18
*
19
19
* <file>...
20
20
* : Path to one or more valid WXR files for importing. Directories are also accepted.
21
+
* A URL to a WXR file is also accepted. Use '-' to import from STDIN.
21
22
*
22
23
* --authors=<authors>
23
24
* : How the author mapping should be handled. Options are 'create', 'mapping.csv', or 'skip'. The first will create any non-existent users from the WXR file. The second will read author mapping associations from a CSV, or create a CSV for editing if the file path doesn't exist. The CSV requires two columns, and a header row like "old_user_login,new_user_login". The last option will skip any author mapping.
@@ -42,6 +43,20 @@ class Import_Command extends WP_CLI_Command {
42
43
* -- Tue, 21 Jun 2016 05:31:12 +0000
43
44
* -- Imported post as post_id #1
44
45
* Success: Finished importing from 'example.wordpress.2016-06-21.xml' file.
0 commit comments