Discuz!站点经常遇到的问题就是恶意注册和恶意灌水网站在被灌水后整个网站整体体验就会下降
注册量大了之后会造成空间占用庞大、查询速度下降等问题
而后台删除功能非常消耗系统性能
并且容易造成误操作删除管理员等问题
因此通过数据库直接删除会员以及相关信息会极大的提高删除效率
在此提供一些常用的关联删除方法方便各位站长使用
执行sql可以通过phpmyadmin进行
如果没有phpmyadmin的站长可以通过修改config_global.php
$_config['admincp']['runquery'] = '0';
其中0改成1
$_config['admincp']['runquery'] = '1';
这样就可以通过后台-站长-数据库-升级执行sql语句
一般注册机与灌水机都是批量的注册论坛模板账户并灌水发帖
因此注册的uid一般是连续的
可以通过uid来批量删除用户及相关数据
比如大于某uid的批量删除的sql
set @delid = 1000000;
delete from pre_home_feed where uid > @delid;
delete from pre_home_share where uid > @delid;
delete from pre_home_comment where uid > @delid;
delete from pre_home_blogfield where uid > @delid;
delete from pre_home_blog where uid > @delid;
delete from pre_home_class where uid > @delid;
delete from pre_home_pic where uid > @delid;
delete from pre_common_member where uid > @delid;
delete from pre_common_member_count where uid > @delid;
delete from pre_common_member_field_forum where uid > @delid;
delete from pre_common_member_field_home where uid > @delid;
delete from pre_home_album where uid > @delid;
delete from pre_home_docomment where uid > @delid;
delete from pre_home_doing where uid > @delid;
delete from pre_home_notification where authorid > @delid;
delete from pre_forum_post where authorid > @delid;
delete from pre_forum_thread where authorid > @delid;
delete from pre_portal_comment where uid > @delid;
delete from pre_common_member_profile where uid > @delid;
delete from pre_common_member_status where uid > @delid;
delete from pre_ucenter_members where uid > @delid;
其中
set @delid = 1000000;
是定义uid=1000000
大于该uid的用户和关联数据全部删除
可以根据自己站点实际情况定义该值
其中的语句可以单独拆分进行处理
删除数据后还要对网站进行一下扫尾工作
1.登录后台-工具-更新缓存,避免前台数据与实际数据不吻合。
2.登录后台-站长-数据库-优化,对数据库碎片进行优化,减少占用,提升效率。
此文由 网站目录_网站网址收录与提交入口 编辑,未经允许不得转载!: