IsaacZ 发表于 2011-4-12 21:59:06

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

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

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


delete from uc_members where uid not in(select uid from cdb_members);
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 用户:
delete from uchome_member where uid not in(select uid from cdb_members);

同时删除Uchome 空间:
delete from uchome_space where uid not in(select uid from cdb_members);

同时删除Uchome 无效日志:
delete from uchome_blog where uid not in(select uid from cdb_members);
delete from uchome_blogfield where uid not in(select uid from cdb_members);

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


这样那些垃圾就没有啦!


再重复贴一次上面的全部代码,下次好直接使用:delete from uc_members where uid not in(select uid from cdb_members);
delete from uc_memberfields where uid not in(select uid from cdb_members);
delete from uchome_member where uid not in(select uid from cdb_members);
delete from uchome_space where uid not in(select uid from cdb_members);
delete from uchome_blog where uid not in(select uid from cdb_members);
delete from uchome_blogfield where uid not in(select uid from cdb_members);
delete from uchome_feed where uid not in(select uid from cdb_members);
页: [1]
查看完整版本: SQL代码:同步UCenter、Discuz 和 Uchome中的用户及与用户相关的日志或动态信息