Skip to content

Commit db15132

Browse files
committed
[caches] Prevent actions on disabled cache type.
1 parent 07cf081 commit db15132

File tree

1 file changed

+29
-23
lines changed

1 file changed

+29
-23
lines changed

cache.php

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -183,41 +183,47 @@ function sort_list(&$list) {
183183
/********************************/
184184
/* OPcache */
185185
/********************************/
186-
if( isset( $_GET['action'] ) && $_GET['action'] == 'op_restart' ) {
187-
opcache_reset();
188-
redirect('?');
189-
}
186+
if (ENABLE_OPCACHE) {
187+
if( isset( $_GET['action'] ) && $_GET['action'] == 'op_restart' ) {
188+
opcache_reset();
189+
redirect('?');
190+
}
190191

191-
if( isset( $_GET['action'] ) && $_GET['action'] == 'op_delete' ) {
192-
$selector = get_selector();
192+
if( isset( $_GET['action'] ) && $_GET['action'] == 'op_delete' ) {
193+
$selector = get_selector();
193194

194-
foreach( $opcache['scripts'] as $key => $value ) {
195-
if( !preg_match( $selector, $key) ) continue;
195+
foreach( $opcache['scripts'] as $key => $value ) {
196+
if( !preg_match( $selector, $key) ) continue;
196197

197-
opcache_invalidate( $key, empty($_GET['force'])?false:true );
198-
}
199-
redirect('?action=op_select&selector=' . $_GET['selector'] );
200-
}
198+
opcache_invalidate( $key, empty($_GET['force'])?false:true );
199+
}
200+
redirect('?action=op_select&selector=' . $_GET['selector'] );
201+
}
202+
}
201203

202204
/********************************/
203205
/* APC */
204206
/********************************/
205-
if( isset( $_GET['action'] ) && $_GET['action'] == 'apcu_restart' ) {
206-
apcu_delete( new ApcuIterator('#.*#') );
207-
redirect('?');
208-
}
207+
if (ENABLE_APC) {
208+
if( isset( $_GET['action'] ) && $_GET['action'] == 'apcu_restart' ) {
209+
apcu_delete( new ApcuIterator('#.*#') );
210+
redirect('?');
211+
}
209212

210-
if( isset( $_GET['action'] ) && $_GET['action'] == 'apcu_delete' ) {
211-
apcu_delete( new ApcuIterator(get_selector()) );
212-
redirect( '?action=apcu_select&selector=' . $_GET['selector'] );
213-
}
213+
if( isset( $_GET['action'] ) && $_GET['action'] == 'apcu_delete' ) {
214+
apcu_delete( new ApcuIterator(get_selector()) );
215+
redirect( '?action=apcu_select&selector=' . $_GET['selector'] );
216+
}
217+
}
214218

215219
/********************************/
216220
/* realpath */
217221
/********************************/
218-
if( isset( $_GET['action'] ) && $_GET['action'] == 'realpath_clear' ) {
219-
clearstatcache(true);
220-
redirect('?#realpath');
222+
if (ENABLE_REALPATH) {
223+
if( isset( $_GET['action'] ) && $_GET['action'] == 'realpath_clear' ) {
224+
clearstatcache(true);
225+
redirect('?#realpath');
226+
}
221227
}
222228
?><html>
223229
<head>

0 commit comments

Comments
 (0)