使用contrib/fb2k2smth下的conv_pc4fb2k.c,但存在些问题:
1、有两处地方的INSERT SQL,应该是由于Blog数据库相应的表结构做了扩充,需要做相应的修改,对照着新的表结构改就是,下边是个示例。
一处是在add_pc_users(struct pc_users *pn) 函数里,改为如下:
if (pn->uid <= 0)
sprintf(sql, "INSERT INTO users VALUES (NULL, '%s', '%s', '%s', 'o
thers', %d, %d, '%s', 0 ,NULL,0,0,NULL,'%s' , '' , 0 , 600 , 5 , '' , 0 , '%s' ,
'' , 0 , 0, '其他类别',0,0,1,'0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0
/0/0/0/0/0/0/','0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/',
0);", pn->username, newcorp, newdesc, pn->nodelimit, pn->dirlimit, tt2timestamp
(pn->createtime, newts), tt2timestamp(pn->createtime, newts), tt2timestamp(pn->c
reatetime, newts));
另外一处在add_pc_nodes_to_mysql(struct pc_nodes *pn, int tid),改为:
sprintf(ql, "INSERT INTO nodes VALUES (NULL, 0, 0, '%s', '%s', '%s', '%s
', %d, 1, 0, '%s', '%s', 0, 0, %d , 0, 0, 1, 0, 0, '%s', 0,'','','','');", news
ource, newhostname,
tt2timestamp(pn->changed, newts),
tt2timestamp(pn->created, newts1),
pn->uid,
newsubject,
pn->body ? newbody : "",
tid,
tt2timestamp(pn->created, newts1)
);
2、每个用户的文集目录只取第一篇文章
这个原因是add_pc_nodes_to_mysql函数最后少了一段判断。
在
if (mysql_real_query(&s, ql, strlen(ql))) {
printf("%s\n", mysql_error(&s));
if (pn->body)
free(newbody);
free(ql);
return 0;
}
和
if (pn->body)
free(newbody);
free(ql);
之间插入一段:
sprintf(ql, "SELECT nid FROM nodes WHERE uid= %d and subject=\"%s\" ", p
n->uid,newsubject);
if (mysql_real_query(&s, ql, strlen(ql)))
{
printf("%s\n", mysql_error(&s));
return 0;
}
res = mysql_store_result(&s);
row = mysql_fetch_row(res);
if( row != NULL)
{
nid = atoi(row[0]);
printf("NodeID is %d, ", nid);
}
else
nid = 0;
在函数最后:
mysql_free_result(res);
return nid
3、小问题,该不该也行,这外部工具使用的参数中的个人文集目录最后要带"/",很麻烦,找到下边这句:
snprintf(pc_path, 256, "%s/%c", argv[1], rootchar);
在%c后边假设个/就行。
这样改一下还有些文集文章标题转换的小问题,不过也可以凑合使用。
--
FROM 218.14.52.*