(Not) fixing Podlove Podcast Publisher Export and Import functions

Moving Websites could be a very simple task. Moving WordPress Websites however has quite a tradition of causing alls kinds of pain and this has not changed in 2023. Moving a WordPress site that publishes a whole podcast with Podlove Podcast Publisher just brought this frustration to a new level. 

Keep Reading: (Not) fixing Podlove Podcast Publisher Export and Import functions

The Scenario

After we decided to finally take down SegelnBlogs I had to move my Podcast Website Segelradio off its WordPress-Multisite and transfer it back to my own webspace. Moving the content of other pages was a rather smooth process utilizing the WordPress built in export and import process. But It did not cover all parts of the Podlove Podcast Publisher.

Episodes, Posts, Comments and Media made it through, but the relevant data was missing: Especially all podcast metadata, the shows I had configured, participant database, …

Luckily Podlove offers it’s own import/export tools to solve this. – You think. But unluckily it just does not work (at least in recent versions <3.8.6). It is  easily get to the point the Module has been released a couple of years ago without any testing whatsoever. A quick search brought up that the problem is not unknown and other people faced the same frustration were left unanswered for years.

Getting hands a bit dirty. – How it should work

The Process works in two parts: An Exporter runs on the old site and should give you a gz compressed XML file. This File should than be imported on a new (blank!) WordPress Podlove Publisher installation. Another Multisite in my case (!) – Bang, move done all are happy…

Aparently this has never worked for anyone with Podlove Podcast Publisher because it already fails at step one. 

Some dysfunctional Export and Import tools  

The exported .xlm.gz produces by Podlove can not be imported and the importer quits with a “critical wordpress error”. So my first question was: What is in the file? – Garbage! Uncompressing the XML turned out it was created as a binary file and compressed again.

Not a fix: Bypass the compression

To get a hold of the problem I decided to try a workaround and simply bypass all compression. To do so I commented out the three lines that should detect if gzencode is installed. 

As a result I got (almost) a valid XML Document for my Podcast configuration in plain text. The file to modify is located in

/wp-content/plugins/podlove-podcasting-plugin-for-wordpress/lib/modules/import_export/export/podcast_exporter.php 

However this file is not fully XML compliant because it has two empty lines at the start and so does not begin with the required xml definition in the first line. (Yes, as a podcast publisher you better know such things …) So I removed the empty lines with a plain text editor.

Happy as a puppy to have that solved… it was only seconds later I realized the tracking data export was also broken.

After finding the relevant parts I was able to change it from writing a gz-file to create a text-file. Instead of using gzopen do it with fopen and switch gzwrite with fwrite in the tracking export file located in the same location: tracking_exporter.php 

I did not bother to change the filename created in code so I had to remove the .gz extension after downloading the CSV-file manually.

Now I had a valid XML and a huge CSV file on my macbook’s harddisk – Boom, export done!

Uploading them of course also fails due to a chain of issues. First of all XML-Files can not be uploaded to a wordpress site. My WordPress installation complained that due to security reasons it will not allow me to do so. 

Well, than let us bypass the security than … Adding the following line to the
wp-config.php fixes this problem temporarily:

define(´ALLOW_UNFILTERED_UPLOADS´, true); //remember to remove this line or set it true to false after finishing to re-enable security!

It was also required to raise the file upload limit because the uncompressed. Tracking data had almost 200 Megabytes in size (one should even be prepared to skip importing this on large Podcasts that were running for decades and have a huge database.)

Podlove Podcasts Import

At least the export script for the podcast meta data was prepared to create just an XML file when the site’s php simply has no gzencode installed. But the tracking export than already required gzencode to work at all making the first part just useless. 

Even more annoying: The importer requires gzencode to be working for both files. So the “intentionally” exported xml will never work for an import. To make things a bit more hard: It will allow you to upload a non gzipped file and detect that but further down the line it can only work with gzencoded files … 

Fixing this was not too hard. The code is at:

/wp-content/plugins/podlove-podcasting-plugin-for-wordpress/lib/modules/import_export/import/podcast_import_job_trait.php 

To handle plain text files, I changed again gzopen to fopen, gzread to fread and gzclose to fclose in PodcastImportJobTrait():

Both export files can now be uploaded and the podlove plugin manager shows a gazillion jobs in the Tools tab while it ingests all shows, tracking data, podcast metas, … This needs a bit of time to complete (well over an hour in my case.)

On a first glimpse it all looks well. Only the profile photos of my contributors seem to be missing. However relinking a few photos here and there is a relative small task compared with manually importing all podcast data.


Posted

in

,

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Impressum & Datenschutz