wp2spip-0.1

It’s been quite a while since I’ve been looking for a way to transfer a website from WordPress to Spip, without any luck. There is a small php script deep in the mailing archives of rezo.net. But it was not doing the job the way I wanted. Script works ok, but doesn’t make a difference between articles and documents. However, it helped me write something else suitable to my needs.

Please note that the process described hereunder might not work for everybody. But with a little bit of Spip and WordPress knowledge, it can easily be tweaked to suit your needs.

Basic principle:
We take the database from wordpress and add it to the Spip database. By calling a special template page, we will generate an xml file (dump) that Spip will load through his backup functions.

Don’t do this on a production server. Copy your whole wordpress website on a test server to be sure not to delete anything

In details:
(on the same web server as wordpress)

  • Install and configure a fresh Spip
  • Export a temp/dump/mon_spip_website.xml file via “Site maintenance”
  • Copy and insert the wordpress database in the same database used by Spip
  • Edit the template wp2spip-0.1.html and replace the necessary lines so it looks like mon_spip_website.xml. What you absolutely need to replace is:
    • Spip version notes
    • Informations about auteur 1 (website administrator).
    • “metas” (spip configuration)
  • Move wp2spip-0.2.html in the folder squelettes/ and call this page with a browser.
  • Save the result in a raw format (the source) under a name like wordpress.xml and upload it to temp/dump/
  • Load this file via la “Site maintenance”. If everything went alright, you will have all the articles and the comments from wordpress in your newly created spip. 😉

Notes:
Like I said, this script is not a full-proof solution. I had to make certain decisions while writing it to make it work as I needed. So, there is missing functions in it.
Here’s what it does (or not) do:

  • copies all published articles (not the others) in a section called “site”
  • attachment articles are converted into referenced documents (they still stay in their wordpress folder) and are bounded (+ <embX> ) to the spip article they relate to. (Only for the following file formats: jpeg, gif, png, mp3, mpeg, asf et wma)
  • article categories are converted into keywords from the goup “mots clef de wp”
  • only validated comments are saved
  • links are saved
  • pages are not imported

Todo:
I’d like it to look for <a href=” “><img src=” ” /></a> and turn them into en <embX> and other little handy things like that. With a little help, I might extend this script to make it more like a general solution for everyone.


Tags: