| 34 | |
| 35 | function checkCache() |
| 36 | { |
| 37 | $size = 0; |
| 38 | $dir = opendir(KB_CACHEDIR); |
| 39 | while ($line = readdir($dir)) |
| 40 | { |
| 41 | if (strstr($line, 'qcache_qry') !== false) |
| 42 | { |
| 43 | $size += filesize(KB_CACHEDIR.'/'.$line); |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | return round($size/1000, 2).' kB <input type="checkbox" name="option[sql_clearcache]">Clear cache ?'; |
| 48 | } |
| 49 | |
| 50 | function killCache() |
| 51 | { |
| 52 | if ($_POST['option']['sql_clearcache'] != 'on') |
| 53 | { |
| 54 | return; |
| 55 | } |
| 56 | |
| 57 | $dir = opendir(KB_CACHEDIR); |
| 58 | while ($line = readdir($dir)) |
| 59 | { |
| 60 | if (strstr($line, 'qcache_qry') !== false) |
| 61 | { |
| 62 | @unlink(KB_CACHEDIR.'/'.$line); |
| 63 | } |
| 64 | elseif (strstr($line, 'qcache_tbl') !== false) |
| 65 | { |
| 66 | @unlink(KB_CACHEDIR.'/'.$line); |
| 67 | } |
| 68 | } |
| 69 | } |