找回密码
 立即注册

QQ登录

只需一步,快速开始

教程经验总索引TVMW5/小日本5 索引【视频转换】小日本4/TE4XP 索引【视频转换】TAW4 / TDA3 索引【DVD打包软件】
Nero 索引DVD-Lab 索引【DVD打包软件】编解码器 索引 【必读】固顶帖011号
查看: 3343|回复: 0

[Discuz!论坛] SQL代码:同步UCenter、Discuz 和 Uchome中的用户及与用户相关的日志或动态信息

[复制链接]

9333

威望

818

金钱

1万

贡献

管理员

自由的灵魂

积分
100458
主题
5590
回帖
26310
注册时间
2003-4-10
最后登录
2024-11-21
发表于 2011-4-12 21:59:06 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

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

×
本帖最后由 IsaacZ 于 2011-5-12 23:34 编辑

把在uc中有,而论坛用户表中没有的用户,给删除掉,可用以下代码升级数据库:


  1. delete from uc_members where uid not in(select uid from cdb_members);
  2. delete from uc_memberfields where uid not in(select uid from cdb_members);
复制代码


操作前请备份UC的数据库 uc_ 请自行替换为自己的表前缀 如果是FULL版本 就是cdb_uc_

以上来源:http://www.discuz.net/forum.php?mod=redirect&goto=findpost&ptid=1516259&pid=12750127



IsaacZ补注:同样地,可以使 Uchome 用户与论坛同步。代码如下:

删除无效Uchome 用户:
  1. delete from uchome_member where uid not in(select uid from cdb_members);
复制代码

同时删除Uchome 空间:
  1. delete from uchome_space where uid not in(select uid from cdb_members);
复制代码

同时删除Uchome 无效日志:
  1. delete from uchome_blog where uid not in(select uid from cdb_members);
  2. delete from uchome_blogfield where uid not in(select uid from cdb_members);
复制代码

删除论坛垃圾帖子传过来的动态(确保操作前已经在论坛和UC删除了相关用户):
  1. delete from uchome_feed where uid not in(select uid from cdb_members);
复制代码


这样那些垃圾就没有啦!


再重复贴一次上面的全部代码,下次好直接使用:
  1. delete from uc_members where uid not in(select uid from cdb_members);
  2. delete from uc_memberfields where uid not in(select uid from cdb_members);
  3. delete from uchome_member where uid not in(select uid from cdb_members);
  4. delete from uchome_space where uid not in(select uid from cdb_members);
  5. delete from uchome_blog where uid not in(select uid from cdb_members);
  6. delete from uchome_blogfield where uid not in(select uid from cdb_members);
  7. delete from uchome_feed where uid not in(select uid from cdb_members);
复制代码
IsaacZ的发言中如果提到任何字母缩写或专有名词,在本论坛中一般都能搜索到。点此立即搜索点拨论坛。如有搜索不到的,请尝试搜索百度百科,或者跟帖提问。
发帖前请注意看置顶帖。如果你发现自己的问题没有得到回答,说明你的问题提错了地方或者提问前未先阅读版规。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|点拨论坛 |网站地图

GMT+8, 2024-11-23 18:23 , Processed in 0.085540 second(s), 3 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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