Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[转换] DV8.3转DZX1.5,把收藏夹也转换

[复制链接]
mccad 发表于 2010-11-11 14:38:15 | 显示全部楼层 |阅读模式
本帖最后由 mccad 于 2010-11-11 14:43 编辑

我把step_6.php中的内容换成以下内容,以便转换收藏夹内容,成功了。原来step_6中的程序是用于转换交易的帖子,根本没有什么用,改掉也无所谓。当然,我自己是把转换交易帖子的部分转到第5步中去完成,这样pid才能得到正确的ID号。

  1. <?php
  2. //pre_home_favorite
  3. //favid uid    id idtype spaceuid title description dateline
  4. //id  username url                  topic            addtime

  5. if($start <= 1 ) {
  6. truncatetable('home_favorite');
  7. $db['discuz']->query("UPDATE {$discuz_tablepre}forum_thread set favtimes=0 ");
  8. }
  9. $query = $db['source']->query("SELECT id,username,url,topic,addtime FROM {$source_tablepre}bookmark WHERE topic <>'' and id BETWEEN $start AND $end;") or dexit("检索数据表 'bookmark' 错误!", 'mssql');
  10. while ($dvp = $db['source']->fetch_assoc($query)) {
  11. $dvp = array_change_key_case(daddslashes($dvp));
  12. //pre_forum_post
  13. $favid = $dvp['id'];
  14. $uid = getuid($dvp['username']);
  15. $id = getfavtid($dvp['url']);
  16. $idtype = 'tid';
  17. $spaceuid = 0;
  18. $title =$dvp['topic'];
  19. $description = '';
  20. $dateline = timetounix($dvp['addtime']);
  21. if ($id >0 && $uid >0){
  22.   $t_field1 = array('favid', 'uid', 'id', 'idtype', 'spaceuid', 'title', 'description', 'dateline');
  23.   $t_query1 = getinsertsql("{$discuz_tablepre}home_favorite", $t_field1);
  24.   if ($db['discuz']->query($t_query1)) {
  25.    $db['discuz']->query("UPDATE {$discuz_tablepre}forum_thread set favtimes=favtimes + 1 WHERE tid=$id ");
  26.    $convertedrows ++;
  27.   } else {
  28.    reportlog("转换收藏夹出错 favid = $favid , id = $id");
  29.   }
  30. }
  31. $converted = 1;
  32. $totalrows ++;
  33. }
  34. function getfavtid($url) {
  35. $id = 0;
  36. if (! strripos($url,"rootid="))  {
  37.   if ($txtid= strrchr($url,"&id=")) {
  38.    $id= substr($txtid,4);
  39.   }
  40. }
  41. return $id;
  42. }
复制代码

 楼主| mccad 发表于 2010-11-11 14:46:58 | 显示全部楼层
本帖最后由 mccad 于 2010-11-11 14:47 编辑

转换后,用户的收藏内容在DZ中可以正常使用。


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

12153556 发表于 2010-11-11 21:40:49 | 显示全部楼层
落果,支持、顶一下
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-10-2 16:21 , Processed in 0.096832 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表