diff --git a/htdocs/cacher/cacher.entrylist.tpl.php b/htdocs/cacher/cacher.entrylist.tpl.php new file mode 100644 index 0000000..062420d --- /dev/null +++ b/htdocs/cacher/cacher.entrylist.tpl.php @@ -0,0 +1,152 @@ + +
+ + +next(); +echo << + +TR; + +if ($isphp) { + echo + th("entry.id") + ; +} +else { + echo + th("entry.remove") + ; +} + +echo + th(N_("entry.name")) + , th(N_("entry.hits")) + , th(N_("entry.size")) + ; + +if ($isphp) { + echo + th(N_("entry.refcount")) + , th(N_("entry.phprefcount")) + , th(N_("entry.class_cnt")) + , th(N_("entry.function_cnt")) + , th(N_("entry.file_size")) + , th(N_("entry.file_mtime")) + ; + if ($haveinode) { + echo + th(N_("entry.file_device")) + , th(N_("entry.file_inode")) + ; + } +} +echo + th(N_("entry.hash")) + , th(N_("entry.atime")) + , th(N_("entry.ctime")) + ; + +if ($listName == 'Deleted') { + echo + th(N_("entry.delete")) + ; +} +?> + + $entry) { + $class = $cycleClass->next(); + echo << + +TR; + $name = htmlspecialchars($entry['name']); + $hits = number_format($entry['hits']); + $size = size($entry['size']); + if ($isphp) { + $class_cnt = number_format($entry['class_cnt']); + $function_cnt = number_format($entry['function_cnt']); + $phprefcount = number_format($entry['phprefcount']); + $file_size = size($entry['file_size']); + } + + if ($isphp) { + $file_mtime = age($entry['file_mtime']); + } + $ctime = age($entry['ctime']); + $atime = age($entry['atime']); + if ($listName == 'Deleted') { + $dtime = age($entry['dtime']); + } + + if ($isphp) { + $namelink = $name; + echo <<{$entry['cache_name']} {$i} + +ENTRY; + } + else { + echo << + +ENTRY; + $uname = urlencode($entry['name']); + $namelink = "$name"; + } + + echo <<{$namelink} + + + +ENTRY; + if ($isphp) { + $refcount = number_format($entry['refcount']); + echo <<{$entry['refcount']} + + + + + + +ENTRY; + if (isset($entry['file_inode'])) { + echo <<{$entry['file_device']} + + +ENTRY; + } + } + echo <<{$entry['hvalue']} + + + +ENTRY; + if ($listName == 'Deleted') { + echo <<{$dtime} + +ENTRY; + } + + echo << + +TR; +} +?> +
{$entry['hits']}{$size}{$phprefcount}{$class_cnt}{$function_cnt}{$file_size}{$file_mtime}{$entry['file_inode']}{$atime}{$ctime}
+ + "> + +
+ diff --git a/htdocs/cacher/cacher.summary.tpl.php b/htdocs/cacher/cacher.summary.tpl.php new file mode 100644 index 0000000..ac12620 --- /dev/null +++ b/htdocs/cacher/cacher.summary.tpl.php @@ -0,0 +1,139 @@ + + + + next(); ?>> + + + $ci) { + echo " + next(), ">"; + $pvalue = (int) ($ci['avail'] / $ci['size'] * 100); + $pempty = 100 - $pvalue; + if ($config['percent_graph_type'] == 'used') { + // swap + $tmp = $pvalue; + $pvalue = $pempty; + $pempty = $tmp; + } + + $w = $config['percent_graph_width'] + 2; + if (empty($ci['istotal'])) { + $graph = freeblock_to_graph($ci['free_blocks'], $ci['size']); + $blocksgraph = "
{$graph}
"; + } + else { + $blocksgraph = ''; + } + + $ci_slots = size($ci['slots']); + $ci_size = size($ci['size']); + $ci_avail = size($ci['avail']); + $ci = number_formats($ci, $numkeys); + + $hits_avg_h = number_format(array_avg($ci['hits_by_hour']), 2); + $hits_avg_s = number_format(array_avg($ci['hits_by_second']), 2); + $hits_graph_h = get_cache_hits_graph($ci, 'hits_by_hour'); + $hits_graph_h_w = count($ci['hits_by_hour']) * 2; + + if (!empty($ci['istotal'])) { + $ci['status'] = '-'; + $ci['can_readonly'] = '-'; + } + else { + if ($ci['disabled']) { + $ci['status'] = $l_disabled + . sprintf("(%s)", age($ci['disabled'])); + } + else if ($ci['type'] == $type_php) { + $ci['status'] = $ci['compiling'] + ? $l_compiling . sprintf("(%s)", age($ci['compiling'])) + : $l_normal; + } + else { + $ci['status'] = '-'; + } + $ci['can_readonly'] = $ci['can_readonly'] ? 'yes' : 'no'; + } + $enabledisable = $ci['disabled'] ? 'enable' : 'disable'; + $l_enabledisable = $ci['disabled'] ? $l_enable : $l_disable; + echo <<{$ci['cache_name']} + + + + + + + + + + + + + + + + + + +EOS; + + $cycleClass->reset(); + ?> + + +
{$ci_slots}{$ci_size}{$ci_avail}
{$blocksgraph}
{$ci['status']}{$ci['hits']}
{$hits_graph_h}
{$hits_avg_h}{$hits_avg_s}{$ci['updates']}{$ci['skips']}{$ci['ooms']}{$ci['errors']}{$ci['can_readonly']}{$ci['cached']}{$ci['deleted']}{$ci['gc']}
+
+
+
  
+
+
  
+
+
  
+
+
+ diff --git a/htdocs/cacher/cacher.tpl.php b/htdocs/cacher/cacher.tpl.php index b09f02b..57f1f2c 100644 --- a/htdocs/cacher/cacher.tpl.php +++ b/htdocs/cacher/cacher.tpl.php @@ -4,311 +4,29 @@ » - - - next(); ?>> - - - $ci) { - echo " - next(), ">"; - $pvalue = (int) ($ci['avail'] / $ci['size'] * 100); - $pempty = 100 - $pvalue; - if ($config['percent_graph_type'] == 'used') { - // swap - $tmp = $pvalue; - $pvalue = $pempty; - $pempty = $tmp; - } - - $w = $config['percent_graph_width'] + 2; - if (empty($ci['istotal'])) { - $graph = freeblock_to_graph($ci['free_blocks'], $ci['size']); - $blocksgraph = "
{$graph}
"; - } - else { - $blocksgraph = ''; - } - - $ci_slots = size($ci['slots']); - $ci_size = size($ci['size']); - $ci_avail = size($ci['avail']); - $ci = number_formats($ci, $numkeys); - - $hits_avg_h = number_format(array_avg($ci['hits_by_hour']), 2); - $hits_avg_s = number_format(array_avg($ci['hits_by_second']), 2); - $hits_graph_h = get_cache_hits_graph($ci, 'hits_by_hour'); - $hits_graph_h_w = count($ci['hits_by_hour']) * 2; - - if (!empty($ci['istotal'])) { - $ci['status'] = '-'; - $ci['can_readonly'] = '-'; - } - else { - if ($ci['disabled']) { - $ci['status'] = $l_disabled - . sprintf("(%s)", age($ci['disabled'])); - } - else if ($ci['type'] == $type_php) { - $ci['status'] = $ci['compiling'] - ? $l_compiling . sprintf("(%s)", age($ci['compiling'])) - : $l_normal; - } - else { - $ci['status'] = '-'; - } - $ci['can_readonly'] = $ci['can_readonly'] ? 'yes' : 'no'; - } - $enabledisable = $ci['disabled'] ? 'enable' : 'disable'; - $l_enabledisable = $ci['disabled'] ? $l_enable : $l_disable; - echo <<{$ci['cache_name']} - - - - - - - - - - - - - - - - - - -EOS; - - $b->reset(); - ?> - - -
{$ci_slots}{$ci_size}{$ci_avail}
{$blocksgraph}
{$ci['status']}{$ci['hits']}
{$hits_graph_h}
{$hits_avg_h}{$hits_avg_s}{$ci['updates']}{$ci['skips']}{$ci['ooms']}{$ci['errors']}{$ci['can_readonly']}{$ci['cached']}{$ci['deleted']}{$ci['gc']}
-
-
-
  
-
-
  
-
-
  
-
-
- $cachelist['cache_list'], 'Deleted' => $cachelist['deleted_list']) as $listname => $entries) { - $a->reset(); - ?> - -
- - -next(); - echo << - -TR; - if ($isphp) { - echo - th("entry.id") - ; - } - else { - echo - th("entry.remove") - ; - } - - echo - th(N_("entry.name")) - , th(N_("entry.hits")) - , th(N_("entry.size")) - ; - - if ($isphp) { - echo - th(N_("entry.refcount")) - , th(N_("entry.phprefcount")) - , th(N_("entry.class_cnt")) - , th(N_("entry.function_cnt")) - , th(N_("entry.file_size")) - , th(N_("entry.file_mtime")) - ; - if ($haveinode) { - echo - th(N_("entry.file_device")) - , th(N_("entry.file_inode")) - ; - } - } - echo - th(N_("entry.hash")) - , th(N_("entry.atime")) - , th(N_("entry.ctime")) - ; - - if ($listname == 'Deleted') { - echo - th(N_("entry.delete")) - ; - } - ?> - - $entry) { - $class = $a->next(); - echo << - -TR; - $name = htmlspecialchars($entry['name']); - $hits = number_format($entry['hits']); - $size = size($entry['size']); - if ($isphp) { - $class_cnt = number_format($entry['class_cnt']); - $function_cnt = number_format($entry['function_cnt']); - $phprefcount = number_format($entry['phprefcount']); - $file_size = size($entry['file_size']); - } - - if ($isphp) { - $file_mtime = age($entry['file_mtime']); - } - $ctime = age($entry['ctime']); - $atime = age($entry['atime']); - if ($listname == 'Deleted') { - $dtime = age($entry['dtime']); - } - - if ($isphp) { - $namelink = $name; - echo <<{$entry['cache_name']} {$i} - -ENTRY; - } - else { - echo << - -ENTRY; - $uname = urlencode($entry['name']); - $namelink = "$name"; - } - - echo <<{$namelink} - - - -ENTRY; - if ($isphp) { - $refcount = number_format($entry['refcount']); - echo <<{$entry['refcount']} - - - - - -ENTRY; - if (isset($entry['file_inode'])) { - echo <<{$entry['file_device']} - + $listName = 'Cached'; + $entries = $cachelist['cache_list']; + include "./cacher.entrylist.tpl.php"; -ENTRY; - } - } - echo <<{$entry['hvalue']} - - + $listName = 'Deleted'; + $entries = $cachelist['deleted_list']; + include "./cacher.entrylist.tpl.php"; -ENTRY; - if ($listname == 'Deleted') { - echo <<{$dtime} - -ENTRY; - } - - echo << - -TR; - } - ?> -
{$entry['hits']}{$size}{$phprefcount}{$class_cnt}{$function_cnt}{$file_size}{$file_mtime}{$entry['file_inode']}{$atime}{$ctime}
- - "> - -
-
- +