ReciPants Migrated to MediaWiki

Although ReciPants v1.2 is still hosted on SourceForge (and Freecode), it has not been actively developed or updated since 2004. If you search for ReciPants on this blog, you will see that I’ve had some trouble migrating it between servers and keeping it working over the years. I, therefore, finally decided to migrate all of our recipes (close to 500 of them) out of this software and in to the latest stable release of MediaWiki. While I’m probably the last person on earth using this software, I thought I’d share here how I performed the export, just in case I’m not!

MediaWiki allows export and import of pages in XML format. This page on the MediaWiki site was very helpful in providing the required format of this XML file. Additionally, I installed a fresh copy of MediaWiki on my Web server, mocked up a fake recipe page similar to the format I wanted, then exported that page in order to inspect it. One of the main differences I noticed between the example from the MediaWiki site and the actual export I performed was near the <text> tag. In the example, the tag is simply <text>, but I found that my imports using this tag were not getting rendered in my wiki as wikitext. My actual exported page, however, had the following tags preceding the <text> tag and a different <text> tag itself:

<model>wikitext</model>
<format>text/x-wiki</format>
<text xml:space=”preserve”>

That combination of tags resulted in the wikitext being rendered properly. Without them, the raw wikitext was shown in MediaWiki with no LF/CR — very un-readable!

With that information at hand, I set to work creating a script in Perl which would connect to the MySQL recipants database using DBI and extract the various data I wished to export into variables. The main outer loop iterates through the recipes table. Inside that loop, the other tables are queried for the data they hold about the current recipe. Everything is shoved into variables, arrays, or arrays of arrays along the way. At the end of the main loop, the XML for that page is generated.

You can download or view the script source code: rpexport.txt

This is a sample of the XML output, limited to just recipes with “berry” in the name: berry.xml

Demo FAIL, but ReciPants GO

Well, my demo of the Linux Gamers Live DVD didn’t go so well. My crappy old computer did not perform very well, so we ended up borrowing someone’s laptop to perform the demo. Wasn’t too exciting. I just brought up each game on the disk and played them for a bit. We also discussed some other Linux-friendly gaming.

After that FAIL, I needed some success. I finally got some relief with the ReciPants database issue. The problem seems to be with my method for transferring the database from the old server to the new. Here’s a brief synopsis of what I did to get it to work:

Migrated from the old server (with MySQL 3.23) to a virtual machine running CentOS 3 (also with MySQL 3.23).

On the old server:

  • Exported the database with the following command (no extra options used, my mistake was exporting with —opt and/or —add-drop-tables):

mysqldump -u root -p ReciPants > ReciPants-database.sql

On the “new” server:

  • Set up ReciPants v1.2 on the new server, per the Web site instructions — including running the SQL scripts tables-mysql.sql and ref_data.sql.
  • Once I confirmed that worked OK, restored the data from the old
    server with the following command (the -f is necessary, as there is a
    non-critical error early on that will halt the process):

mysql -u root -p -f ReciPants < ReciPants-database.sql

Again, I need to test the above method on MySQL 5.x, but I believe it will work just fine.

ReciPants crippled by lack of Digest::SHA1 (UPDATE: oops, still broke!)

I gave up trying to “fix” ReciPants on this site, and decided to try setting it up on a server at home for use there. I’ve discovered, however, that the latest version of Perl doesn’t seem to like the required module Digest::SHA1, and fails to compile it every time.

I need to spend some more time digging in to the error messages it throws when it fails to compile, but it appears to hinge on a missing library.

We’ll see. I may be looking for a way to export all of those recipes to another recipe database. . .

UPDATE ONE

Well, um, DUH. Did a quick surf through the results of apt-cache search sha1 and ran across a little package called libdigest-sha1-perl. That installed successfully on my home system and now ReciPants works!

I think I’m going to keep this as an in-home only database anyway, due to security concerns with the ReciPants project (which hasn’t been updated since April 2004).

The inability to compile the module most likely indicates a lack of the correct development libraries on my systems. That will teach me to just be more lazy and rely on apt-get 😉

UPDATE TWO

Moved this to a fresh LAMP build on the latest version of Debian running in-house. Installed all modules, configured, etc. Lots of love until I went to actually view a recipe — SQL error! ARGH.

Visited the Recipants site, sent an SOS to the main contact there, and he actually answered me back. Yay! I’ve provided him with log entries and details, so maybe I’ll get a fix? Keep watching this space for more. . .

Trouble with ReciPants

I’m having a little trouble getting ReciPants migrated over to the new server. The database is in MySQL, the site files are in place, the settings are all configured, etc. I think the problem lies with one of the Perl modules which is required for the site, but won’t install on the server for some reason.

For now, it is running fine on the old server, but I need to get this moved because we have a lot of recipes in it!