kristau.net

Photos, Writings, Etc.

  • Home
  • Photos
  • Technology
  • Virualization
  • Linux
  • Writings
  • Travels
  • Food
  • Site News
  • Causes

ReciPants Migrated to MediaWiki

Posted by Kenneth Ristau on May 30, 2015
Posted in: Food, Linux, Technology. Tagged: 2015, hints tips tricks, Linux, ReciPants, script, technology.

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

Posts navigation

← Mountain View from Trail Ridge Road Near Estes Park, CO
Tap tap tap. Is this thing still on? →
  • Recent Posts

    • Spring 2023 Back Yard
    • Best of 2019
    • Best of 2018
    • Best of 2017
    • Upper Dells Boat Tour, October 2022
  • Recent Comments

    • Pam Ristau on Food Blogging is Hard (But Rewarding) Work
  • Archives

    • April 2023
    • February 2023
    • January 2023
    • September 2022
    • August 2022
    • July 2022
    • April 2022
    • October 2021
    • July 2021
    • March 2021
    • September 2019
    • May 2019
    • May 2015
    • November 2014
    • October 2014
    • August 2014
    • July 2014
    • April 2014
    • October 2013
    • May 2013
    • March 2013
    • February 2013
    • January 2013
    • September 2012
    • August 2012
    • July 2012
    • May 2012
    • April 2012
    • February 2012
    • January 2012
    • November 2011
    • October 2011
    • August 2011
    • July 2011
    • May 2011
    • April 2011
    • March 2011
    • February 2011
    • January 2011
    • December 2010
    • November 2010
    • October 2010
    • September 2010
    • August 2010
    • July 2010
    • June 2010
    • May 2010
    • March 2010
    • February 2010
    • November 2009
    • October 2009
    • September 2009
    • August 2009
    • July 2009
    • June 2009
    • May 2009
    • April 2009
    • March 2009
    • February 2009
    • January 2009
    • December 2008
    • November 2008
    • October 2008
    • September 2008
  • Categories

    • Android
    • Causes
    • Food
    • Linux
    • Mac OSX
    • Making
    • Pheatured Photographer
    • Photos
    • Site News
    • Technology
    • Travels
    • Uncategorized
    • Virualization
    • Writings
Proudly powered by WordPress Theme: Parament by Automattic.