最新最全的移动资源,海量教程攻略!

网站首页 > 技术支持 > discuz > discuz使用教程 > Discuz! X 批量删除或通过待审核的帖子最新

Discuz! X 批量删除或通过待审核的帖子最新

作者: 资源猫 时间: 2020-03-08 20:15:08 人气: 6

执行以下SQL语句即可,为避免出错,建议操作前备份数据库。
注意:有分表时,需要对分表也执行相关语句。仅供参考,谨慎操作!
批量审核通过待审核的主题
update pre_forum_thread set displayorder=0 where displayorder=-2;
update pre_forum_post set invisible=0 where invisible=-2 and first=1;
delete from pre_forum_thread_moderate where status=0;
批量审核通过待审核、已忽略的主题
update pre_forum_thread set displayorder=0 where displayorder=-3;
update pre_forum_post set invisible=0 where invisible=-3 and first=1;
delete from pre_forum_thread_moderate where status=1;
批量审核通过待审核的回帖
update pre_forum_post set invisible=0 where invisible=-2;
delete from pre_forum_post_moderate where status=0;
批量审核通过待审核、已忽略的回帖
update pre_forum_post set invisible=0 where invisible=-3;
delete from pre_forum_post_moderate where status=1;
批量执行上述四项操作
update pre_forum_thread set displayorder=0 where displayorder in (-2,-3);
update pre_forum_post set invisible=0 where invisible in (-2,-3);
TRUNCATE pre_forum_thread_moderate;
TRUNCATE pre_forum_post_moderate;
批量删除等待审核的主题
delete from pre_forum_thread where displayorder=-2;
delete from pre_forum_thread_moderate where status=0;
批量删除等待审核、已忽略的主题
delete from pre_forum_thread where displayorder=-3;
delete from pre_forum_thread_moderate where status=1;
批量删除等待审核的回帖
delete from pre_forum_post where invisible=-2;
delete from pre_forum_post_moderate where status=0;
批量删除等待审核、已忽略的回帖
delete from pre_forum_post where invisible=-3;
delete from pre_forum_post_moderate where status=1;
批量执行上述四项操作
delete from pre_forum_thread where displayorder in (-2,-3);
TRUNCATE pre_forum_thread_moderate;
delete from pre_forum_post where invisible in (-2,-3);
TRUNCATE pre_forum_post_moderate;
批量移除待审核、草稿、回收站内容
delete from pre_forum_thread where displayorder
TRUNCATE pre_forum_thread_moderate;
delete from pre_forum_post where invisible
TRUNCATE pre_forum_post_moderate;
清空回收站中的主题
DELETE FROM `pre_forum_thread` WHERE `displayorder` = -1
清空回收站中的回帖
DELETE FROM `pre_forum_post` WHERE `invisible` = -5
清空回收站中的日志
DELETE FROM `pre_home_blog` WHERE `status` = -1
冗余数据清理:
清除主帖已不存在的回帖,即post表中记录的tid在thread表中不存在时清除post表中的该行记录。
pre_forum_thread 有分表时禁用!pre_forum_post 有分表时,需要分别对每个分表执行下列语句(替换pre_forum_post为分表名,例如pre_forum_post_1)。
谨慎操作!!这边清理了一个月,未发现任何异常,但不排除有未知影响!
DELETE pre_forum_post FROM pre_forum_post LEFT JOIN pre_forum_thread ON pre_forum_post.tid=pre_forum_thread.tid WHERE pre_forum_thread.tid IS NULL
清除主帖已不存在的分类信息数据
DELETE pre_forum_typeoptionvar FROM pre_forum_typeoptionvar LEFT JOIN pre_forum_thread ON pre_forum_typeoptionvar.tid=pre_forum_thread.tid WHERE pre_forum_thread.tid IS NULL

感谢访问资源猫吧,本站所有资源均来自互联网或用户分享,如您发现本站存在侵权或违规内容,请来邮件告知我们! 资源分享/侵权下架/商务合作联系邮箱:qiazou77ziyuan@126.com