@@ -26,6 +26,10 @@ function __construct($search = null) { parent::__construct('user', $search); }
2626 }
2727
2828 if (ENABLE_REALPATH ) {
29+ $ realpath = array ();
30+ foreach ( realpath_cache_get () as $ path => $ item ) {
31+ $ realpath [] = array_merge (array ('path ' => $ path ), $ item );
32+ }
2933 $ realpathCacheUsed = realpath_cache_size ();
3034 $ realpathCacheTotal = machine_size (ini_get ('realpath_cache_size ' ));
3135 }
@@ -222,7 +226,18 @@ function sort_list(&$list) {
222226 if (ENABLE_REALPATH ) {
223227 if ( isset ( $ _GET ['action ' ] ) && $ _GET ['action ' ] == 'realpath_clear ' ) {
224228 clearstatcache (true );
225- redirect ('?#realpath ' );
229+ redirect ('?action=realpath_show#realpath ' );
230+ }
231+
232+ if ( isset ( $ _GET ['action ' ] ) && $ _GET ['action ' ] == 'realpath_delete ' ) {
233+ $ selector = get_selector ();
234+
235+ foreach ( $ realpath as $ item ) {
236+ if ( !preg_match ( $ selector , $ item ['path ' ]) ) continue ;
237+
238+ clearstatcache (true , $ item ['path ' ]);
239+ }
240+ redirect ('?action=realpath_show&selector= ' . $ _GET ['selector ' ] . '#realpath ' );
226241 }
227242 }
228243?> <html>
@@ -416,34 +431,40 @@ function sort_list(&$list) {
416431 <div>
417432 <h3>Actions</h3>
418433 <form action="?" method="GET">
419- <button type="submit" name="action" value="realpath_clear">Clear</button>
434+ <label>Cache:
435+ <button name="action" value="realpath_clear">Restart</button>
436+ </label>
420437 </form>
421438 <form action="?" method="GET">
422- <button type="submit" name="action" value="realpath_show">Show</button>
439+ <label>Key(s):
440+ <input name="selector" type="text" value="" placeholder=".*" />
441+ </label>
442+ <button type="submit" name="action" value="realpath_select">Select</button>
443+ <button type="submit" name="action" value="realpath_delete">Delete</button>
423444 </form>
424445 </div>
425446
426- <?php if ( isset ( $ _GET ['action ' ] ) && $ _GET ['action ' ] == 'realpath_show ' ): ?>
447+ <?php if ( isset ( $ _GET ['action ' ] ) && $ _GET ['action ' ] == 'realpath_select ' ): ?>
427448 <div>
428449 <table>
429450 <thead>
430451 <tr>
431- <th>Path</th>
432- <th>Is Directory</a></th>
433- <th>Realpath</th>
434- <th>Expires</th>
435- <th>Key</th>
452+ <th><a href=" <?= sort_url ( ' path ' ) ?> "> Path</a> </th>
453+ <th><a href=" <?= sort_url ( ' is_dir ' ) ?> "> Is Directory</a></th>
454+ <th><a href=" <?= sort_url ( ' realpath ' ) ?> "> Realpath</a> </th>
455+ <th><a href=" <?= sort_url ( ' expires ' ) ?> "> Expires</a> </th>
456+ <th><a href=" <?= sort_url ( ' key ' ) ?> "> Key</a> </th>
436457 </tr>
437458 </thead>
438-
439459 <tbody>
440- <?php foreach ( realpath_cache_get () as $ path => $ item ): ?>
460+ <?php foreach ( sort_list ($ realpath ) as $ item ):
461+ if ( !preg_match (get_selector (), $ item ['path ' ]) ) continue ;?>
441462 <tr>
442- <td><?php echo $ path; ?> </td>
443- <td><?php echo $ item ['is_dir ' ] ? '✔ ' : '' ?> </td>
444- <td><?php echo $ item ['realpath ' ]; ?> </td>
445- <td><?php echo date ('Y-m-d H:i:s ' , $ item ['expires ' ]); ?> </td>
446- <td><?php echo sprintf ('%u ' , $ item ['key ' ]); ?> </td>
463+ <td><?= $ item [ ' path ' ] ?> </td>
464+ <td><?= $ item ['is_dir ' ] ? '✔ ' : '' ?> </td>
465+ <td><?= $ item ['realpath ' ]?> </td>
466+ <td><?= date ('Y-m-d H:i:s ' , $ item ['expires ' ])?> </td>
467+ <td><?= sprintf ('%u ' , $ item ['key ' ])?> </td>
447468 </tr>
448469 <?php endforeach ; ?>
449470 </tbody>
0 commit comments