Converting Drupal to DokuWiki

Drupal LogoI've been using DokuWiki for a little while and really like it. I had the idea of trying to convert my Drupal site, which is mainly used as a blog, to running on DokuWiki. It was a fun experiment, but led me to believe that there was no seamless way to perform such a conversion without far more effort than could be justified.

    Reasons:
  • Speed
    • Data is stored in files; eliminates database overhead.
  • Simplicity
    • Drupal is feature rich; I've experimented with a lot of modules and features, but no longer really need many of them.
  • Wiki-syntax

    • I really like the wiki syntax used by DokuWiki. I could use (or create) a module to implement it, but didn't feel like it.

The Process
Converting is a fairly straight forward process. Write a script that uses the Drupal database: get the nodes from the node table, get the matching content from the node_revisions table, use str_replace (or preg_replace) to try to convert HTML formatting to wiki formatting, then write the output to a plain text file.

    Problems:
  • Naming DokuWiki files
    • DokuWiki associates filenames with page titles.
    • A lot of my Drupal pages follow the /node/nid (where nid is the node ID) convention and don't use their titles in the URLs. Consequently, if I name the output as nid.txt, it will look horrible in the wiki; however, title.txt will break links in any article that references another.
      • Note: The solution is symlinking, but it's a rather ugly solution...
  • Taxonomy
    • There's no way to preserve the taxonomy hierarchies or to allow multiple category selection.
    • Posts are limited to using a single category, which can be implemented via namespaces.
      • Note: There appears to be a multi-namespace plugin for DokuWiki, but I didn't get around to playing with it.
  • Re-formatting Content
    • Really converting all the existing HTML formatting (which isn't necessarily consistent and often includes just the use of <B> tags for headers) into structured DokuWiki pages is onerous.

Conclustion
It was a fun experiment, but I ended up sticking with Drupal. Converting was more effort than I considered it to be worth.