| 1 | <?php include("../common/header.tpl.php"); ?> |
|---|
| 2 | <div class="switcher"><?php echo switcher("type", $listTypes); ?></div> |
|---|
| 3 | <div id="help"> |
|---|
| 4 | <a href="help.php"><?php echo _("Help") ?> »</a> |
|---|
| 5 | </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 caches"> |
|---|
| 11 | <caption><?php echo _('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 | <?php echo |
|---|
| 32 | th(N_("cache.cache")) |
|---|
| 33 | , th(N_("cache.size")) |
|---|
| 34 | , th(N_("cache.avail")) |
|---|
| 35 | , th(N_("cache.used")) |
|---|
| 36 | , th(N_("cache.blocksgraph")) |
|---|
| 37 | , th(N_("cache.operations")) |
|---|
| 38 | , th(N_("cache.status")) |
|---|
| 39 | , th(N_("cache.hits")) |
|---|
| 40 | , th(N_("cache.hits_graph")) |
|---|
| 41 | , th(N_("cache.hits_avg_h")) |
|---|
| 42 | , th(N_("cache.hits_avg_s")) |
|---|
| 43 | , th(N_("cache.updates")) |
|---|
| 44 | , th(N_("cache.skips")) |
|---|
| 45 | , th(N_("cache.ooms")) |
|---|
| 46 | , th(N_("cache.errors")) |
|---|
| 47 | , th(N_("cache.readonly_protected")) |
|---|
| 48 | , th(N_("cache.cached")) |
|---|
| 49 | , th(N_("cache.deleted")) |
|---|
| 50 | , th(N_("cache.gc_timer")) |
|---|
| 51 | ; |
|---|
| 52 | ?> |
|---|
| 53 | </tr> |
|---|
| 54 | <?php |
|---|
| 55 | $numkeys = explode(',', 'slots,size,avail,hits,updates,skips,ooms,errors,cached,deleted'); |
|---|
| 56 | $l_clear = _('Clear'); |
|---|
| 57 | $l_disabled = _('Disabled'); |
|---|
| 58 | $l_disable = _('Disable'); |
|---|
| 59 | $l_enable = _('Enable'); |
|---|
| 60 | $l_compiling = _('Compiling'); |
|---|
| 61 | $l_normal = _('Normal'); |
|---|
| 62 | $l_clear_confirm = _('Sure to clear?'); |
|---|
| 63 | foreach ($cacheinfos as $i => $ci) { |
|---|
| 64 | echo " |
|---|
| 65 | <tr ", $a->next(), ">"; |
|---|
| 66 | $pvalue = (int) ($ci['avail'] / $ci['size'] * 100); |
|---|
| 67 | $pempty = 100 - $pvalue; |
|---|
| 68 | if ($config['percent_graph_type'] == 'used') { |
|---|
| 69 | // swap |
|---|
| 70 | $tmp = $pvalue; |
|---|
| 71 | $pvalue = $pempty; |
|---|
| 72 | $pempty = $tmp; |
|---|
| 73 | } |
|---|
| 74 | |
|---|
| 75 | $w = $config['percent_graph_width']; |
|---|
| 76 | if (empty($ci['istotal'])) { |
|---|
| 77 | $graph = freeblock_to_graph($ci['free_blocks'], $ci['size']); |
|---|
| 78 | $blocksgraph = "<div class=\"blocksgraph\" style=\"width: {$w}px\">{$graph}</div>"; |
|---|
| 79 | } |
|---|
| 80 | else { |
|---|
| 81 | $blocksgraph = ''; |
|---|
| 82 | } |
|---|
| 83 | |
|---|
| 84 | $ci_slots = size($ci['slots']); |
|---|
| 85 | $ci_size = size($ci['size']); |
|---|
| 86 | $ci_avail = size($ci['avail']); |
|---|
| 87 | $ci = number_formats($ci, $numkeys); |
|---|
| 88 | |
|---|
| 89 | $hits_avg_h = number_format(array_avg($ci['hits_by_hour']), 2); |
|---|
| 90 | $hits_avg_s = number_format(array_avg($ci['hits_by_second']), 2); |
|---|
| 91 | $hits_graph_h = get_cache_hits_graph($ci, 'hits_by_hour'); |
|---|
| 92 | $hits_graph_h_w = count($ci['hits_by_hour']) * 2; |
|---|
| 93 | |
|---|
| 94 | if (!empty($ci['istotal'])) { |
|---|
| 95 | $ci['status'] = '-'; |
|---|
| 96 | $ci['can_readonly'] = '-'; |
|---|
| 97 | } |
|---|
| 98 | else { |
|---|
| 99 | if ($ci['disabled']) { |
|---|
| 100 | $ci['status'] = $l_disabled |
|---|
| 101 | . sprintf("(%s)", age($ci['disabled'])); |
|---|
| 102 | } |
|---|
| 103 | else if ($ci['type'] == $type_php) { |
|---|
| 104 | $ci['status'] = $ci['compiling'] |
|---|
| 105 | ? $l_compiling . sprintf("(%s)", age($ci['compiling'])) |
|---|
| 106 | : $l_normal; |
|---|
| 107 | } |
|---|
| 108 | else { |
|---|
| 109 | $ci['status'] = '-'; |
|---|
| 110 | } |
|---|
| 111 | $ci['can_readonly'] = $ci['can_readonly'] ? 'yes' : 'no'; |
|---|
| 112 | } |
|---|
| 113 | $enabledisable = $ci['disabled'] ? 'enable' : 'disable'; |
|---|
| 114 | $l_enabledisable = $ci['disabled'] ? $l_enable : $l_disable; |
|---|
| 115 | echo <<<EOS |
|---|
| 116 | <th>{$ci['cache_name']}</th> |
|---|
| 117 | <td title="{$ci['slots']}">{$ci_slots}</td> |
|---|
| 118 | <td title="{$ci['size']}">{$ci_size}</td> |
|---|
| 119 | <td title="{$ci['avail']}">{$ci_avail}</td> |
|---|
| 120 | <td title="{$pvalue} %" |
|---|
| 121 | ><div class="percent" style="width: {$w}px" |
|---|
| 122 | ><div style="width: {$pvalue}%" class="pvalue"></div |
|---|
| 123 | ><div style="width: {$pempty}%" class="pempty"></div |
|---|
| 124 | ></div |
|---|
| 125 | >{$blocksgraph}</td> |
|---|
| 126 | <td |
|---|
| 127 | ><form method="post" action="" |
|---|
| 128 | ><div |
|---|
| 129 | ><input type="hidden" name="type" value="{$ci['type']}" |
|---|
| 130 | /><input type="hidden" name="cacheid" value="{$ci['cacheid']}" |
|---|
| 131 | /><input type="submit" name="clearcache" value="{$l_clear}" class="submit" onclick="return confirm('{$l_clear_confirm}');" |
|---|
| 132 | /><input type="submit" name="{$enabledisable}" value="{$l_enabledisable}" class="submit" |
|---|
| 133 | /></div |
|---|
| 134 | ></form |
|---|
| 135 | ></td> |
|---|
| 136 | <td>{$ci['status']}</td> |
|---|
| 137 | <td>{$ci['hits']}</td> |
|---|
| 138 | <td><div class="hitsgraph" style="width: {$hits_graph_h_w}px">{$hits_graph_h}</div></td> |
|---|
| 139 | <td>{$hits_avg_h}</td> |
|---|
| 140 | <td>{$hits_avg_s}</td> |
|---|
| 141 | <td>{$ci['updates']}</td> |
|---|
| 142 | <td>{$ci['skips']}</td> |
|---|
| 143 | <td>{$ci['ooms']}</td> |
|---|
| 144 | <td>{$ci['errors']}</td> |
|---|
| 145 | <td>{$ci['can_readonly']}</td> |
|---|
| 146 | <td>{$ci['cached']}</td> |
|---|
| 147 | <td>{$ci['deleted']}</td> |
|---|
| 148 | <td>{$ci['gc']}</td> |
|---|
| 149 | EOS; |
|---|
| 150 | |
|---|
| 151 | $b->reset(); |
|---|
| 152 | ?> |
|---|
| 153 | </tr> |
|---|
| 154 | <?php } ?> |
|---|
| 155 | </table> |
|---|
| 156 | <div class="blockarea legends"> |
|---|
| 157 | <div class="legendtitle"><?php echo _('Legends:'); ?></div> |
|---|
| 158 | <div class="legend pvalue"> </div> |
|---|
| 159 | <div class="legendtitle"><?php echo _($config['percent_graph_type'] == 'free' ? '% Free' : '% Used'); ?></div> |
|---|
| 160 | <div class="legend" style="background: rgb(0,0,255)"> </div> |
|---|
| 161 | <div class="legendtitle"><?php echo _($config['percent_graph_type'] == 'free' ? 'Free Blocks' : 'Used Blocks'); ?></div> |
|---|
| 162 | <div class="legend" style="background: rgb(255,0,0)"> </div> |
|---|
| 163 | <div class="legendtitle"><?php echo _('Hits'); ?></div> |
|---|
| 164 | </div> |
|---|
| 165 | <?php |
|---|
| 166 | |
|---|
| 167 | if ($cachelist) { |
|---|
| 168 | $isphp = $cachelist['type'] == $type_php; |
|---|
| 169 | ob_start($config['path_nicer']); |
|---|
| 170 | foreach (array('Cached' => $cachelist['cache_list'], 'Deleted' => $cachelist['deleted_list']) as $listname => $entries) { |
|---|
| 171 | $a->reset(); |
|---|
| 172 | ?> |
|---|
| 173 | |
|---|
| 174 | <form action="" method="post"> |
|---|
| 175 | <table cellspacing="0" cellpadding="4" class="cycles entries" width="100%"> |
|---|
| 176 | <caption><?php echo _("{$cachelist['type_name']} $listname"); ?></caption> |
|---|
| 177 | <?php |
|---|
| 178 | echo " |
|---|
| 179 | <tr ", $a->next(), ">"; |
|---|
| 180 | ?> |
|---|
| 181 | |
|---|
| 182 | <?php |
|---|
| 183 | if ($isphp) { |
|---|
| 184 | echo |
|---|
| 185 | th("entry.id") |
|---|
| 186 | ; |
|---|
| 187 | } |
|---|
| 188 | else { |
|---|
| 189 | echo |
|---|
| 190 | th("entry.remove", 'width="20"') |
|---|
| 191 | ; |
|---|
| 192 | } |
|---|
| 193 | |
|---|
| 194 | echo |
|---|
| 195 | th(N_("entry.name")) |
|---|
| 196 | , th(N_("entry.hits")) |
|---|
| 197 | , th(N_("entry.size")) |
|---|
| 198 | ; |
|---|
| 199 | |
|---|
| 200 | if ($isphp) { |
|---|
| 201 | echo |
|---|
| 202 | th(N_("entry.refcount")) |
|---|
| 203 | , th(N_("entry.phprefcount")) |
|---|
| 204 | , th(N_("entry.class_cnt")) |
|---|
| 205 | , th(N_("entry.function_cnt")) |
|---|
| 206 | , th(N_("entry.file_size")) |
|---|
| 207 | , th(N_("entry.file_mtime")) |
|---|
| 208 | ; |
|---|
| 209 | if ($haveinode) { |
|---|
| 210 | echo |
|---|
| 211 | th(N_("entry.file_device")) |
|---|
| 212 | , th(N_("entry.file_inode")) |
|---|
| 213 | ; |
|---|
| 214 | } |
|---|
| 215 | } |
|---|
| 216 | echo |
|---|
| 217 | th(N_("entry.hash")) |
|---|
| 218 | , th(N_("entry.atime")) |
|---|
| 219 | , th(N_("entry.ctime")) |
|---|
| 220 | ; |
|---|
| 221 | |
|---|
| 222 | if ($listname == 'Deleted') { |
|---|
| 223 | echo |
|---|
| 224 | th(N_("entry.delete")) |
|---|
| 225 | ; |
|---|
| 226 | } |
|---|
| 227 | ?> |
|---|
| 228 | </tr> |
|---|
| 229 | <?php |
|---|
| 230 | foreach ($entries as $i => $entry) { |
|---|
| 231 | echo " |
|---|
| 232 | <tr ", $a->next(), ">"; |
|---|
| 233 | $name = htmlspecialchars($entry['name']); |
|---|
| 234 | $hits = number_format($entry['hits']); |
|---|
| 235 | $size = size($entry['size']); |
|---|
| 236 | if ($isphp) { |
|---|
| 237 | $class_cnt = number_format($entry['class_cnt']); |
|---|
| 238 | $function_cnt = number_format($entry['function_cnt']); |
|---|
| 239 | $phprefcount = number_format($entry['phprefcount']); |
|---|
| 240 | $file_size = size($entry['file_size']); |
|---|
| 241 | } |
|---|
| 242 | |
|---|
| 243 | if ($isphp) { |
|---|
| 244 | $file_mtime = age($entry['file_mtime']); |
|---|
| 245 | } |
|---|
| 246 | $ctime = age($entry['ctime']); |
|---|
| 247 | $atime = age($entry['atime']); |
|---|
| 248 | if ($listname == 'Deleted') { |
|---|
| 249 | $dtime = age($entry['dtime']); |
|---|
| 250 | } |
|---|
| 251 | |
|---|
| 252 | if ($isphp) { |
|---|
| 253 | $namelink = $name; |
|---|
| 254 | echo <<<ENTRY |
|---|
| 255 | <td>{$entry['cache_name']} {$i}</td> |
|---|
| 256 | ENTRY; |
|---|
| 257 | } |
|---|
| 258 | else { |
|---|
| 259 | echo <<<ENTRY |
|---|
| 260 | <td><label><input type="checkbox" name="remove[]" value="{$name}"/>{$entry['cache_name']} {$i}</label></td> |
|---|
| 261 | ENTRY; |
|---|
| 262 | $uname = urlencode($entry['name']); |
|---|
| 263 | $namelink = "<a href=\"edit.php?name=$uname\">$name</a>"; |
|---|
| 264 | } |
|---|
| 265 | |
|---|
| 266 | echo <<<ENTRY |
|---|
| 267 | <td>{$namelink}</td> |
|---|
| 268 | <td align="right" int="{$entry['hits']}">{$entry['hits']}</td> |
|---|
| 269 | <td align="right" int="{$entry['size']}">{$size}</td> |
|---|
| 270 | ENTRY; |
|---|
| 271 | if ($isphp) { |
|---|
| 272 | $refcount = number_format($entry['refcount']); |
|---|
| 273 | echo <<<ENTRY |
|---|
| 274 | <td align="right" int="{$entry['refcount']}">{$entry['refcount']}</td> |
|---|
| 275 | <td align="right" int="{$entry['phprefcount']}">{$phprefcount}</td> |
|---|
| 276 | <td align="right" int="{$entry['class_cnt']}">{$class_cnt}</td> |
|---|
| 277 | <td align="right" int="{$entry['function_cnt']}">{$function_cnt}</td> |
|---|
| 278 | <td align="right" int="{$entry['file_size']}">{$file_size}</td> |
|---|
| 279 | <td align="right" int="{$entry['file_mtime']}">{$file_mtime}</td> |
|---|
| 280 | ENTRY; |
|---|
| 281 | if (isset($entry['file_inode'])) { |
|---|
| 282 | echo <<<ENTRY |
|---|
| 283 | <td align="right" int="{$entry['file_device']}">{$entry['file_device']}</td> |
|---|
| 284 | <td align="right" int="{$entry['file_inode']}">{$entry['file_inode']}</td> |
|---|
| 285 | ENTRY; |
|---|
| 286 | } |
|---|
| 287 | } |
|---|
| 288 | echo <<<ENTRY |
|---|
| 289 | <td align="right" int="{$entry['hvalue']}">{$entry['hvalue']}</td> |
|---|
| 290 | <td align="right" int="{$entry['atime']}">{$atime}</td> |
|---|
| 291 | <td align="right" int="{$entry['ctime']}">{$ctime}</td> |
|---|
| 292 | ENTRY; |
|---|
| 293 | if ($listname == 'Deleted') { |
|---|
| 294 | echo <<<ENTRY |
|---|
| 295 | <td align="right" int="{$entry['dtime']}">{$dtime}</td> |
|---|
| 296 | ENTRY; |
|---|
| 297 | } |
|---|
| 298 | |
|---|
| 299 | echo " |
|---|
| 300 | </tr> |
|---|
| 301 | "; |
|---|
| 302 | } |
|---|
| 303 | ?> |
|---|
| 304 | |
|---|
| 305 | </table> |
|---|
| 306 | <?php if (!$isphp) { ?> |
|---|
| 307 | <input type="submit" value="<?php echo _("Remove Selected"); ?>"> |
|---|
| 308 | <?php } ?> |
|---|
| 309 | </form> |
|---|
| 310 | <?php |
|---|
| 311 | } |
|---|
| 312 | ob_end_flush(); |
|---|
| 313 | } |
|---|
| 314 | if ($moduleinfo) { |
|---|
| 315 | $t_moduleinfo = _("Module Info"); |
|---|
| 316 | echo <<<HTML |
|---|
| 317 | <h2>$t_moduleinfo</h2> |
|---|
| 318 | <div class="phpinfo">$moduleinfo</div> |
|---|
| 319 | HTML; |
|---|
| 320 | } |
|---|
| 321 | ?> |
|---|
| 322 | <?php include("../common/footer.tpl.php"); ?> |
|---|