Files
argon-theme/tmp/remove-duplicate-spam-detection.py
nanhaoluo bd1e64319b refactor: 移除 functions.php 中的向后兼容代码
- 删除旧的多 API 管理函数(argon_get_provider_apis, argon_add_provider_api 等)
- 删除数据迁移函数 argon_migrate_ai_apis()
- 移除自动迁移钩子
- 简化 argon_get_ai_provider_config() 函数,移除回退逻辑
- 简化 argon_get_active_api_config() 函数,移除向后兼容逻辑
- 清理临时测试文件和脚本
2026-01-26 13:48:10 +08:00

31 lines
1.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/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 行是 <tr><th class="subtitle"><h3 id="subsection-comment-spam-detection">
# 第 5204 行是 </tr> (在 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()