CatPtain commited on
Commit
6f5637f
·
verified ·
1 Parent(s): 8ae613a

Delete wp-config.php

Browse files
Files changed (1) hide show
  1. wp-config.php +0 -146
wp-config.php DELETED
@@ -1,146 +0,0 @@
1
- <?php
2
- /**
3
- * WordPress配置文件 - 适配Hugging Face Spaces
4
- * 使用SQLite数据库,包含自动清理和监控功能
5
- */
6
-
7
- // ** SQLite数据库设置 ** //
8
- define('DB_NAME', 'wordpress');
9
- define('DB_USER', 'wordpress');
10
- define('DB_PASSWORD', 'wordpress');
11
- define('DB_HOST', 'localhost');
12
- define('DB_CHARSET', 'utf8');
13
- define('DB_COLLATE', '');
14
-
15
- // 启用SQLite数据库集成
16
- define('USE_MYSQL', false);
17
- define('DB_FILE', 'database/wordpress.db');
18
- define('DB_DIR', '/var/www/html/wp-content/');
19
-
20
- // ** 认证密钥和盐值 ** //
21
- // 为了安全,请更改这些值
22
- define('AUTH_KEY', 'put your unique phrase here');
23
- define('SECURE_AUTH_KEY', 'put your unique phrase here');
24
- define('LOGGED_IN_KEY', 'put your unique phrase here');
25
- define('NONCE_KEY', 'put your unique phrase here');
26
- define('AUTH_SALT', 'put your unique phrase here');
27
- define('SECURE_AUTH_SALT', 'put your unique phrase here');
28
- define('LOGGED_IN_SALT', 'put your unique phrase here');
29
- define('NONCE_SALT', 'put your unique phrase here');
30
-
31
- // ** WordPress数据表前缀 ** //
32
- $table_prefix = 'wp_';
33
-
34
- // ** WordPress调试模式 ** //
35
- define('WP_DEBUG', false);
36
- define('WP_DEBUG_LOG', true);
37
- define('WP_DEBUG_DISPLAY', false);
38
-
39
- // ** 文件权限 ** //
40
- define('FS_METHOD', 'direct');
41
-
42
- // ** 内存限制 ** //
43
- ini_set('memory_limit', '256M');
44
-
45
- // ** 上传文件大小限制 ** //
46
- ini_set('upload_max_filesize', '64M');
47
- ini_set('post_max_size', '64M');
48
-
49
- // ** 自动清理配置 ** //
50
- // 文件保留期限(天数)
51
- define('FILE_RETENTION_DAYS', 365); // 1年
52
-
53
- // 清理功能开关
54
- define('AUTO_CLEANUP_ENABLED', true);
55
-
56
- // 清理日志路径
57
- define('CLEANUP_LOG_PATH', '/var/log/wordpress/cleanup.log');
58
-
59
- // ** 性能优化 ** //
60
- // 禁用文件编辑
61
- define('DISALLOW_FILE_EDIT', true);
62
-
63
- // 自动保存间隔(秒)
64
- define('AUTOSAVE_INTERVAL', 300); // 5分钟
65
-
66
- // 修订版本数量限制
67
- define('WP_POST_REVISIONS', 5);
68
-
69
- // 垃圾箱自动清空天数
70
- define('EMPTY_TRASH_DAYS', 30);
71
-
72
- // ** 安全设置 ** //
73
- // 禁用XML-RPC
74
- define('XMLRPC_ENABLED', false);
75
-
76
- // 限制登录尝试
77
- define('LIMIT_LOGIN_ATTEMPTS', true);
78
-
79
- // ** Hugging Face Spaces特定设置 ** //
80
- // 设置正确的URL
81
- if (isset($_SERVER['HTTP_HOST'])) {
82
- $protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http';
83
- define('WP_HOME', $protocol . '://' . $_SERVER['HTTP_HOST']);
84
- define('WP_SITEURL', $protocol . '://' . $_SERVER['HTTP_HOST']);
85
- }
86
-
87
- // 信任代理头
88
- if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
89
- $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
90
- }
91
-
92
- // ** 自定义函数 ** //
93
- // 添加清理统计到管理面板
94
- function add_cleanup_stats_to_dashboard() {
95
- if (current_user_can('manage_options')) {
96
- add_action('wp_dashboard_setup', 'cleanup_dashboard_widget');
97
- }
98
- }
99
-
100
- function cleanup_dashboard_widget() {
101
- wp_add_dashboard_widget(
102
- 'cleanup_stats_widget',
103
- '文件清理统计',
104
- 'display_cleanup_stats'
105
- );
106
- }
107
-
108
- function display_cleanup_stats() {
109
- $log_file = CLEANUP_LOG_PATH;
110
- if (file_exists($log_file)) {
111
- $log_content = file_get_contents($log_file);
112
- $lines = explode("\n", $log_content);
113
- $recent_lines = array_slice($lines, -10); // 显示最近10行
114
-
115
- echo '<div style="max-height: 200px; overflow-y: auto;">';
116
- echo '<h4>最近清理记录:</h4>';
117
- foreach ($recent_lines as $line) {
118
- if (!empty(trim($line))) {
119
- echo '<p style="font-size: 12px; margin: 2px 0;">' . esc_html($line) . '</p>';
120
- }
121
- }
122
- echo '</div>';
123
- } else {
124
- echo '<p>暂无清理记录</p>';
125
- }
126
- }
127
-
128
- // 启用清理统计
129
- if (AUTO_CLEANUP_ENABLED) {
130
- add_action('init', 'add_cleanup_stats_to_dashboard');
131
- }
132
-
133
- // 禁用XML-RPC
134
- if (!XMLRPC_ENABLED) {
135
- add_filter('xmlrpc_enabled', '__return_false');
136
- }
137
-
138
- /* 就是这样!停止编辑。祝您使用愉快! */
139
-
140
- /** WordPress目录的绝对路径。 */
141
- if (!defined('ABSPATH')) {
142
- define('ABSPATH', __DIR__ . '/');
143
- }
144
-
145
- /** 设置WordPress变量和包含的文件。 */
146
- require_once ABSPATH . 'wp-settings.php';