| 1 | <?php $cycleClass = new Cycle('class="col1"', 'class="col2"'); ?> |
|---|
| 2 | <table cellspacing="0" cellpadding="4" class="cycles caches"> |
|---|
| 3 | <caption><?php echo _('Caches'); ?></caption> |
|---|
| 4 | <tr> |
|---|
| 5 | <?php echo |
|---|
| 6 | th(N_("cache.cache")) |
|---|
| 7 | , th(N_("cache.size")) |
|---|
| 8 | , th(N_("cache.avail")) |
|---|
| 9 | , th(N_("cache.used")) |
|---|
| 10 | , th(N_("cache.blocksgraph")) |
|---|
| 11 | , th(N_("cache.operations")) |
|---|
| 12 | , th(N_("cache.status")) |
|---|
| 13 | , th(N_("cache.hits")) |
|---|
| 14 | , th(N_("cache.hits_graph")) |
|---|
| 15 | , th(N_("cache.hits_avg_h")) |
|---|
| 16 | , th(N_("cache.hits_avg_s")) |
|---|
| 17 | , th(N_("cache.updates")) |
|---|
| 18 | , th(N_("cache.skips")) |
|---|
| 19 | , th(N_("cache.ooms")) |
|---|
| 20 | , th(N_("cache.errors")) |
|---|
| 21 | , th(N_("cache.readonly_protected")) |
|---|
| 22 | , th(N_("cache.cached")) |
|---|
| 23 | , th(N_("cache.deleted")) |
|---|
| 24 | , th(N_("cache.gc_timer")) |
|---|
| 25 | ; |
|---|
| 26 | ?> |
|---|
| 27 | </tr> |
|---|
| 28 | <?php |
|---|
| 29 | $numkeys = explode(',', 'slots,size,avail,hits,updates,skips,ooms,errors,cached,deleted'); |
|---|
| 30 | $l_clear = _('Clear'); |
|---|
| 31 | $l_disabled = _('Disabled'); |
|---|
| 32 | $l_disable = _('Disable'); |
|---|
| 33 | $l_enable = _('Enable'); |
|---|
| 34 | $l_compiling = _('Compiling'); |
|---|
| 35 | $l_normal = _('Normal'); |
|---|
| 36 | $l_confirm = _('Sure?'); |
|---|
| 37 | foreach (getCacheInfos() as $i => $ci) { |
|---|
| 38 | $class = $cycleClass->next(); |
|---|
| 39 | echo <<<TR |
|---|
| 40 | <tr {$class}> |
|---|
| 41 | |
|---|
| 42 | TR; |
|---|
| 43 | $pvalue = (int) ($ci['avail'] / $ci['size'] * 100); |
|---|
| 44 | $pempty = 100 - $pvalue; |
|---|
| 45 | if ($config['percent_graph_type'] == 'used') { |
|---|
| 46 | // swap |
|---|
| 47 | $tmp = $pvalue; |
|---|
| 48 | $pvalue = $pempty; |
|---|
| 49 | $pempty = $tmp; |
|---|
| 50 | } |
|---|
| 51 | |
|---|
| 52 | $w = $config['percent_graph_width'] + 2; |
|---|
| 53 | if (empty($ci['istotal'])) { |
|---|
| 54 | $graph = freeblock_to_graph($ci['free_blocks'], $ci['size']); |
|---|
| 55 | $blocksgraph = "<div class=\"blocksgraph\" style=\"width: {$w}px\">{$graph}</div>"; |
|---|
| 56 | } |
|---|
| 57 | else { |
|---|
| 58 | $blocksgraph = ''; |
|---|
| 59 | } |
|---|
| 60 | |
|---|
| 61 | $ci_slots = size($ci['slots']); |
|---|
| 62 | $ci_size = size($ci['size']); |
|---|
| 63 | $ci_avail = size($ci['avail']); |
|---|
| 64 | $ci = number_formats($ci, $numkeys); |
|---|
| 65 | |
|---|
| 66 | $hits_avg_h = number_format(array_avg($ci['hits_by_hour']), 2); |
|---|
| 67 | $hits_avg_s = number_format(array_avg($ci['hits_by_second']), 2); |
|---|
| 68 | $hits_graph_h = get_cache_hits_graph($ci, 'hits_by_hour'); |
|---|
| 69 | |
|---|
| 70 | if (!empty($ci['istotal'])) { |
|---|
| 71 | $ci['status'] = '-'; |
|---|
| 72 | $ci['can_readonly'] = '-'; |
|---|
| 73 | } |
|---|
| 74 | else { |
|---|
| 75 | if ($ci['disabled']) { |
|---|
| 76 | $ci['status'] = $l_disabled |
|---|
| 77 | . sprintf("(%s)", age($ci['disabled'])); |
|---|
| 78 | } |
|---|
| 79 | else if ($ci['type'] == XC_TYPE_PHP) { |
|---|
| 80 | $ci['status'] = $ci['compiling'] |
|---|
| 81 | ? $l_compiling . sprintf("(%s)", age($ci['compiling'])) |
|---|
| 82 | : $l_normal; |
|---|
| 83 | } |
|---|
| 84 | else { |
|---|
| 85 | $ci['status'] = '-'; |
|---|
| 86 | } |
|---|
| 87 | $ci['can_readonly'] = $ci['can_readonly'] ? 'yes' : 'no'; |
|---|
| 88 | } |
|---|
| 89 | $enabledisable = $ci['disabled'] ? 'enable' : 'disable'; |
|---|
| 90 | $l_enabledisable = $ci['disabled'] ? $l_enable : $l_disable; |
|---|
| 91 | echo <<<EOS |
|---|
| 92 | <th>{$ci['cache_name']}</th> |
|---|
| 93 | <td align="right" title="{$ci['slots']}">{$ci_slots}</td> |
|---|
| 94 | <td align="right" title="{$ci['size']}">{$ci_size}</td> |
|---|
| 95 | <td align="right" title="{$ci['avail']}">{$ci_avail}</td> |
|---|
| 96 | <td title="{$pvalue} %" |
|---|
| 97 | ><div class="percent" style="width: {$w}px" |
|---|
| 98 | ><div style="width: {$pvalue}%" class="pvalue"></div |
|---|
| 99 | ><div style="width: {$pempty}%" class="pempty"></div |
|---|
| 100 | ></div |
|---|
| 101 | >{$blocksgraph}</td> |
|---|
| 102 | <td |
|---|
| 103 | ><form method="post" action="" |
|---|
| 104 | ><div |
|---|
| 105 | ><input type="hidden" name="type" value="{$ci['type']}" |
|---|
| 106 | /><input type="hidden" name="cacheid" value="{$ci['cacheid']}" |
|---|
| 107 | /><input type="submit" name="clearcache" value="{$l_clear}" class="submit" onclick="return confirm('{$l_confirm}');" |
|---|
| 108 | /><input type="submit" name="{$enabledisable}" value="{$l_enabledisable}" class="submit" |
|---|
| 109 | /></div |
|---|
| 110 | ></form |
|---|
| 111 | ></td> |
|---|
| 112 | <td>{$ci['status']}</td> |
|---|
| 113 | <td align="right">{$ci['hits']}</td> |
|---|
| 114 | <td>{$hits_graph_h}</td> |
|---|
| 115 | <td align="right">{$hits_avg_h}</td> |
|---|
| 116 | <td align="right">{$hits_avg_s}</td> |
|---|
| 117 | <td align="right">{$ci['updates']}</td> |
|---|
| 118 | <td align="right">{$ci['skips']}</td> |
|---|
| 119 | <td align="right">{$ci['ooms']}</td> |
|---|
| 120 | <td align="right">{$ci['errors']}</td> |
|---|
| 121 | <td>{$ci['can_readonly']}</td> |
|---|
| 122 | <td align="right">{$ci['cached']}</td> |
|---|
| 123 | <td align="right">{$ci['deleted']}</td> |
|---|
| 124 | <td align="right">{$ci['gc']}</td> |
|---|
| 125 | |
|---|
| 126 | EOS; |
|---|
| 127 | ?> |
|---|
| 128 | </tr> |
|---|
| 129 | <?php } ?> |
|---|
| 130 | </table> |
|---|
| 131 | <div class="blockarea legends"> |
|---|
| 132 | <div class="legendtitle"><?php echo _('Legends:'); ?></div> |
|---|
| 133 | <div class="legend pvalue"> </div> |
|---|
| 134 | <div class="legendtitle"><?php echo _($config['percent_graph_type'] == 'free' ? '% Free' : '% Used'); ?></div> |
|---|
| 135 | <div class="legend" style="background: rgb(0,0,255)"> </div> |
|---|
| 136 | <div class="legendtitle"><?php echo _($config['percent_graph_type'] == 'free' ? 'Free Blocks' : 'Used Blocks'); ?></div> |
|---|
| 137 | <div class="legend" style="background: rgb(255,0,0)"> </div> |
|---|
| 138 | <div class="legendtitle"><?php echo _('Hits'); ?></div> |
|---|
| 139 | </div> |
|---|
| 140 | <?php unset($cycleClass); ?> |
|---|