Skip to content

Commit

Permalink
[Data Liberation] Fork humanmade/WordPress-Importer (#1968)
Browse files Browse the repository at this point in the history
This PR kicks off a streamable WXR importer that uses a PHP-only XML
parser, a PHP-only HTML parser, and a PHP-only streaming multi-request
HTTP client.

The first step is bringing in the `WXR_Importer` class from this
repository:

https://github.com/humanmade/WordPress-Importer

The importer is decoupled from the runtime and can run both in a request
handler and via CLI. It makes a great starting point for a streaming,
resumable, parallelized WXR importer that may eventually be proposed for
WordPress core.

Looping in the original plugin authors mentioned in the upstream README
file

Ryan Boren, Jon Cave (@joncave), Andrew Nacin (@nacin), Peter Westwood
(@westi), Ryan McCue (@rmmccue)

 ## Testing instructions

None, this PR only brings new code in. Everything else still works the
same.
  • Loading branch information
adamziel authored Oct 31, 2024
1 parent 07988b6 commit 6f86c75
Show file tree
Hide file tree
Showing 3 changed files with 2,322 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/playground/data-liberation/phpcs.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<ruleset name="WordPressStandard">
<description>PHP 7.0 compatibility.</description>
<config name="testVersion" value="7.2"/>
<exclude-pattern>src/WXR_Importer.php</exclude-pattern>
<rule ref="PHPCompatibility">
<exclude name="PHPCompatibility.Keywords.ForbiddenNamesAsDeclared"/>
</rule>
Expand Down
29 changes: 29 additions & 0 deletions packages/playground/data-liberation/src/WXR_Import_Info.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
/**
* A fork of the WordPress Importer plugin (humanmade/WordPress-Importer).
* It's meant to be rewritten to use the new libraries shipped with Data Liberation:
*
* * HTML parser
* * Streaming XML parser
* * Streaming multi-request HTTP client
*
* Original plugin created by Ryan Boren, Jon Cave (@joncave), Andrew Nacin (@nacin),
* and Peter Westwood (@westi). Redux project by Ryan McCue and contributors.
*
* See https://github.com/humanmade/WordPress-Importer/blob/master/class-wxr-importer.php
*/
class WXR_Import_Info {
public $home;
public $siteurl;

public $title;

public $users = array();
public $post_count = 0;
public $media_count = 0;
public $comment_count = 0;
public $term_count = 0;

public $generator = '';
public $version;
}
Loading

0 comments on commit 6f86c75

Please sign in to comment.