#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
删除 settings.php 中重复的 AI 垃圾评论识别部分
"""
def remove_duplicate_spam_detection():
with open('settings.php', 'r', encoding='utf-8') as f:
lines = f.readlines()
# 删除第 4619-5204 行(Python 索引从 0 开始,所以是 4618-5203)
# 第 4619 行是
|
(在 subsection-comment-appearance 之前)
start_line = 4618 # 第 4619 行(索引从 0 开始)
end_line = 5204 # 第 5205 行(不包含)
# 保留前面和后面的内容
new_lines = lines[:start_line] + lines[end_line:]
# 写回文件
with open('settings.php', 'w', encoding='utf-8') as f:
f.writelines(new_lines)
deleted_lines = end_line - start_line
print(f"✓ 已删除第 {start_line + 1}-{end_line} 行(共 {deleted_lines} 行)")
print(f"✓ 文件行数:{len(lines)} → {len(new_lines)} (-{deleted_lines})")
if __name__ == '__main__':
remove_duplicate_spam_detection()