Loading...
 
Skip to main content

Custom Share Module 0.1dev

History: ConversionFromPhpNuke

Preview of version: 10

PhpNuke conversion

Introduction


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.

Assumptions

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.

Stories to Articles


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.

PhpNuke stories


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)

Tiki articles


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)

Observations

  • PhpNuke's rating is different in concept than Tiki's. In PhpNuke it indicates the opinion of readers about a page, in Tiki it is a rating given by the author of the article about the subject of the article.
  • The unique identifier of a story (sid) is an integer with length 11, whereas Tiki's articleId has 8 as length. This indicates the display size only; the data-type is still integer so conversion is possible.
  • For many websites the ID of an article is known outside the database, it is often used in links for example. Therefore it's important to keep the articleId and sid in sync.
  • The date-type used in PhpNuke is datetime, Tiki uses an int for this.

Conversion


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:

Removing Tiki articles: delete from tiki_articles ;

Scripts

This is a very preliminary version! It gives an indication of how the script will look like, it's far from usable.

The script:

<?php
error_reporting (E_ALL);
Function Transfer () { global $id, $authorName, $title, $hometext, $bodytext;

mysql_connect("localhost","root","");

$database="tiki";
@mysql_select_db($database) or die( "Unable to select database");

$query = "insert into tiki_articles set title='$title', authorName='$authorName', created='1060680360', type = 0, heading= '$hometext', body= '$bodytext', hash= '', publishDate = '1061317680' ";

$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 limit 0,5";

$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=mysql_result($result,$i,"title");
$hometext=mysql_escape_string(mysql_result($result,$i,"hometext"));
$bodytext=mysql_result($result,$i,"bodytext");
$id=mysql_result($result,$i,"id");
echo "$id $title, ";
Transfer ();

$i++;
endwhile;

?>

History

Advanced
Information Version
guusbosman 17
View
guusbosman I won't use TikiWiki... 16
View
guusbosman Added goals 15
View
guusbosman 14
View
guusbosman Completed textconversion for body and heading parts of articles. 13
View
guusbosman 12
View
guusbosman Added conversion of publish and creation time for articles. 11
View
Marc Laporte added to an additional category 10
View
guusbosman Added first version of the conversion script. 9
View
guusbosman 8
View

Upcoming Events

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