| 1 | <?php include("header.tpl.php"); ?> |
|---|
| 2 | <div id="help"> |
|---|
| 3 | <a href="help.php"><?php echo _T("Help") ?> »</a> |
|---|
| 4 | </div> |
|---|
| 5 | <div class="switcher"><?php echo switcher("type", $types); ?></div> |
|---|
| 6 | <?php |
|---|
| 7 | $a = new Cycle('class="col1"', 'class="col2"'); |
|---|
| 8 | $b = new Cycle('class="col1"', 'class="col2"'); |
|---|
| 9 | ?> |
|---|
| 10 | <table cellspacing="0" cellpadding="4" class="cycles"> |
|---|
| 11 | <caption><?php echo _T('Caches'); ?></caption> |
|---|
| 12 | <col /> |
|---|
| 13 | <col align="right" /> |
|---|
| 14 | <col align="right" /> |
|---|
| 15 | <col align="right" /> |
|---|
| 16 | <col /> |
|---|
| 17 | <col /> |
|---|
| 18 | <col align="right" /> |
|---|
| 19 | <col align="right" /> |
|---|
| 20 | <col align="right" /> |
|---|
| 21 | <col /> |
|---|
| 22 | <col align="right" /> |
|---|
| 23 | <col align="right" /> |
|---|
| 24 | <col align="right" /> |
|---|
| 25 | <col align="right" /> |
|---|
| 26 | <col align="right" /> |
|---|
| 27 | <col align="right" /> |
|---|
| 28 | <col align="right" /> |
|---|
| 29 | <col /> |
|---|
| 30 | <tr <?php echo $a->next(); ?>> |
|---|
| 31 | <th>-</th> |
|---|
| 32 | <th><?php echo _T('Slots'); ?></th> |
|---|
| 33 | <th><?php echo _T('Size'); ?></th> |
|---|
| 34 | <th><?php echo _T('Avail'); ?></th> |
|---|
| 35 | <th><?php echo _T($config['percent_graph_type'] == 'free' ? '% Free' : '% Used'); ?></th> |
|---|
| 36 | <th><?php echo _T('Clear'); ?></th> |
|---|
| 37 | <th><?php echo _T('Compiling'); ?></th> |
|---|
| 38 | <th><?php echo _T('Hits'); ?></th> |
|---|
| 39 | <th><?php echo _T('Hits/H'); ?></th> |
|---|
| 40 | <th><?php echo _T('Hits 24H'); ?></th> |
|---|
| 41 | <th><?php echo _T('Hits/S'); ?></th> |
|---|
| 42 | <th><?php echo _T('Updates'); ?></th> |
|---|
| 43 | <th><?php echo _T('Clogs'); ?></th> |
|---|
| 44 | <th><?php echo _T('OOMs'); ?></th> |
|---|
| 45 | <th><?php echo _T('Errors'); ?></th> |
|---|
| 46 | <th><?php echo _T('Protected'); ?></th> |
|---|
| 47 | <th><?php echo _T('Cached'); ?></th> |
|---|
| 48 | <th><?php echo _T('Deleted'); ?></th> |
|---|
| 49 | <th><?php echo _T('GC'); ?></th> |
|---|
| 50 | </tr> |
|---|
| 51 | <?php |
|---|
| 52 | $numkeys = explode(',', 'slots,size,avail,hits,updates,clogs,ooms,errors,cached,deleted'); |
|---|
| 53 | $l_clear = _T('Clear'); |
|---|
| 54 | $l_clear_confirm = _T('Sure to clear?'); |
|---|
| 55 | foreach ($cacheinfos as $i => $ci) { |
|---|
| 56 | echo " |
|---|
| 57 | <tr ", $a->next(), ">"; |
|---|
| 58 | $pvalue = (int) ($ci['avail'] / $ci['size'] * 100); |
|---|
| 59 | $pempty = 100 - $pvalue; |
|---|
| 60 | if ($config['percent_graph_type'] == 'used') { |
|---|
| 61 | // swap |
|---|
| 62 | $tmp = $pvalue; |
|---|
| 63 | $pvalue = $pempty; |
|---|
| 64 | $pempty = $tmp; |
|---|
| 65 | } |
|---|
| 66 | |
|---|
| 67 | $w = $config['percent_graph_width']; |
|---|
| 68 | if (empty($ci['istotal'])) { |
|---|
| 69 | $graph = freeblock_to_graph($ci['free_blocks'], $ci['size']); |
|---|
| 70 | $blocksgraph = "<div class=\"blocksgraph\" style=\"width: {$w}px\">{$graph}</div>"; |
|---|
| 71 | } |
|---|
| 72 | else { |
|---|
| 73 | $blocksgraph = ''; |
|---|
| 74 | } |
|---|
| 75 | |
|---|
| 76 | $ci_slots = size($ci['slots']); |
|---|
| 77 | $ci_size = size($ci['size']); |
|---|
| 78 | $ci_avail = size($ci['avail']); |
|---|
| 79 | $ci = number_formats($ci, $numkeys); |
|---|
| 80 | |
|---|
| 81 | $hits_avg_h = number_format(array_avg($ci['hits_by_hour']), 2); |
|---|
| 82 | $hits_avg_s = number_format(array_avg($ci['hits_by_second']), 2); |
|---|
| 83 | $hits_graph_h = hits_to_graph($ci['hits_by_hour']); |
|---|
| 84 | $hits_graph_h_w = count($ci['hits_by_hour']) * 2; |
|---|
| 85 | |
|---|
| 86 | if (!empty($ci['istotal'])) { |
|---|
| 87 | $ci['compiling'] = '-'; |
|---|
| 88 | $ci['can_readonly'] = '-'; |
|---|
| 89 | } |
|---|
| 90 | else { |
|---|
| 91 | $ci['compiling'] = $ci['type'] == $type_php ? ($ci['compiling'] ? 'yes' : 'no') : '-'; |
|---|
| 92 | $ci['can_readonly'] = $ci['can_readonly'] ? 'yes' : 'no'; |
|---|
| 93 | } |
|---|
| 94 | echo <<<EOS |
|---|
| 95 | <th>{$ci['cache_name']}</th> |
|---|
| 96 | <td title="{$ci['slots']}">{$ci_slots}</td> |
|---|
| 97 | <td title="{$ci['size']}">{$ci_size}</td> |
|---|
| 98 | <td title="{$ci['avail']}">{$ci_avail}</td> |
|---|
| 99 | <td title="{$pvalue} %" |
|---|
| 100 | ><div class="percent" style="width: {$w}px" |
|---|
| 101 | ><div style="width: {$pvalue}%" class="pvalue"></div |
|---|
| 102 | ><div style="width: {$pempty}%" class="pempty"></div |
|---|
| 103 | ></div |
|---|
| 104 | >{$blocksgraph}</td> |
|---|
| 105 | <td |
|---|
| 106 | ><form method="post" action="" |
|---|
| 107 | ><div |
|---|
| 108 | ><input type="hidden" name="type" value="{$ci['type']}" |
|---|
| 109 | /><input type="hidden" name="cacheid" value="{$ci['cacheid']}" |
|---|
| 110 | /><input type="submit" name="clearcache" value="{$l_clear}" class="submit" onclick="return confirm('{$l_clear_confirm}');" |
|---|
| 111 | /></div |
|---|
| 112 | ></form |
|---|
| 113 | ></td> |
|---|
| 114 | <td>{$ci['compiling']}</td> |
|---|
| 115 | <td>{$ci['hits']}</td> |
|---|
| 116 | <td>{$hits_avg_h}</td> |
|---|
| 117 | <td><div class="hitsgraph" style="width: {$hits_graph_h_w}px">{$hits_graph_h}</div></td> |
|---|
| 118 | <td>{$hits_avg_s}</td> |
|---|
| 119 | <td>{$ci['updates']}</td> |
|---|
| 120 | <td>{$ci['clogs']}</td> |
|---|
| 121 | <td>{$ci['ooms']}</td> |
|---|
| 122 | <td>{$ci['errors']}</td> |
|---|
| 123 | <td>{$ci['can_readonly']}</td> |
|---|
| 124 | <td>{$ci['cached']}</td> |
|---|
| 125 | <td>{$ci['deleted']}</td> |
|---|
| 126 | <td>{$ci['gc']}</td> |
|---|
| 127 | EOS; |
|---|
| 128 | |
|---|
| 129 | $b->reset(); |
|---|
| 130 | ?> |
|---|
| 131 | </tr> |
|---|
| 132 | <?php } ?> |
|---|
| 133 | </table> |
|---|
| 134 | <div class="blockarea legends"> |
|---|
| 135 | <div class="legendtitle"><?php echo _T('Legends:'); ?></div> |
|---|
| 136 | <div class="legend pvalue"> </div> |
|---|
| 137 | <div class="legendtitle"><?php echo _T($config['percent_graph_type'] == 'free' ? '% Free' : '% Used'); ?></div> |
|---|
| 138 | <div class="legend" style="background: rgb(0,0,255)"> </div> |
|---|
| 139 | <div class="legendtitle"><?php echo _T($config['percent_graph_type'] == 'free' ? 'Free Blocks' : 'Used Blocks'); ?></div> |
|---|
| 140 | <div class="legend" style="background: rgb(255,0,0)"> </div> |
|---|
| 141 | <div class="legendtitle"><?php echo _T('Hits'); ?></div> |
|---|
| 142 | </div> |
|---|
| 143 | <?php |
|---|
| 144 | |
|---|
| 145 | if ($cachelist) { |
|---|
| 146 | $isphp = $cachelist['type'] == $type_php; |
|---|
| 147 | ob_start($config['path_nicer']); |
|---|
| 148 | foreach (array('Cached' => $cachelist['cache_list'], 'Deleted' => $cachelist['deleted_list']) as $listname => $entries) { |
|---|
| 149 | $a->reset(); |
|---|
| 150 | ?> |
|---|
| 151 | |
|---|
| 152 | <form action="" method="post"> |
|---|
| 153 | <table cellspacing="0" cellpadding="4" class="cycles entries" width="100%"> |
|---|
| 154 | <caption><?php echo _T("{$cachelist['type_name']} $listname"); ?></caption> |
|---|
| 155 | <?php |
|---|
| 156 | echo " |
|---|
| 157 | <tr ", $a->next(), ">"; |
|---|
| 158 | ?> |
|---|
| 159 | |
|---|
| 160 | <?php if (!$isphp) { ?> |
|---|
| 161 | <th width="20">R</th> |
|---|
| 162 | <?php } ?> |
|---|
| 163 | <th><a href="javascript:" onclick="resort(this); return false"><?php echo _T('Cache'); ?></a></th> |
|---|
| 164 | <th><a href="javascript:" onclick="resort(this); return false"><?php echo _T('entry'); ?></a></th> |
|---|
| 165 | <th><a href="javascript:" onclick="resort(this); return false"><?php echo _T('Hits'); ?></a></th> |
|---|
| 166 | <th><a href="javascript:" onclick="resort(this); return false"><?php echo _T('Size'); ?></a></th> |
|---|
| 167 | <?php if ($isphp) { ?> |
|---|
| 168 | <th><a href="javascript:" onclick="resort(this); return false"><?php echo _T('Refcount'); ?></a></th> |
|---|
| 169 | <th><a href="javascript:" onclick="resort(this); return false"><?php echo _T('PhpShared'); ?></a></th> |
|---|
| 170 | <th><a href="javascript:" onclick="resort(this); return false"><?php echo _T('SrcSize'); ?></a></th> |
|---|
| 171 | <th><a href="javascript:" onclick="resort(this); return false"><?php echo _T('Modify'); ?></a></th> |
|---|
| 172 | <?php if ($haveinode) { ?> |
|---|
| 173 | <th><a href="javascript:" onclick="resort(this); return false"><?php echo _T('device'); ?></a></th> |
|---|
| 174 | <th><a href="javascript:" onclick="resort(this); return false"><?php echo _T('inode'); ?></a></th> |
|---|
| 175 | <?php } ?> |
|---|
| 176 | <?php } ?> |
|---|
| 177 | <th><a href="javascript:" onclick="resort(this); return false"><?php echo _T('hash'); ?></a></th> |
|---|
| 178 | <th><a href="javascript:" onclick="resort(this); return false"><?php echo _T('Access'); ?></a></th> |
|---|
| 179 | <th><a href="javascript:" onclick="resort(this); return false"><?php echo _T('Create'); ?></a></th> |
|---|
| 180 | <?php if ($listname == 'Deleted') { ?> |
|---|
| 181 | <th><a href="javascript:" onclick="resort(this); return false"><?php echo _T('Delete'); ?></a></th> |
|---|
| 182 | <?php } ?> |
|---|
| 183 | </tr> |
|---|
| 184 | <?php |
|---|
| 185 | foreach ($entries as $i => $entry) { |
|---|
| 186 | echo " |
|---|
| 187 | <tr ", $a->next(), ">"; |
|---|
| 188 | $name = htmlspecialchars($entry['name']); |
|---|
| 189 | $hits = number_format($entry['hits']); |
|---|
| 190 | $size = size($entry['size']); |
|---|
| 191 | if ($isphp) { |
|---|
| 192 | $file_size = size($entry['file_size']); |
|---|
| 193 | $phprefcount = number_format($entry['phprefcount']); |
|---|
| 194 | } |
|---|
| 195 | |
|---|
| 196 | if ($isphp) { |
|---|
| 197 | $file_mtime = age($entry['file_mtime']); |
|---|
| 198 | } |
|---|
| 199 | $ctime = age($entry['ctime']); |
|---|
| 200 | $atime = age($entry['atime']); |
|---|
| 201 | if ($listname == 'Deleted') { |
|---|
| 202 | $dtime = age($entry['dtime']); |
|---|
| 203 | } |
|---|
| 204 | |
|---|
| 205 | if (!$isphp) { |
|---|
| 206 | echo <<<ENTRY |
|---|
| 207 | <td><input type="checkbox" name="remove[]" value="{$name}"/></td> |
|---|
| 208 | ENTRY; |
|---|
| 209 | $uname = urlencode($entry['name']); |
|---|
| 210 | $namelink = "<a href=\"edit.php?name=$uname\">$name</a>"; |
|---|
| 211 | } |
|---|
| 212 | else { |
|---|
| 213 | $namelink = $name; |
|---|
| 214 | } |
|---|
| 215 | |
|---|
| 216 | echo <<<ENTRY |
|---|
| 217 | <td>{$entry['cache_name']} {$i}</td> |
|---|
| 218 | <td>{$namelink}</td> |
|---|
| 219 | <td align="right" int="{$entry['hits']}">{$entry['hits']}</td> |
|---|
| 220 | <td align="right" int="{$entry['size']}">{$size}</td> |
|---|
| 221 | ENTRY; |
|---|
| 222 | if ($isphp) { |
|---|
| 223 | $refcount = number_format($entry['refcount']); |
|---|
| 224 | echo <<<ENTRY |
|---|
| 225 | <td align="right" int="{$entry['refcount']}">{$entry['refcount']}</td> |
|---|
| 226 | <td align="right" int="{$entry['phprefcount']}">{$phprefcount}</td> |
|---|
| 227 | <td align="right" int="{$entry['file_size']}">{$file_size}</td> |
|---|
| 228 | <td align="right" int="{$entry['file_mtime']}">{$file_mtime}</td> |
|---|
| 229 | ENTRY; |
|---|
| 230 | if (isset($entry['file_inode'])) { |
|---|
| 231 | echo <<<ENTRY |
|---|
| 232 | <td align="right" int="{$entry['file_device']}">{$entry['file_device']}</td> |
|---|
| 233 | <td align="right" int="{$entry['file_inode']}">{$entry['file_inode']}</td> |
|---|
| 234 | ENTRY; |
|---|
| 235 | } |
|---|
| 236 | } |
|---|
| 237 | echo <<<ENTRY |
|---|
| 238 | <td align="right" int="{$entry['hvalue']}">{$entry['hvalue']}</td> |
|---|
| 239 | <td align="right" int="{$entry['atime']}">{$atime}</td> |
|---|
| 240 | <td align="right" int="{$entry['ctime']}">{$ctime}</td> |
|---|
| 241 | ENTRY; |
|---|
| 242 | if ($listname == 'Deleted') { |
|---|
| 243 | echo <<<ENTRY |
|---|
| 244 | <td align="right" int="{$entry['dtime']}">{$dtime}</td> |
|---|
| 245 | ENTRY; |
|---|
| 246 | } |
|---|
| 247 | |
|---|
| 248 | echo " |
|---|
| 249 | </tr> |
|---|
| 250 | "; |
|---|
| 251 | } |
|---|
| 252 | ?> |
|---|
| 253 | |
|---|
| 254 | </table> |
|---|
| 255 | <?php if (!$isphp) { ?> |
|---|
| 256 | <input type="submit" value="<?php echo _T("Remove Selected"); ?>"> |
|---|
| 257 | <?php } ?> |
|---|
| 258 | </form> |
|---|
| 259 | <?php |
|---|
| 260 | } |
|---|
| 261 | ob_end_flush(); |
|---|
| 262 | } |
|---|
| 263 | if ($moduleinfo) { |
|---|
| 264 | $t_moduleinfo = _T("Module Info"); |
|---|
| 265 | echo <<<HTML |
|---|
| 266 | <h2>$t_moduleinfo</h2> |
|---|
| 267 | <div class="moduleinfo">$moduleinfo</div> |
|---|
| 268 | HTML; |
|---|
| 269 | } |
|---|
| 270 | ?> |
|---|
| 271 | <?php include("footer.tpl.php"); ?> |
|---|