Page 1 of 1
Export tags from SMF to s9y
Posted: Mon Jan 04, 2010 4:07 pm
by 3nd3r
Hello!
Well, I've got a SMF forum (
http://www.pajareo.com/SMF) and I want to delete it. Thanks to Garvin in particular, I've migrated all the info except the tags...
So, in phpMyAdmin I see on pajareo_smf database two tables:
smf_tags
Code: Select all
Field Type
ID_TAG mediumint(8)
tag tinytext
approved tinyint(4)
The tags itselves are stored in 'tag' field and 'approved' field is always 1
And
smf_tags_log
Code: Select all
Field Type
ID int(11)
ID_TAG mediumint(8)
ID_TOPIC mediumint(8)
ID_MEMBER mediumint(8)
In which 'ID_TAG' field is the same as previous table, 'ID_TOPIC' points to the topic that the tag belongs, and ID_MEMBER is always 1 (the admin)
On the other hand, there is the smf_topics table with a 'ID_TOPIC' field inside.
So, considering that maybe a few post could been deleted since the import, how is possible to dump this tags into the correct posts on s9y?
I can pay a little (I'm unemployed right now) to someone who could help me with this stuff...
Re: Export tags from SMF to s9y
Posted: Thu Jan 07, 2010 12:40 am
by 3nd3r
Well, as Garvin tell me (thanks!!) to resolve this, I need to connect the post id from SMF to s9y... and that's a little... difficult...
In SMF the posts Id and its content are stored in a table as well as the comments, in
smf_messages:
Code: Select all
Field Type
ID_MSG int(10)
ID_TOPIC mediumint(8)
ID_BOARD smallint(5)
posterTime int(10)
ID_MEMBER mediumint(8)
So, we have different post 'Ids' in SMF and s9y, but in the importer from SMF to s9y we got (/include/admin/importers/smf.inc.php):
Code: Select all
/* Entries */
$res = @$this->nativeQuery("SELECT
tm.subject AS post_subject,
t.ID_MEMBER_STARTED AS topic_poster,
t.ID_BOARD AS forum_id,
tm.posterTime AS post_time,
tm.body AS post_text,
t.ID_TOPIC AS topic_id,
t.ID_FIRST_MSG AS post_id,
t.numReplies AS ccount
FROM {$this->data['prefix']}topics AS t
JOIN {$this->data['prefix']}messages AS tm
ON tm.ID_MSG = t.ID_FIRST_MSG
GROUP BY t.ID_TOPIC", $gdb);
if (!$res) {
return sprintf(COULDNT_SELECT_ENTRY_INFO, mysql_error($gdb));
}
for ($x=0, $max_x = mysql_num_rows($res) ; $x < $max_x ; $x++ ) {
$entries[$x] = mysql_fetch_assoc($res);
$entry = array('title' => $this->decode($entries[$x]['post_subject']),
'isdraft' => 'false',
'allow_comments' => 'true',
'timestamp' => $entries[$x]['post_time'],
'body' => $this->strtr($entries[$x]['post_text']),
'extended' => ''
);
$entry['authorid'] = '';
$entry['author'] = '';
foreach ($users as $user) {
if ($user['ID'] == $entries[$x]['topic_poster']) {
$entry['authorid'] = $user['authorid'];
$entry['author'] = $user['user_login'];
break;
}
}
if (!is_int($entries[$x]['entryid'] = serendipity_updertEntry($entry))) {
return $entries[$x]['entryid'];
}
And that could point the smf tags to the right post in s9y... I guess... I'm not a SQL nor PHP expert...
Re: Export tags from SMF to s9y
Posted: Thu Jan 07, 2010 5:57 pm
by garvinhicking
Hi!
After the import has been executed, you cannot redrive the ID assocation any longer.
One could modify the importer to also fetch the post ids, but then you would first have to delete all SMF imported blog entries first, or else you'D have them twice.
Writing up the code to make the importer fetch the tags wouldn't be too hard, but also take an hour or two to create...
Regards,
Garvin
Re: Export tags from SMF to s9y
Posted: Thu Jan 07, 2010 10:11 pm
by 3nd3r
I see... Well, it's ok... I think... I have to delete all entries from the beginning (s9y topic-id 2) to s9y topic-id 2771...

(What is the quick way to do this?)
Just have in consideration this please:
http://board.s9y.org/viewtopic.php?p=81557#p81557
I can PM you all the data you need, and you can tell me how can I pay you for this, ok?
Re: Export tags from SMF to s9y
Posted: Fri Jan 08, 2010 5:31 pm
by garvinhicking
Hi!
Sure, like I mentioned via PM, I can try to do that at the end of next week.
Regards,
Garvin
Re: Export tags from SMF to s9y
Posted: Fri Jan 08, 2010 6:17 pm
by 3nd3r
Ok! I'll PM you next friday then!
Thank you!