tips:tikiwiki2dokuwiki
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionLast revisionBoth sides next revision | ||
wiki:tips:tikiwiki2dokuwiki [2008-04-11 16:37] – moved from dokuwiki2tikiwiki andi | tips:tikiwiki2dokuwiki [2016-10-10 14:38] – treegb | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Tikiwiki2Dokuwiki ====== | ||
+ | I've done this script to migrate our tikiwiki. It is provided as is without guaranty or support of any kind. Feel free to improve or modify it as you need. | ||
+ | |||
+ | It export the pages from the Tikiwiki database and convert some of the syntax. There is no history export. | ||
+ | |||
+ | After it's done, copy the files in /pages directory to your wiki. | ||
+ | |||
+ | --- // | ||
+ | |||
+ | Aditional notes: | ||
+ | |||
+ | You need to run it from php. (~$php ./ | ||
+ | |||
+ | < | ||
+ | <?php | ||
+ | // You must copy utf8.php from Dokuwki in the same directory | ||
+ | // and create a pages directory. | ||
+ | |||
+ | require_once(' | ||
+ | |||
+ | $conf = array(); | ||
+ | $conf[' | ||
+ | $conf[' | ||
+ | $conf[' | ||
+ | |||
+ | // Function cleanID copied from Dokuwiki | ||
+ | /** | ||
+ | * Remove unwanted chars from ID | ||
+ | * | ||
+ | * Cleans a given ID to only use allowed characters. Accented characters are | ||
+ | * converted to unaccented ones | ||
+ | * | ||
+ | * @author Andreas Gohr < | ||
+ | * @param | ||
+ | * @param | ||
+ | */ | ||
+ | function cleanID($raw_id, | ||
+ | global $conf; | ||
+ | static $sepcharpat = null; | ||
+ | |||
+ | global $cache_cleanid; | ||
+ | $cache = & $cache_cleanid; | ||
+ | |||
+ | $sepchar = $conf[' | ||
+ | if($sepcharpat == null) // build string only once to save clock cycles | ||
+ | $sepcharpat = '# | ||
+ | |||
+ | $id = trim($raw_id); | ||
+ | $id = utf8_strtolower($id); | ||
+ | |||
+ | // | ||
+ | $id = strtr($id,';',':' | ||
+ | if($conf[' | ||
+ | $id = strtr($id,'/',':' | ||
+ | }else{ | ||
+ | $id = strtr($id,'/', | ||
+ | } | ||
+ | |||
+ | if($conf[' | ||
+ | if($conf[' | ||
+ | |||
+ | //remove specials | ||
+ | $id = utf8_stripspecials($id, | ||
+ | |||
+ | if($ascii) $id = utf8_strip($id); | ||
+ | |||
+ | //clean up | ||
+ | $id = preg_replace($sepcharpat, | ||
+ | $id = preg_replace('#: | ||
+ | $id = trim($id,': | ||
+ | $id = preg_replace('#: | ||
+ | |||
+ | $cache[$raw_id] = $id; | ||
+ | return($id); | ||
+ | } | ||
+ | |||
+ | |||
+ | print "< | ||
+ | |||
+ | |||
+ | $query = " | ||
+ | |||
+ | $link = mysql_connect(" | ||
+ | mysql_select_db(" | ||
+ | $result = mysql_query($query) or die(" | ||
+ | $x = 0; | ||
+ | while ($line = mysql_fetch_array($result)) { | ||
+ | $x++; | ||
+ | print $x . " " . $line[' | ||
+ | |||
+ | // Conversion from Tikiwiki 2 Dokuwiki syntax | ||
+ | | ||
+ | $line[' | ||
+ | | ||
+ | $line[' | ||
+ | $line[' | ||
+ | $line[' | ||
+ | $line[' | ||
+ | $line[' | ||
+ | | ||
+ | $line[' | ||
+ | $line[' | ||
+ | $line[' | ||
+ | $line[' | ||
+ | $line[' | ||
+ | | ||
+ | | ||
+ | |||
+ | // table | ||
+ | $line[' | ||
+ | $line[' | ||
+ | $line[' | ||
+ | $line[' | ||
+ | $line[' | ||
+ | $line[' | ||
+ | $line[' | ||
+ | $line[' | ||
+ | // end of table conversion | ||
+ | | ||
+ | $line[' | ||
+ | $line[' | ||
+ | | ||
+ | $line[' | ||
+ | $line[' | ||
+ | | ||
+ | // | ||
+ | |||
+ | // not all emote are in dokuwiki | ||
+ | $tikiwiki_emote = array(" | ||
+ | $dokuwiki_emote = array(": | ||
+ | $line[' | ||
+ | |||
+ | $filename = dirname(__FILE__) . "/ | ||
+ | $handle = fopen($filename, | ||
+ | fwrite($handle, | ||
+ | fclose ($handle); | ||
+ | } | ||
+ | mysql_free_result($result); | ||
+ | mysql_close($link); | ||
+ | </ | ||
+ | |||
+ | ==== Discussion ==== | ||
+ | |||
+ | This php script does the job good, but only does 50% of the job. I have 67 wiki page but it only output (to '' | ||
+ | But this script is a good starting point I think, it probably work well after some trim. Thanks for sharing :-) --- [[user> |
tips/tikiwiki2dokuwiki.txt · Last modified: 2023-03-02 12:03 by Aleksandr