-
Notifications
You must be signed in to change notification settings - Fork 13
/
AP_Clear_Cache.php
204 lines (167 loc) · 5.01 KB
/
AP_Clear_Cache.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
<?php
/**
* The Clear Cache plugin can be used to clear and reset the different PunBB
* caches if you are uncomfortable with or unable to manually edit the files
* in the cache directory.
*
* Copyright (C) 2002-2005 Neal Poole (smartys@gmail.com)
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
*/
// Make sure no one attempts to run this script "directly"
if (!defined('PUN'))
exit;
// Tell admin_loader.php that this is indeed a plugin and that it is loaded
define('PUN_PLUGIN_LOADED', 1);
require PUN_ROOT.'include/cache.php';
// If the "Regenerate all cache" button was clicked
if (isset($_POST['regen_all_cache']))
{
// We re-generate it all
generate_config_cache();
generate_bans_cache();
generate_quickjump_cache();
if (version_compare(FORUM_VERSION, '1.5', '<'))
{
generate_ranks_cache();
}
// Display the admin navigation menu
generate_admin_menu($plugin);
?>
<div id="exampleplugin" class="plugin blockform">
<h2><span>Clear your cache</span></h2>
<div class="box">
<div class="inbox">
<p>Cache re-generated!</p>
<p><a href="javascript: history.go(-1)">Go back</a></p>
</div>
</div>
</div>
<?php
}
// If the "Regenerate ban cache" button was clicked
else if (isset($_POST['regen_ban_cache']))
{
// We re-generate it
generate_bans_cache();
// Display the admin navigation menu
generate_admin_menu($plugin);
?>
<div id="exampleplugin" class="plugin blockform">
<h2><span>Clear your cache</span></h2>
<div class="box">
<div class="inbox">
<p>Ban cache re-generated!</p>
<p><a href="javascript: history.go(-1)">Go back</a></p>
</div>
</div>
</div>
<?php
}
/ If the "Clear feed cache" button was clicked
else if (isset($_POST['clear_feed_cache']))
{
// We re-generate it
clear_feed_cache();
// Display the admin navigation menu
generate_admin_menu($plugin);
?>
<div id="exampleplugin" class="plugin blockform">
<h2><span>Clear your cache</span></h2>
<div class="box">
<div class="inbox">
<p>Feed cache cleared!</p>
<p><a href="javascript: history.go(-1)">Go back</a></p>
</div>
</div>
</div>
<?php
}
// If the "Regenerate ranks cache" button was clicked
else if (isset($_POST['regen_ranks_cache']))
{
// We re-generate it
generate_ranks_cache();
// Display the admin navigation menu
generate_admin_menu($plugin);
?>
<div id="exampleplugin" class="plugin blockform">
<h2><span>Clear your cache</span></h2>
<div class="box">
<div class="inbox">
<p>Ranks cache re-generated!</p>
<p><a href="javascript: history.go(-1)">Go back</a></p>
</div>
</div>
</div>
<?php
}
// If the "Regenerate config cache" button was clicked
else if (isset($_POST['regen_config_cache']))
{
// We re-generate it
generate_config_cache();
// Display the admin navigation menu
generate_admin_menu($plugin);
?>
<div id="exampleplugin" class="plugin blockform">
<h2><span>Clear your cache</span></h2>
<div class="box">
<div class="inbox">
<p>Config cache re-generated!</p>
<p><a href="javascript: history.go(-1)">Go back</a></p>
</div>
</div>
</div>
<?php
}
// If the "Regenerate quickjump cache" button was clicked
else if (isset($_POST['regen_jump_cache']))
{
// We re-generate it
generate_quickjump_cache();
// Display the admin navigation menu
generate_admin_menu($plugin);
?>
<div id="exampleplugin" class="plugin blockform">
<h2><span>Clear your cache</span></h2>
<div class="box">
<div class="inbox">
<p>Quickjump cache re-generated!</p>
<p><a href="javascript: history.go(-1)">Go back</a></p>
</div>
</div>
</div>
<?php
}
else // If not, we show the form
{
// Display the admin navigation menu
generate_admin_menu($plugin);
?>
<div id="exampleplugin" class="plugin blockform">
<h2><span>Re-generate your cache</span></h2>
<div class="box">
<div class="inbox">
<p>This plugin allows you to easily and simply re-generate your FluxBB cache files</p>
<form id="regenerate" method="post" action="<?php echo $_SERVER['REQUEST_URI'] ?>&foo=bar">
<p><input type="submit" name="regen_all_cache" value="Regenerate all cache files" tabindex="2" /></p>
<p><input type="submit" name="regen_ban_cache" value="Regenerate ban cache" tabindex="3" /></p>
<?php
if (version_compare(FORUM_VERSION, '1.5', '<'))
{
echo '
<p>
<input type="submit" name="regen_ranks_cache" value="Regenerate ranks cache" tabindex="4" />
</p>';
}
?>
<p><input type="submit" name="regen_config_cache" value="Regenerate config cache" tabindex="5" /></p>
<p><input type="submit" name="regen_jump_cache" value="Regenerate quickjump cache" tabindex="6" /></p>
<p><input type="submit" name="clear_feed_cache" value="Clear feed cache" tabindex="7" /></p>
</form>
</div>
</div>
</div>
<?php
}
// Note that the script just ends here. The footer will be included by admin_loader.php.