So it seems that the liquid module is the de facto standard drupal wiki module, and that's great, i'm glad to see such an effort take place.

I was using the wiki.module in 4.6 and since it doesn't seem to be ported to 4.7 (let alone 5.0!), I have migrated to liquid. I think it would be nice to offer people a migration path from wiki to liquid.

I have produced the following php snippet to convert links in teaser and body. It is *really* not elegant, but it basically does what it should here. I converted around 100 nodes with this script. It could use refactoring and could parse more than just links, but I still think it's a good starting base.


$q = db_query("SELECT nid,body FROM node_revisions WHERE format = 4");

while ($row = db_fetch_object($q)) {
  $matches = array();
  print "updating nid: " . $row->nid . ": ";
  $body = preg_replace('/\[([^|]*)\|([^]]*)\]/', '[\2 \1]', $row->body);
  if ($body != $row->body) {
    $query = "UPDATE node_revisions SET body = '" . db_escape_string($body) . "' WHERE nid = " . $row->nid;
    if (db_query($query)) {
      print "fixed";
    } else {
      print "error: " . db_error();
    }
  } else {
    print "no match";
  }
  print "<br/>";
}

$q = db_query("SELECT nid,teaser FROM node_revisions WHERE format = 4");

while ($row = db_fetch_object($q)) {
  $matches = array();
  print "updating nid: " . $row->nid . ": ";
  $body = preg_replace('/\[([^|]*)\|([^]]*)\]/', '[\2 \1]', $row->teaser);
  if ($body != $row->teaser) {
    $query = "UPDATE node_revisions SET teaser = '" . db_escape_string($body) . "' WHERE nid = " . $row->nid;
    if (db_query($query)) {
      print "fixed";
    } else {
      print "error: " . db_error();
    }
  } else {
    print "no match";
  }
  print "<br/>";
}

Comments

anarcat’s picture

Note that running the script twice might produce unexpected results, as the regular expression assumes that the [ ] signs are actual PhpWiki links, not media wiki links.

sorenp’s picture

Status: Needs work » Closed (won't fix)

My intention is that Liquid should provide the Wiki infrastructure to Drupal rather than specific markups. For this reason, the development of the Liquid Filter module will focus on providing infrastructure for Liquid Wiki Filters rather than supporting any specific markups. As soon as the basic infrastructure has been set up, the Media Wiki Markup support in Liquid will be dropped. A new project will be started to take care of the Media Wiki Liquid Filter, but I will not take any responsibility for the development. Until then, the module will be included for testing purposes, but no active development will be done except for things connected to the Liquid Filter Interface.

I know there are other approaches running on Drupal when it comes to Wiki Markup Filters. My suggestion is that you take a look at those or, if you have the time, start a Liquid MedaWiki Markup Filter project.

// Soren