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

来自版块 Discuz教程
1808
0
温馨提示:如下载链接失效,请前往 问题反馈专用帖 进行反馈! 兔源码交流群:493651246
执行以下SQL语句即可,为避免出错,建议操作前备份数据库。
注意:有分表时,需要对分表也执行相关语句。仅供参考,谨慎操作!

批量审核通过待审核的主题
  1. update pre_forum_thread set displayorder=0 where displayorder=-2;
  2. update pre_forum_post set invisible=0 where invisible=-2 and first=1;
  3. delete from pre_forum_thread_moderate where status=0;
复制代码
批量审核通过待审核、已忽略的主题
  1. update pre_forum_thread set displayorder=0 where displayorder=-3;
  2. update pre_forum_post set invisible=0 where invisible=-3 and first=1;
  3. delete from pre_forum_thread_moderate where status=1;
复制代码
批量审核通过待审核的回帖
  1. update pre_forum_post set invisible=0 where invisible=-2;
  2. delete from pre_forum_post_moderate where status=0;
复制代码
批量审核通过待审核、已忽略的回帖
  1. update pre_forum_post set invisible=0 where invisible=-3;
  2. delete from pre_forum_post_moderate where status=1;
复制代码
批量执行上述四项操作
  1. update pre_forum_thread set displayorder=0 where displayorder in (-2,-3);
  2. update pre_forum_post set invisible=0 where invisible in (-2,-3);
  3. TRUNCATE pre_forum_thread_moderate;
  4. TRUNCATE pre_forum_post_moderate;
复制代码
批量删除等待审核的主题
  1. delete from pre_forum_thread where displayorder=-2;
  2. delete from pre_forum_thread_moderate where status=0;
复制代码
批量删除等待审核、已忽略的主题
  1. delete from pre_forum_thread where displayorder=-3;
  2. delete from pre_forum_thread_moderate where status=1;
复制代码
批量删除等待审核的回帖
  1. delete from pre_forum_post where invisible=-2;
  2. delete from pre_forum_post_moderate where status=0;
复制代码
批量删除等待审核、已忽略的回帖
  1. delete from pre_forum_post where invisible=-3;
  2. delete from pre_forum_post_moderate where status=1;
复制代码
批量执行上述四项操作
  1. delete from pre_forum_thread where displayorder in (-2,-3);
  2. TRUNCATE pre_forum_thread_moderate;
  3. delete from pre_forum_post where invisible in (-2,-3);
  4. TRUNCATE pre_forum_post_moderate;
复制代码
批量移除待审核、草稿、回收站内容
  1. delete from pre_forum_thread where displayorder<0;
  2. TRUNCATE pre_forum_thread_moderate;
  3. delete from pre_forum_post where invisible<0;
  4. TRUNCATE pre_forum_post_moderate;
复制代码
清空回收站中的主题
  1. DELETE FROM `pre_forum_thread` WHERE `displayorder` = -1
复制代码
清空回收站中的回帖
  1. DELETE FROM `pre_forum_post` WHERE `invisible` = -5
复制代码
清空回收站中的日志
  1. 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)。
谨慎操作!!这边清理了一个月,未发现任何异常,但不排除有未知影响!
  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
复制代码
清除主帖已不存在的分类信息数据
  1. 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
复制代码

全部评论 0

您需要登录后才可以回帖 立即登录
输入你要评论的内容......
0
0
0
返回顶部