I have been using ))PhpNuke(( for my website for two years now, but I would like to move on to Tiki. To help others I'll describe this process for my own website.
This document describes the conversion from PhpNuke 6.0. It does not attempt to be a step-by-step conversion manual but I hope it will make conversions easier. Note: this type of conversions is not trivial.
The first step is to convert PhpNuke's stories to articles. These are similar structured in both CMS tools, so this shouldn't be extremely hard. Let's have a look at the table structures first.
mysql> describe nuke_stories ;
Field | Type | Null | Key | Default | Extra | |
sid | int(11) | PRI | NULL | auto_increment | ||
catid | int(11) | MUL | 0 | |||
aid | varchar(30) | |||||
title | varchar(80) | YES | NULL | |||
time | datetime | YES | NULL | |||
hometext | text | YES | NULL | |||
bodytext | text | |||||
comments | int(11) | YES | 0 | |||
counter | mediumint(8) unsigned | YES | NULL | |||
topic | int(3) | 1 | ||||
informant | varchar(20) | |||||
notes | text | |||||
ihome | int(1) | 0 | ||||
alanguage | varchar(30) | |||||
acomm | int(1) | 0 | ||||
haspoll | int(1) | 0 | ||||
pollID | int(10) | 0 | ||||
score | int(10) | 0 | ||||
ratings | int(10) | 0 |
19 rows in set (0.00 sec)
mysql> describe tiki_articles ;
Field | Type | Null | Key | Default | Extra | |
articleId | int(8) | PRI | NULL | auto_increment | ||
title | varchar(80) | YES | MUL | NULL | ||
authorName | varchar(60) | YES | NULL | |||
topicId | int(14) | YES | NULL | |||
topicName | varchar(40) | YES | NULL | |||
size | int(12) | YES | NULL | |||
useImage | char(1) | YES | NULL | |||
image_name | varchar(80) | YES | NULL | |||
image_type | varchar(80) | YES | NULL | |||
image_size | int(14) | YES | NULL | |||
image_x | int(4) | YES | NULL | |||
image_y | int(4) | YES | NULL | |||
image_data | longblob | YES | NULL | |||
publishDate | int(14) | YES | NULL | |||
created | int(14) | YES | NULL | |||
heading | text | YES | MUL | NULL | ||
body | text | YES | MUL | NULL | ||
hash | varchar(32) | YES | NULL | |||
author | varchar(200) | YES | NULL | |||
reads | int(14) | YES | MUL | NULL | ||
votes | int(8) | YES | NULL | |||
points | int(14) | YES | NULL | |||
type | varchar(50) | YES | NULL | |||
rating | decimal(3,2) | YES | NULL | |||
isfloat | char(1) | YES | NULL |
25 rows in set (0.00 sec)
The easiest way to convert between two different databases is to write a small script. I used PHP for this. As stated above it is important to keep the articleId and sid the same. These are unique keys. When experimenting with this script, it can be useful to remove all articles in Tiki sometimes. Syntax for that is:
The conversion from the PhpNuke date format (a textual representation, yyyy-mm-dd hh:mm) to the timestamps used by Wiki can be done using mktime(). PhpNuke doesn't make a difference between publish- and creation date (although programmed articles are supported). Therefore the script will consider the publish- and creation date to be the same.
An important difference in the rendering of PhpNuke and Tiki is the treatment of linebreaks. PhpNuke stores the contents of a story as HTML in the database. In TikiWiki the contents of an article is stored as text; when rendering an article linebreaks will be converted to <br /> tags. The obviously makes more sense when taking into account different outputs (that do not recognize HTML tags), but it requires a text conversion in this script.
This is a very preliminary version! It gives an indication of how the script will look like, it's far from usable. It converts only the 5 first articles.
The script:
<?php
error_reporting (E_ALL);
Function textConvert($original) {
$string = preg_replace("(\n)", "", $original);
$string = mysql_escape_string($string);
return $string;
}
Function Transfer () { global $id, $authorName, $title, $hometext, $bodytext, $time, $counter;
mysql_connect("localhost","root","");
$database="tiki";
@mysql_select_db($database) or die( "Unable to select database");
$publishTimeStamp = strtotime("$time");
$query = "insert into tiki_articles set articleId='$id', title='$title', reads='$counter', authorName='$authorName', created='$publishTimeStamp', type = 0, useImage='n',isfloat='n', heading= '$hometext', body= '$bodytext', hash= '', publishDate = '$publishTimeStamp' ";
$result=mysql_query($query) or die ("Query error: " . mysql_error());;
echo "Result: $result <br />";
}
echo "<html><head><title>Conversion</title></head><body>Conversion...";
mysql_connect("localhost","root",""); $database="nuke";
@mysql_select_db("$database") or die( "Unable to select database nuke");
$table="nuke_stories";
$query="select * from $table order by time desc";
$result=mysql_query($query);
$num=mysql_numrows($result);
echo "Number of rows: $num<br /><br />";
$i=0;
while ($i < $num):
$authorName=mysql_result($result,$i,"aid");
$title=textConvert(mysql_result($result,$i,"title"));
$hometext=textConvert(mysql_result($result,$i,"hometext"));
$bodytext=textConvert(mysql_result($result,$i,"bodytext"));
$id=mysql_result($result,$i,"id");
$time =mysql_result($result,$i,"time");
$counter = mysql_result($result, $i, "counter");
echo "$id $title, ";
Transfer ();
$i++;
endwhile;
?>
1) |
15 Aug 2024 14:00 GMT-0000
Tiki Roundtable Meeting |
2) |
19 Sep 2024 14:00 GMT-0000
Tiki Roundtable Meeting |
3) |
Tiki birthday |
4) |
17 Oct 2024 14:00 GMT-0000
Tiki Roundtable Meeting |
5) |
21 Nov 2024 14:00 GMT-0000
Tiki Roundtable Meeting |
6) |
19 Dec 2024 14:00 GMT-0000
Tiki Roundtable Meeting |