As a project to get to know Backdrop, I want to convert the existing Wordpress site of the local environmental organisation that I'm involved with into a Backdrop site.

As a sidenote: I used Lando to spin up a Backdrop site as well as a Wordpress site on my local desktop computer. I learned about Lando during the recent Backdrop Live event and it seems very useful piece of software! I plan to write some documentation on using Lando for developing new Backdrop sites and I will probably start a separate Forum topic to get some feedback on that.

The Wordpress site is relatively simple: it contains 118 posts, 20 pages and 460 media files. It was pretty straightforward to export the full content of the site and I saved the resulting WXR file on my local hard drive. On the blank Backdrop site I installed the Wordpress Import module and I tried to import the WXR file by using Content -> Wordpress Import. The file is uploaded to the Backdrop site (into the directory /files/wordpress), but it generates the following error:

This file does not appear to be a valid WXR file. The file is either corrupted or invalid XML. In some versions of WordPress, the export function can produce malformed XML. Please see README.txt (included in the module archive) for further guidance.

I then tried to import the WXR file on the blank Wordpress site that I created via Lando and there the WXR file was imported flawlessly. So there's obviously something wrong with the module. I've reported the issue on Github.

 

Comments

indigoxela's picture

Hi zilvervos,

I wonder what a "second opinion" on this xml file reports, for instance a command line tool like xmllint.

There have been some very old issues (D6) regarding either the atom field or some utf8 characters in the file.

Possibly Wordpress itself is very permissive regarding xml when importing, but the Backdrop module is pickier?

Hi Indigoxela,

Thanks for you thoughts on this.

xmllint reports ten errors:

  1. CData section not finished
  2. PCDATA invalid Char value 3
  3. Opening and ending tag mismatch
  4. Sequence ']]>' not allowed in content
  5. Opening and ending tag mismatch
  6. PCDATA invalid Char value 3
  7. Sequence ']]>' not allowed in content
  8. Opening and ending tag mismatch
  9. Opening and ending tag mismatch
  10. Extra content at the end of the document

Should I try to repair the issues manually on the basis of the xmllint output and then retry importing?

indigoxela's picture

Oops, ten errors seem a lot to me...

Should I try to repair the issues manually on the basis of the xmllint output...

I'd say, it's worth a try. ;-)

And it would also be interesting, if the Backdrop module would be able to fix / circumvent these xml errors - possibly not.

I will start with trying the first option (cleaning up the WXR file). Judging from the activity on the Github page for the Wordpress Import module, it looks like it's not actively maintained... The code looks pretty readable, so if cleaning up the file doesn't do the job I'll dive into that a bit more (even when I'm not a php-programmer).

I got rid of two UTF-8 flaws in the WXR file, which allowed me to run Wordpress Import. But, after filling in all specifications for the import,. something still goes wrong.

Any ideas on how  I could proceed?

This is the error message:

An AJAX HTTP error occurred. HTTP Result Code: 200 Debugging information follows. Path: /batch?id=6&op=do_nojs&op=do StatusText: OK ResponseText: Home | SME on BackdropCMS window.Backdrop = {settings: {"basePath":"\/","pathPrefix":"","drupalCompatibility":true,"ajaxPageState":{"theme":"basis","theme_token":"cUQp3mMkzRraf1XkIU2GjUliCq-5QFMSyG1XU-hL_XY","css":{"core\/misc\/normalize.css":1,"core\/modules\/system\/css\/system.css":1,"core\/modules\/system\/css\/system.theme.css":1,"core\/modules\/system\/css\/messages.theme.css":1,"core\/modules\/layout\/css\/grid-flexbox.css":1,"core\/modules\/contextual\/css\/contextual.css":1,"core\/modules\/comment\/css\/comment.css":1,"core\/modules\/date\/css\/date.css":1,"core\/modules\/field\/css\/field.css":1,"core\/modules\/search\/search.theme.css":1,"core\/modules\/user\/css\/user.css":1,"core\/modules\/views\/css\/views.css":1,"core\/layouts\/boxton\/boxton.css":1,"core\/modules\/system\/css\/menu-dropdown.theme.css":1,"core\/modules\/system\/css\/menu-toggle.theme.css":1,"core\/themes\/basis\/css\/base.css":1,"core\/themes\/basis\/css\/layout.css":1,"core\/themes\/basis\/css\/component\/small-text-components.css":1,"core\/themes\/basis\/css\/component\/header.css":1,"core\/themes\/basis\/css\/component\/footer.css":1,"core\/themes\/basis\/css\/component\/menu-dropdown.css":1,"core\/themes\/basis\/css\/component\/menu-toggle.css":1,"core\/themes\/basis\/css\/component\/backdrop-form.css":1,"core\/themes\/basis\/css\/component\/tabledrag.css":1,"core\/themes\/basis\/css\/component\/vertical-tabs.css":1,"core\/themes\/basis\/css\/component\/fieldset.css":1,"core\/themes\/basis\/css\/component\/dialog.css":1,"core\/themes\/basis\/css\/component\/progress.css":1,"core\/themes\/basis\/css\/component\/admin-tabs.css":1,"core\/themes\/basis\/css\/component\/breadcrumb.css":1,"core\/themes\/basis\/css\/component\/pager.css":1,"core\/themes\/basis\/css\/component\/hero.css":1,"core\/themes\/basis\/css\/component\/teasers.css":1,"core\/themes\/basis\/css\/component\/comment.css":1,"core\/themes\/basis\/css\/component\/caption.css":1,"core\/themes\/basis\/css\/skin.css":1,"core\/themes\/basis\/system.theme.css":1,"core\/themes\/basis\/menu-dropdown.theme.css":1,"core\/themes\/basis\/menu-dropdown.theme.breakpoint.css":1,"core\/themes\/basis\/menu-dropdown.theme.breakpoint-queries.css":1,"core\/themes\/basis\/css\/print.css":1,"core\/misc\/opensans\/opensans.css":1,"core\/misc\/smartmenus\/css\/sm-core-css.css":1},"js":{"core\/misc\/html5.js":1,"core\/misc\/jquery.js":1,"core\/misc\/jquery-extend-3.4.0.js":1,"core\/misc\/jquery-html-prefilter-3.5.0.js":1,"core\/misc\/jquery.once.js":1,"core\/misc\/backdrop.js":1,"core\/modules\/layout\/js\/grid-fallback.js":1,"core\/modules\/contextual\/js\/contextual.js":1,"core\/misc\/smartmenus\/jquery.smartmenus.js":1,"core\/misc\/smartmenus\/addons\/keyboard\/jquery.smartmenus.keyboard.js":1,"core\/modules\/system\/js\/menus.js":1,"core\/themes\/basis\/js\/script.js":1}}}}; Skip to main content Configure block SME on BackdropCMS My accountLog out Configure blockEdit linksAdd link MenuToggle menu visibilityHome Configure block Welcome to SME on BackdropCMS!   Error message No active batch. Configure viewConfigure block No content has been promoted yet. Configure block Powered by Backdrop CMS

I also tried to import in a Drupal 7.82 website (which I spun up in a few minutes, using Lando), with the idea to subsequently migrate the Drupal 7 site to a Backdrop site. I managed to import all static pages, but something went wrong with the import of articles ("Notice: Undefined index: files in WordPressMigrateWizard->sourceDataFormValidate() (line 172 of /app/sites/all/modules/wordpress_migrate/wordpress_migrate.migrate.inc).") and only 50 out of 120 articles were migrated.

So I probably will have to write my own script to migrate the articles. Any ideas on how to proceed with that are most welcome.

indigoxela's picture

Any ideas on how to proceed with that are most welcome.

No fancy ideas here. What's the difference between the articles that got imported into your Drupal and the ones that failed? Anything obvious? Files attached? Special content?

The Backdrop AJAX HTTP error is mysterious. Does that mean, nothing at all gets imported, or does it stop at some point?

If the wp import module gets too time consuming, maybe consider to do the import with the feeds module? Warning: might be tricky, too.

Import stops at a point. No clue what causes this. I also see no pattern in what gets migrated and what not, except that most newer posts on the website have not been migrated.

I'm going to give it a try with the feeds module. Have used that in another context on Drupal 7.

 

In the end I used another work-around:

I spun up a vanilla Drupal 8 site (using Lando) and installed the WordPress Migrate Support module and all additional modules required. This allowed me to import the Wordpress WXR file into Drupal 8: this time all posts, pages, files and tags were imported.

So there I had all the Wordpress site content in a Drupal 8 database. How to get that into a Backdrop database?

I chose the Entity Export CSV module to export all posts as a csv file (I already had managed to import the pages (see above) via the Backdrop Wordpress Import module. I chose "field names" for the header entries and Format "None" for the created and changed fields.

On the Backdrop site I used Feeds import to import the CSV file. It took me a while to figure out how to configure the Node importer. Turned out that I needed to set the target configuration for the GUID to "Not used as unique": else only one node would be imported.

After some tweaking of mappings and other settings in the Feeds module I managed to import all content and pages from the Wordpress site into Backdrop CMS.

For the moment my conclusion is that the Wordpress Import module in its current version doesn't function properly and one has to follow the somewhat convoluted method described above to import content from an existing Wordpress website into a Backdrop site.

indigoxela's picture

I'm glad that you managed (sort of) to get data in with some intermediate steps.

Import stops at a point. No clue what causes this. I also see no pattern in what gets migrated and what not, except that most newer posts on the website have not been migrated.

Maybe some field is longer than it's supposed to be in Backdrop? Like for instance comment title? Or a required field is empty? Emojis in content? A missing user (author) on Backdrop side? ...

I never used that module (neither D nor B, never had a WP), but I'd agree that currently it doesn't seem so helpful. But as you already stated before - the module doesn't seem to be maintained very actively. It might take someone new to pick up the job to catch up with the D8 variant.

I have now replicated the import, so it seems to be a usable workaround.

If anyone wants to apply this way of importing Wordpress content, there's two points to add to what I wrote above:

1) I had to manually remove two errors in the WXR file (two non-UTF-8 bytes in the WXR file). I located these errors by passing the WXR file through xmllint.

2) I used the dev version of the Wordpress Migrate module for Drupal 8. The recommended version (8.x-3.0-alpha4) doesn't manage the job. The Drupal 7 version of the module (used in a Drupal 7 intsall) also failed.