@@ -9,6 +9,25 @@ function percentage( $a, $b ) {
9
9
return ( $ a / $ b ) * 100 ;
10
10
}
11
11
12
+ function has_key ( $ arr , $ key1 =null , $ key2 =null , $ key3 =null ) {
13
+ if ( isset ( $ arr [$ key1 ] ) )
14
+ return $ key1 ;
15
+ if ( isset ( $ arr [$ key2 ] ) )
16
+ return $ key2 ;
17
+ if ( isset ( $ arr [$ key3 ] ) )
18
+ return $ key3 ;
19
+
20
+ return null ;
21
+ }
22
+
23
+ function get_key ( $ arr , $ key1 =null , $ key2 =null , $ key3 =null ) {
24
+ $ key = has_key ($ arr , $ key1 , $ key2 , $ key3 );
25
+ if ( empty ( $ key ) )
26
+ return null ;
27
+
28
+ return $ arr [$ key ];
29
+ }
30
+
12
31
function opcache_mem ( $ key ) {
13
32
global $ opcache ;
14
33
@@ -75,7 +94,7 @@ function sort_url($on) {
75
94
76
95
$ query = preg_replace ( '#sort=[^&]+&?# ' , '' , $ query );
77
96
$ query = preg_replace ( '#order=[^&]+&?# ' , '' , $ query );
78
-
97
+
79
98
if ( !isset ( $ _GET ['order ' ] ) )
80
99
$ _GET ['order ' ] = '' ;
81
100
@@ -116,7 +135,7 @@ function sort_list(&$list) {
116
135
117
136
if ( isset ( $ _GET ['action ' ] ) && $ _GET ['action ' ] == 'op_delete ' ) {
118
137
$ selector = get_selector ();
119
-
138
+
120
139
foreach ( $ opcache ['scripts ' ] as $ key => $ value ) {
121
140
if ( !preg_match ( $ selector , $ key ) ) continue ;
122
141
@@ -273,7 +292,7 @@ function sort_list(&$list) {
273
292
<table>
274
293
<thead>
275
294
<tr>
276
- <th><a href="<?= sort_url ('key ' )?> ">Key</a></th>
295
+ <th><a href="<?= sort_url (has_key ( 'key ' , ' info ' ) )?> ">Key</a></th>
277
296
<th><a href="<?= sort_url ('nhits ' )?> ">Hits</a></th>
278
297
<th><a href="<?= sort_url ('mem_size ' )?> ">Size</a></th>
279
298
<th><a href="<?= sort_url ('ttl ' )?> ">TTL</a></th>
@@ -286,17 +305,17 @@ function sort_list(&$list) {
286
305
287
306
<tbody>
288
307
<?php foreach ( sort_list ($ apc ['cache ' ]['cache_list ' ]) as $ item ):
289
- $ expired = !isset ( $ _GET ['apc_show_expired ' ] ) && $ item ['ttl ' ] > 0 && $ item[ 'mtime ' ] + $ item ['ttl ' ] < time ();
290
- if ( !preg_match (get_selector (), $ item[ 'key ' ] ) || $ expired ) continue ;?>
308
+ $ expired = !isset ( $ _GET ['apc_show_expired ' ] ) && $ item ['ttl ' ] > 0 && get_key ( $ item, 'mtime ' , ' modification_time ' ) + $ item ['ttl ' ] < time ();
309
+ if ( !preg_match (get_selector (), get_key ( $ item, 'key ' , ' info ' ) ) || $ expired ) continue ;?>
291
310
<tr>
292
- <td><?= $ item[ 'key ' ] ?> </td>
311
+ <td><?= get_key ( $ item, 'key ' , ' info ' ) ?> </td>
293
312
<td><?= $ item ['nhits ' ]?> </td>
294
313
<td><?= human_size ($ item ['mem_size ' ])?> </td>
295
314
<td><?= $ item ['ttl ' ]?> </td>
296
- <td><?= date ('Y-m-d H:i ' , $ item[ 'mtime ' ] + $ item ['ttl ' ] )?> </td>
315
+ <td><?= date ('Y-m-d H:i ' , get_key ( $ item, 'mtime ' , ' modification_time ' ) + $ item ['ttl ' ] )?> </td>
297
316
<td>
298
- <a href="?action=apc_delete&selector=<?= urlencode ('^ ' .$ item[ 'key ' ] .'$ ' )?> ">Delete</a>
299
- <a href="?action=apc_view&selector=<?= urlencode ($ item[ 'key ' ] )?> ">View</a>
317
+ <a href="?action=apc_delete&selector=<?= urlencode ('^ ' .get_key ( $ item, 'key ' , ' info ' ) .'$ ' )?> ">Delete</a>
318
+ <a href="?action=apc_view&selector=<?= urlencode (get_key ( $ item, 'key ' , ' info ' ) )?> ">View</a>
300
319
</td>
301
320
</tr>
302
321
<?php endforeach ; ?>
0 commit comments