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