Changeset 1072 for trunk/htdocs/cacher/cacher.tpl.php
- Timestamp:
- 2012-07-28T20:22:40+02:00 (10 months ago)
- File:
-
- 1 edited
-
trunk/htdocs/cacher/cacher.tpl.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/htdocs/cacher/cacher.tpl.php
r1071 r1072 5 5 </div> 6 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 <tr <?php echo $a->next(); ?>> 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")) 20 , th(N_("cache.status")) 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")) 26 , th(N_("cache.skips")) 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 ?> 35 </tr> 36 <?php 37 $numkeys = explode(',', 'slots,size,avail,hits,updates,skips,ooms,errors,cached,deleted'); 38 $l_clear = _('Clear'); 39 $l_disabled = _('Disabled'); 40 $l_disable = _('Disable'); 41 $l_enable = _('Enable'); 42 $l_compiling = _('Compiling'); 43 $l_normal = _('Normal'); 44 $l_confirm = _('Sure?'); 45 foreach ($cacheinfos as $i => $ci) { 46 echo " 47 <tr ", $a->next(), ">"; 48 $pvalue = (int) ($ci['avail'] / $ci['size'] * 100); 49 $pempty = 100 - $pvalue; 50 if ($config['percent_graph_type'] == 'used') { 51 // swap 52 $tmp = $pvalue; 53 $pvalue = $pempty; 54 $pempty = $tmp; 55 } 56 57 $w = $config['percent_graph_width'] + 2; 58 if (empty($ci['istotal'])) { 59 $graph = freeblock_to_graph($ci['free_blocks'], $ci['size']); 60 $blocksgraph = "<div class=\"blocksgraph\" style=\"width: {$w}px\">{$graph}</div>"; 61 } 62 else { 63 $blocksgraph = ''; 64 } 65 66 $ci_slots = size($ci['slots']); 67 $ci_size = size($ci['size']); 68 $ci_avail = size($ci['avail']); 69 $ci = number_formats($ci, $numkeys); 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); 73 $hits_graph_h = get_cache_hits_graph($ci, 'hits_by_hour'); 74 $hits_graph_h_w = count($ci['hits_by_hour']) * 2; 75 76 if (!empty($ci['istotal'])) { 77 $ci['status'] = '-'; 78 $ci['can_readonly'] = '-'; 79 } 80 else { 81 if ($ci['disabled']) { 82 $ci['status'] = $l_disabled 83 . sprintf("(%s)", age($ci['disabled'])); 84 } 85 else if ($ci['type'] == $type_php) { 86 $ci['status'] = $ci['compiling'] 87 ? $l_compiling . sprintf("(%s)", age($ci['compiling'])) 88 : $l_normal; 89 } 90 else { 91 $ci['status'] = '-'; 92 } 93 $ci['can_readonly'] = $ci['can_readonly'] ? 'yes' : 'no'; 94 } 95 $enabledisable = $ci['disabled'] ? 'enable' : 'disable'; 96 $l_enabledisable = $ci['disabled'] ? $l_enable : $l_disable; 97 echo <<<EOS 98 <th>{$ci['cache_name']}</th> 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> 102 <td title="{$pvalue} %" 103 ><div class="percent" style="width: {$w}px" 104 ><div style="width: {$pvalue}%" class="pvalue"></div 105 ><div style="width: {$pempty}%" class="pempty"></div 106 ></div 107 >{$blocksgraph}</td> 108 <td 109 ><form method="post" action="" 110 ><div 111 ><input type="hidden" name="type" value="{$ci['type']}" 112 /><input type="hidden" name="cacheid" value="{$ci['cacheid']}" 113 /><input type="submit" name="clearcache" value="{$l_clear}" class="submit" onclick="return confirm('{$l_confirm}');" 114 /><input type="submit" name="{$enabledisable}" value="{$l_enabledisable}" class="submit" 115 /></div 116 ></form 117 ></td> 118 <td>{$ci['status']}</td> 119 <td align="right">{$ci['hits']}</td> 120 <td><div class="hitsgraph" style="width: {$hits_graph_h_w}px">{$hits_graph_h}</div></td> 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> 127 <td>{$ci['can_readonly']}</td> 128 <td align="right">{$ci['cached']}</td> 129 <td align="right">{$ci['deleted']}</td> 130 <td align="right">{$ci['gc']}</td> 131 EOS; 132 133 $b->reset(); 134 ?> 135 </tr> 136 <?php } ?> 137 </table> 138 <div class="blockarea legends"> 139 <div class="legendtitle"><?php echo _('Legends:'); ?></div> 140 <div class="legend pvalue"> </div> 141 <div class="legendtitle"><?php echo _($config['percent_graph_type'] == 'free' ? '% Free' : '% Used'); ?></div> 142 <div class="legend" style="background: rgb(0,0,255)"> </div> 143 <div class="legendtitle"><?php echo _($config['percent_graph_type'] == 'free' ? 'Free Blocks' : 'Used Blocks'); ?></div> 144 <div class="legend" style="background: rgb(255,0,0)"> </div> 145 <div class="legendtitle"><?php echo _('Hits'); ?></div> 146 </div> 147 <?php 148 7 include "./cacher.summary.tpl.php"; 149 8 if ($cachelist) { 150 9 $isphp = $cachelist['type'] == $type_php; 151 10 ob_start($config['path_nicer']); 152 foreach (array('Cached' => $cachelist['cache_list'], 'Deleted' => $cachelist['deleted_list']) as $listname => $entries) {153 $a->reset();154 ?>155 11 156 <form action="" method="post"> 157 <table cellspacing="0" cellpadding="4" class="cycles entries"> 158 <caption><?php echo _("{$cachelist['type_name']} $listname"); ?></caption> 159 <?php 160 $class = $a->next(); 161 echo <<<TR 162 <tr {$class}> 12 $listName = 'Cached'; 13 $entries = $cachelist['cache_list']; 14 include "./cacher.entrylist.tpl.php"; 163 15 164 TR; 165 if ($isphp) { 166 echo 167 th("entry.id") 168 ; 169 } 170 else { 171 echo 172 th("entry.remove") 173 ; 174 } 16 $listName = 'Deleted'; 17 $entries = $cachelist['deleted_list']; 18 include "./cacher.entrylist.tpl.php"; 175 19 176 echo 177 th(N_("entry.name")) 178 , th(N_("entry.hits")) 179 , th(N_("entry.size")) 180 ; 20 ob_end_flush(); 21 unset($isphp); 22 } 181 23 182 if ($isphp) {183 echo184 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 echo193 th(N_("entry.file_device"))194 , th(N_("entry.file_inode"))195 ;196 }197 }198 echo199 th(N_("entry.hash"))200 , th(N_("entry.atime"))201 , th(N_("entry.ctime"))202 ;203 204 if ($listname == 'Deleted') {205 echo206 th(N_("entry.delete"))207 ;208 }209 ?>210 </tr>211 <?php212 foreach ($entries as $i => $entry) {213 $class = $a->next();214 echo <<<TR215 <tr $class>216 217 TR;218 $name = htmlspecialchars($entry['name']);219 $hits = number_format($entry['hits']);220 $size = size($entry['size']);221 if ($isphp) {222 $class_cnt = number_format($entry['class_cnt']);223 $function_cnt = number_format($entry['function_cnt']);224 $phprefcount = number_format($entry['phprefcount']);225 $file_size = size($entry['file_size']);226 }227 228 if ($isphp) {229 $file_mtime = age($entry['file_mtime']);230 }231 $ctime = age($entry['ctime']);232 $atime = age($entry['atime']);233 if ($listname == 'Deleted') {234 $dtime = age($entry['dtime']);235 }236 237 if ($isphp) {238 $namelink = $name;239 echo <<<ENTRY240 <td>{$entry['cache_name']} {$i}</td>241 242 ENTRY;243 }244 else {245 echo <<<ENTRY246 <td><label><input type="checkbox" name="remove[]" value="{$name}"/>{$entry['cache_name']} {$i}</label></td>247 248 ENTRY;249 $uname = urlencode($entry['name']);250 $namelink = "<a href=\"edit.php?name=$uname\">$name</a>";251 }252 253 echo <<<ENTRY254 <td>{$namelink}</td>255 <td align="right" int="{$entry['hits']}">{$entry['hits']}</td>256 <td align="right" int="{$entry['size']}">{$size}</td>257 258 ENTRY;259 if ($isphp) {260 $refcount = number_format($entry['refcount']);261 echo <<<ENTRY262 <td align="right" int="{$entry['refcount']}">{$entry['refcount']}</td>263 <td align="right" int="{$entry['phprefcount']}">{$phprefcount}</td>264 <td align="right" int="{$entry['class_cnt']}">{$class_cnt}</td>265 <td align="right" int="{$entry['function_cnt']}">{$function_cnt}</td>266 <td align="right" int="{$entry['file_size']}">{$file_size}</td>267 <td align="right" int="{$entry['file_mtime']}">{$file_mtime}</td>268 269 ENTRY;270 if (isset($entry['file_inode'])) {271 echo <<<ENTRY272 <td align="right" int="{$entry['file_device']}">{$entry['file_device']}</td>273 <td align="right" int="{$entry['file_inode']}">{$entry['file_inode']}</td>274 275 ENTRY;276 }277 }278 echo <<<ENTRY279 <td align="right" int="{$entry['hvalue']}">{$entry['hvalue']}</td>280 <td align="right" int="{$entry['atime']}">{$atime}</td>281 <td align="right" int="{$entry['ctime']}">{$ctime}</td>282 283 ENTRY;284 if ($listname == 'Deleted') {285 echo <<<ENTRY286 <td align="right" int="{$entry['dtime']}">{$dtime}</td>287 288 ENTRY;289 }290 291 echo <<<TR292 </tr>293 294 TR;295 }296 ?>297 </table>298 <?php if (!$isphp) { ?>299 <input type="submit" value="<?php echo _("Remove Selected"); ?>">300 <?php } ?>301 </form>302 <?php303 }304 ob_end_flush();305 }306 24 if ($moduleinfo) { 307 25 if (ini_get("xcache.test")) { … … 309 27 <form method="post" action=""> 310 28 <div> 311 <input type="submit" name="coredump" value="Test coredump" class="submit" onclick="return confirm('<?php echo $l_confirm?>');" />29 <input type="submit" name="coredump" value="Test coredump" class="submit" onclick="return confirm('<?php echo _('Sure?'); ?>');" /> 312 30 </div> 313 31 </form>
Note: See TracChangeset
for help on using the changeset viewer.

