News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

FSB2 to SMF

Started by cardia, August 25, 2013, 09:37:23 AM

Previous topic - Next topic

cardia

Hi,

I plan to convert a FSB2 (fire soft board) forum to SMF. Since no converter exists, I plan to make one.

However, I never made a converter so I'd appreciate if someone could point me to tutorials or relevant resources to make a converter.


(Fire soft board is not anymore supported and its development stopped years ago.)

emanuele

Hi cardia and welcome to sm.org.

Unfortunately there isn't any tutorial that I know of...
What I do the few times I try to write/adapt a converter is take an existing one and work on it. :(

If you have any question about it, feel free to ask, we'll try to answer and maybe at the end we can collect them and create a wiki page with some resources. ;)


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

cardia

I gladly help write a wiki page for it, but I haven't found how to create or edit a page on the sm wiki. But it can wait.

So far I managed to figure out how the duo converter.php/script.sql mainly works. I managed to convert most of the "members" table (what's remaining is not worth the trouble for me).

The first real problem I encounter is that my FSB2 data is in latin9 encoding while I want the SMF data to be in utf-8 and I haven't figured out how to convert between the two formats using SQL. I guess I could do it later with a php script, but if a way exists in SQL it might be easier.



As a start, for the wiki it would be nice to have a complete explanation of the header or the sql script, as I got trouble to figure out how it worked (and for some fields I'm not yet sure). I'm talking about :
---~ version: "SMF 2.0"
---~ settings: ... <- is it parsed as a txt file or interpreted by PHP ?
---~ defines: ... <- not yet sure how it works
---~ globals: ...
---~ from_prefix: ...
---~ table_test: ... <- I guess it's for a test of some kind, but I'm not sure witch.

Illori

Quote from: cardia on August 26, 2013, 07:24:49 AM
I gladly help write a wiki page for it, but I haven't found how to create or edit a page on the sm wiki. But it can wait.

to edit the wiki, it requires at least 10 posts on the forum first.

emanuele

Quote from: cardia on August 26, 2013, 07:24:49 AM
The first real problem I encounter is that my FSB2 data is in latin9 encoding while I want the SMF data to be in utf-8 and I haven't figured out how to convert between the two formats using SQL. I guess I could do it later with a php script, but if a way exists in SQL it might be easier.
I think it's better to separate the two processes. SMF has an admin maintenance task to convert the db from (hopefully) any kind of encoding to utf8, so once the conversion is finished you can then change the charset. ;)

Quote from: cardia on August 26, 2013, 07:24:49 AM
---~ settings: ... <- is it parsed as a txt file or interpreted by PHP ?
included and so parsed as php
Quote from: cardia on August 26, 2013, 07:24:49 AM
---~ defines: ... <- not yet sure how it works
Similar to global: you can define a set of variables that will be define'd (like in define('MYVAR', 'VAL'); ) in php while running the converter.
I *think* it is a comma separated list like:
---~ defines: MYVAR=VAL,MYVAR2=VAL2

Quote from: cardia on August 26, 2013, 07:24:49 AM
---~ table_test: ... <- I guess it's for a test of some kind, but I'm not sure witch.
It's a table of the db of the "source" (i.e. the database of the script you are converting from), used to test if the connection works.


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

cardia

Thanks!

FSB2's settings is not a valid PHP file (no "php?>" closing tag), anyway to go around that?

I found out how to convert HTML entities to utf8 using the admin maintenance task, but not how to convert between charsets. Anyway, SQL have tools for that but they do not want to work for me (I tried different methods for hours), so I wrote a dirty SQL function to do it. I guess I'll have to complement it with a bit of PHP to clean the data (FSB2 seems to do dirty and stupid hacks).

I managed to convert categories, boards and topics; I'm now doing the messages.

cardia

#6
OK, so I got this PHP bug. Since I didn't write the converter.php script, it will take a while for me to debug it, so any help would be greatly appreciated.

QuoteConverting...
---------------------------------------------------------
Converting posts (this may take some time)...

Notice: Undefined variable: result in /.../convert.php on line 2494

Notice: Undefined variable: result in /.../convert.php on line 2495

Warning: get_resource_type() expects parameter 1 to be resource, null given in /.../convert.php on line 2736

Notice: Undefined index: db_fetch_assoc in /.../convert.php on line 2740

Fatal error: Function name must be a string in /.../convert.php on line 2740

cardia

When converting posts, the script convert.php makes a pause after 6s not to overload the server.

When it resumes, the the global variables "$convert_dbs, $to_prefix, $command_line, $smcFunc" are not set anymore in the function convert_query(...) at line 2391. Which causes the previously mentioned errors.

Any idea of the cause and how to fix it?

cardia

I found the bug. I don't know who to contact to update the various converters, so I post the fix here.

In convert.php, replace the line 123 by the following code:
}else{
if (isset($_SESSION['convert_paths']) && !empty($_SESSION['convert_paths'][0])){
$_POST['path_from'] = $_SESSION['convert_paths'][0];
}
if (isset($_SESSION['convert_paths']) && !empty($_SESSION['convert_paths'][1])){
$_POST['path_to'] = $_SESSION['convert_paths'][1];
}
}

cardia

I've done my migration script. I'm know testing it, doing minor tweaks.

How can I upload the final version ?

mentalist

I'd add it as attachment to your first post..

emanuele

Sorry for not answering, I've been a bit busy in the last days (well, it was more resting :P).

Yep, attach it to the first message is the best way so that you can update it when needed and users can be sent directly to it. ;)


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Advertisement: