- Timestamp:
- 2012-07-29T06:45:04Z (6 years ago)
- Location:
- trunk/htdocs/cacher
- Files:
-
- 11 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/htdocs/cacher/cacher-zh-simplified.lang.php
r1074 r1078 41 41 => '缓存区', 42 42 'php Cached' 43 => '缓存的 php脚本',43 => '缓存的 PHP 脚本', 44 44 'php Deleted' 45 => '待删 php缓存',45 => '待删 PHP 缓存', 46 46 'var Cached' 47 47 => '缓存的变量', … … 79 79 => '操作|点击按钮清除对应共享内存区的数据', 80 80 'cache.status' 81 => '状态|状态标记. 当共享内存区正在编译 php脚本时标记为 "编译中". 当共享内存区暂停使用时标记为 "禁用"',81 => '状态|状态标记. 当共享内存区正在编译 PHP 脚本时标记为 "编译中". 当共享内存区暂停使用时标记为 "禁用"', 82 82 'cache.hits' 83 => '命中|共享内存命中次数, 命中=从该共享内存载入 php或者变量',83 => '命中|共享内存命中次数, 命中=从该共享内存载入 PHP 或者变量', 84 84 'cache.hits_avg_h' 85 85 => '命中/H|每小时命中次数. 只统计最后 24 小时', -
trunk/htdocs/cacher/cacher-zh-traditional.lang.php
r1074 r1078 41 41 => '快取', 42 42 'php Cached' 43 => '快取的 php指令',43 => '快取的 PHP 指令', 44 44 'php Deleted' 45 => '待刪 php指令',45 => '待刪 PHP 指令', 46 46 'var Cached' 47 47 => '快取的變數', … … 79 79 => '操作按鈕|點擊按鈕清除對應共享記憶體區的資料', 80 80 'cache.status' 81 => '狀態|狀態標記. 當共享內存區正在編譯 php腳本時標記為 "編譯中". 當共享內存區暫停使用時標記為 "禁用"',81 => '狀態|狀態標記. 當共享內存區正在編譯 PHP 腳本時標記為 "編譯中". 當共享內存區暫停使用時標記為 "禁用"', 82 82 'cache.hits' 83 => '命中|共享記憶體命中次數,命中=從該共享記憶體載入 php或者變數',83 => '命中|共享記憶體命中次數,命中=從該共享記憶體載入 PHP 或者變數', 84 84 'cache.hits_avg_h' 85 85 => '命中/H|每小时命中次数. 只统计最后 24 小时', -
trunk/htdocs/cacher/cacher.css
r1069 r1078 19 19 .hitsgraph div div.barv.active { border-color: yellow; } 20 20 21 #help { display: block; float: right; }22 21 dl { overflow: hidden; } 23 22 dt { font-weight: bold; clear: both; float: left; width: 100px; text-align: right; margin: 0; } -
trunk/htdocs/cacher/common.php
r1054 r1078 3 3 require_once "../common/common.php"; 4 4 5 include (get_language_file("cacher"));5 include get_language_file("cacher"); -
trunk/htdocs/cacher/edit.php
r1053 r1078 1 1 <?php 2 2 3 include ("./common.php");3 include "./common.php"; 4 4 5 5 if (!isset($_GET['name'])) { … … 39 39 $module = "cacher"; 40 40 41 include ("edit.tpl.php");41 include "edit.tpl.php"; 42 42 43 43 ?> -
trunk/htdocs/cacher/edit.tpl.php
r1053 r1078 1 <?php include ("../common/header.tpl.php"); ?>1 <?php include "../common/header.tpl.php"; ?> 2 2 <?php 3 3 $h_name = htmlspecialchars($name); … … 16 16 </fieldset> 17 17 </form> 18 <?php include ("../common/footer.tpl.php"); ?>18 <?php include "../common/footer.tpl.php"; ?> -
trunk/htdocs/cacher/help.tpl.php
r1062 r1078 1 <?php 2 include("./common.php"); 3 ?> 4 <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 5 <html xmlns="http://www.w3.org/1999/xhtml"> 6 <head> 7 <?php 8 echo <<<HEAD 9 <meta http-equiv="Content-Type" content="text/html; charset=$config[charset]" /> 10 <meta http-equiv="Content-Language" content="$config[lang]" /> 11 <script type="text/javascript" src="tablesort.js" charset="$config[charset]"></script> 12 HEAD; 13 ?> 14 15 <link rel="stylesheet" type="text/css" href="xcache.css" /> 16 <title><?php echo _('XCache Help'); ?></title> 17 <script> 18 function toggle(o) 19 { 20 o.style.display = o.style.display != 'block' ? 'block' : 'none'; 21 } 22 </script> 23 </head> 24 25 <body> 26 <h1><?php echo _('XCache Help'); ?></h1> 27 <div id1="help"> 28 <?php include(get_language_file("help")); ?> 1 <?php include "../common/header.tpl.php"; ?> 2 <div class="switcher"><?php echo switcher("do", $doTypes); ?></div> 3 <?php if (ini_get("xcache.test")) { ?> 4 <form method="post" action=""> 5 <div> 6 <input type="submit" name="coredump" value="Test coredump" class="submit" onclick="return confirm('<?php echo _('Sure?'); ?>');" /> 7 </div> 8 </form> 9 <?php } ?> 10 <div id="help"> 11 <?php include get_language_file("help"); ?> 29 12 </div> 30 31 <?php echo _('See also'); ?>: <a href="http://xcache.lighttpd.net/wiki/PhpIni">Setting php.ini for XCache</a> @ <a href="http://xcache.lighttpd.net/">XCache wiki</a> 32 </body> 33 </html> 13 <?php include "../common/footer.tpl.php" ?> -
trunk/htdocs/cacher/index.php
r1074 r1078 1 1 <?php 2 2 3 include ("./common.php");4 5 function freeblock_to_graph($freeblocks, $size) 3 include "./common.php"; 4 5 function freeblock_to_graph($freeblocks, $size) // {{{ 6 6 { 7 7 global $config; … … 42 42 return implode('', $html); 43 43 } 44 45 function calc_total(&$total, $data) 44 // }}} 45 function calc_total(&$total, $data) // {{{ 46 46 { 47 47 foreach ($data as $k => $v) { … … 71 71 } 72 72 } 73 74 function array_avg($a) 73 // }}} 74 function array_avg($a) // {{{ 75 75 { 76 76 if (count($a) == 0) { … … 79 79 return array_sum($a) / count($a); 80 80 } 81 82 function bar_hits_percent($v, $percent, $active) 81 // }}} 82 function bar_hits_percent($v, $percent, $active) // {{{ 83 83 { 84 84 $r = 220 + (int) ($percent * 25); … … 96 96 . '</div>'; 97 97 } 98 99 function get_cache_hits_graph($ci, $key) 100 { 98 // }}} 99 function get_cache_hits_graph($ci, $key) // {{{ 100 { 101 global $maxHitsByHour; 101 102 if ($ci['cacheid'] == -1) { 102 103 $max = max($ci[$key]); 103 104 } 104 105 else { 105 $max = $ GLOBALS['maxhits_by_hour'][$ci['type']];106 $max = $maxHitsByHour[$ci['type']]; 106 107 } 107 108 if (!$max) { … … 115 116 return implode('', $html); 116 117 } 117 118 function getModuleInfo() 118 // }}} 119 function getModuleInfo() // {{{ 119 120 { 120 121 ob_start(); … … 132 133 return implode('', $moduleInfo); 133 134 } 135 // }}} 136 function getCacheInfos() // {{{ 137 { 138 static $cacheInfos; 139 if (isset($cacheInfos)) { 140 return $cacheInfos; 141 } 142 143 $phpCacheCount = xcache_count(XC_TYPE_PHP); 144 $varCacheCount = xcache_count(XC_TYPE_VAR); 145 146 $cacheInfos = array(); 147 $total = array(); 148 global $maxHitsByHour; 149 $maxHitsByHour = array(0, 0); 150 for ($i = 0; $i < $phpCacheCount; $i ++) { 151 $data = xcache_info(XC_TYPE_PHP, $i); 152 if ($_GET['do'] === 'listphp') { 153 $data += xcache_list(XC_TYPE_PHP, $i); 154 } 155 $data['type'] = XC_TYPE_PHP; 156 $data['cache_name'] = "php#$i"; 157 $data['cacheid'] = $i; 158 $cacheInfos[] = $data; 159 $maxHitsByHour[XC_TYPE_PHP] = max($maxHitsByHour[XC_TYPE_PHP], max($data['hits_by_hour'])); 160 if ($phpCacheCount >= 2) { 161 calc_total($total, $data); 162 } 163 } 164 165 if ($phpCacheCount >= 2) { 166 $total['type'] = XC_TYPE_PHP; 167 $total['cache_name'] = _('Total'); 168 $total['cacheid'] = -1; 169 $total['gc'] = null; 170 $total['istotal'] = true; 171 unset($total['compiling']); 172 $cacheInfos[] = $total; 173 } 174 175 $total = array(); 176 for ($i = 0; $i < $varCacheCount; $i ++) { 177 $data = xcache_info(XC_TYPE_VAR, $i); 178 if ($_GET['do'] === 'listvar') { 179 $data += xcache_list(XC_TYPE_VAR, $i); 180 } 181 $data['type'] = XC_TYPE_VAR; 182 $data['cache_name'] = "var#$i"; 183 $data['cacheid'] = $i; 184 $cacheInfos[] = $data; 185 $maxHitsByHour[XC_TYPE_VAR] = max($maxHitsByHour[XC_TYPE_VAR], max($data['hits_by_hour'])); 186 if ($varCacheCount >= 2) { 187 calc_total($total, $data); 188 } 189 } 190 191 if ($varCacheCount >= 2) { 192 $total['type'] = XC_TYPE_VAR; 193 $total['cache_name'] = _('Total'); 194 $total['cacheid'] = -1; 195 $total['gc'] = null; 196 $total['istotal'] = true; 197 $cacheInfos[] = $total; 198 } 199 return $cacheInfos; 200 } 201 // }}} 202 function getEntryList() // {{{ 203 { 204 static $entryList; 205 if (isset($entryList)) { 206 return $entryList; 207 } 208 $entryList = array('cache_list' => array(), 'deleted_list' => array()); 209 if ($_GET['do'] == 'listphp') { 210 $entryList['type_name'] = 'php'; 211 $entryList['type'] = XC_TYPE_PHP; 212 } 213 else { 214 $entryList['type_name'] = 'var'; 215 $entryList['type'] = XC_TYPE_VAR; 216 } 217 foreach (getCacheInfos() as $i => $c) { 218 if (!empty($c['istotal'])) { 219 continue; 220 } 221 if ($c['type'] == $entryList['type'] && isset($c['cache_list'])) { 222 foreach ($c['cache_list'] as $e) { 223 $e['cache_name'] = $c['cache_name']; 224 $entryList['cache_list'][] = $e; 225 } 226 foreach ($c['deleted_list'] as $e) { 227 $e['cache_name'] = $c['cache_name']; 228 $entryList['deleted_list'][] = $e; 229 } 230 } 231 } 232 return $entryList; 233 } 234 // }}} 134 235 135 236 $module = "cacher"; 136 237 if (!extension_loaded('XCache')) { 137 include ("../common/header.tpl.php");238 include "../common/header.tpl.php"; 138 239 echo '<h1>XCache is not loaded</h1>'; 139 240 ob_start(); … … 158 259 } 159 260 echo "(See above)"; 160 include ("../common/footer.tpl.php");261 include "../common/footer.tpl.php"; 161 262 exit; 162 263 } 163 $pcnt = xcache_count(XC_TYPE_PHP); 164 $vcnt = xcache_count(XC_TYPE_VAR); 165 166 if ($_SERVER['REQUEST_METHOD'] == 'POST') { 167 $remove = @ $_POST['remove']; 168 if ($remove && is_array($remove)) { 169 foreach ($remove as $name) { 170 xcache_unset($name); 171 } 172 } 173 } 174 175 $listTypes = array('' => _('Summary'), 'listphp' => _('List PHP'), 'listvar' => _('List Var Data')); 176 177 if (!isset($_GET['do'])) { 178 $_GET['do'] = ''; 179 } 180 181 // {{{ process clear, enable, disable 182 function processAction() 183 { 264 265 $doTypes = array( 266 '' => _('Summary'), 267 'listphp' => _('List PHP'), 268 'listvar' => _('List Var Data'), 269 'help' => _('Help'), 270 ); 271 272 function processPOST() // {{{ 273 { 274 if (isset($_POST['remove']) && is_array($_POST['remove'])) { 275 foreach ($_POST['remove'] as $name) { 276 if (is_string($name)) { 277 xcache_unset($name); 278 } 279 } 280 } 281 184 282 $type = isset($_POST['type']) ? $_POST['type'] : null; 185 283 if ($type != XC_TYPE_PHP && $type != XC_TYPE_VAR) { … … 198 296 } 199 297 } 200 } 201 processAction(); 202 if (isset($_POST['coredump'])) { 203 xcache_coredump(); 204 } 205 // }}} 206 // {{{ load info/list 207 $cacheinfos = array(); 208 $total = array(); 209 $maxhits_by_hour = array(0, 0); 210 for ($i = 0; $i < $pcnt; $i ++) { 211 $data = xcache_info(XC_TYPE_PHP, $i); 212 if ($_GET['do'] === 'listphp') { 213 $data += xcache_list(XC_TYPE_PHP, $i); 214 } 215 $data['type'] = XC_TYPE_PHP; 216 $data['cache_name'] = "php#$i"; 217 $data['cacheid'] = $i; 218 $cacheinfos[] = $data; 219 $maxhits_by_hour[XC_TYPE_PHP] = max($maxhits_by_hour[XC_TYPE_PHP], max($data['hits_by_hour'])); 220 if ($pcnt >= 2) { 221 calc_total($total, $data); 222 } 223 } 224 225 if ($pcnt >= 2) { 226 $total['type'] = XC_TYPE_PHP; 227 $total['cache_name'] = _('Total'); 228 $total['cacheid'] = -1; 229 $total['gc'] = null; 230 $total['istotal'] = true; 231 unset($total['compiling']); 232 $cacheinfos[] = $total; 233 } 234 235 $total = array(); 236 for ($i = 0; $i < $vcnt; $i ++) { 237 $data = xcache_info(XC_TYPE_VAR, $i); 238 if ($_GET['do'] === 'listvar') { 239 $data += xcache_list(XC_TYPE_VAR, $i); 240 } 241 $data['type'] = XC_TYPE_VAR; 242 $data['cache_name'] = "var#$i"; 243 $data['cacheid'] = $i; 244 $cacheinfos[] = $data; 245 $maxhits_by_hour[XC_TYPE_VAR] = max($maxhits_by_hour[XC_TYPE_VAR], max($data['hits_by_hour'])); 246 if ($vcnt >= 2) { 247 calc_total($total, $data); 248 } 249 } 250 251 if ($vcnt >= 2) { 252 $total['type'] = XC_TYPE_VAR; 253 $total['cache_name'] = _('Total'); 254 $total['cacheid'] = -1; 255 $total['gc'] = null; 256 $total['istotal'] = true; 257 $cacheinfos[] = $total; 258 } 259 // }}} 260 // {{{ merge the list 298 299 if (isset($_POST['coredump'])) { 300 xcache_coredump(); 301 } 302 } 303 // }}} 304 305 processPOST(); 306 307 if (!isset($_GET['do'])) { 308 $_GET['do'] = ''; 309 } 310 261 311 switch ($_GET['do']) { 262 312 case 'listphp': 263 313 case 'listvar': 264 $cachelist = array('cache_list' => array(), 'deleted_list' => array()); 265 if ($_GET['do'] == 'listphp') { 266 $cachelist['type_name'] = 'php'; 267 $cachelist['type'] = XC_TYPE_PHP; 268 } 269 else { 270 $cachelist['type_name'] = 'var'; 271 $cachelist['type'] = XC_TYPE_VAR; 272 } 273 foreach ($cacheinfos as $i => $c) { 274 if (!empty($c['istotal'])) { 275 continue; 276 } 277 if ($c['type'] == $cachelist['type'] && isset($c['cache_list'])) { 278 foreach ($c['cache_list'] as $e) { 279 $e['cache_name'] = $c['cache_name']; 280 $cachelist['cache_list'][] = $e; 281 } 282 foreach ($c['deleted_list'] as $e) { 283 $e['cache_name'] = $c['cache_name']; 284 $cachelist['deleted_list'][] = $e; 285 } 286 } 287 } 288 if ($cachelist['type'] == XC_TYPE_PHP) { 289 $inodes = array(); 290 $haveinode = false; 291 foreach ($cachelist['cache_list'] as $e) { 292 if (isset($e['file_inode'])) { 293 $haveinode = true; 294 break; 295 } 296 } 297 if (!$haveinode) { 298 foreach ($cachelist['deleted_list'] as $e) { 299 if (isset($e['file_inode'])) { 300 $haveinode = true; 301 break; 302 } 303 } 304 } 305 } 306 unset($data); 307 include("./listentries.tpl.php"); 314 include "./listentries.tpl.php"; 308 315 break; 309 316 317 case 'help': 318 include "./help.tpl.php"; 319 break; 320 310 321 default: 311 include ("./summary.tpl.php");312 } 313 // }}}322 include "./summary.tpl.php"; 323 break; 324 } 314 325 315 326 ?> -
trunk/htdocs/cacher/listentries.tpl.php
r1074 r1078 1 <?php include("../common/header.tpl.php"); ?> 2 <div class="switcher"><?php echo switcher("do", $listTypes); ?></div> 1 <?php include "../common/header.tpl.php"; ?> 2 <div class="switcher"><?php echo switcher("do", $doTypes); ?></div> 3 <?php include "./sub/summary.tpl.php"; ?> 3 4 <?php 4 5 include "./sub/summary.tpl.php";6 $ isphp = $cachelist['type'] == 'listphp';5 $entryList = getEntryList(); 6 $isphp = $entryList['type'] == 'listphp'; 7 $typeName = $entryList['type_name']; 7 8 ob_start($config['path_nicer']); 8 9 9 10 $listName = 'Cached'; 10 $entries = $ cachelist['cache_list'];11 $entries = $entryList['cache_list']; 11 12 include "./sub/entrylist.tpl.php"; 12 13 13 14 $listName = 'Deleted'; 14 $entries = $ cachelist['deleted_list'];15 $entries = $entryList['deleted_list']; 15 16 include "./sub/entrylist.tpl.php"; 16 17 17 18 ob_end_flush(); 18 19 unset($isphp); 19 20 20 ?> 21 <?php include ("../common/footer.tpl.php"); ?>21 <?php include "../common/footer.tpl.php"; ?> -
trunk/htdocs/cacher/sub/entrylist.tpl.php
r1076 r1078 2 2 <form action="" method="post"> 3 3 <table cellspacing="0" cellpadding="4" class="cycles entries"> 4 <caption><?php echo _(" {$cachelist['type_name']}$listName"); ?></caption>4 <caption><?php echo _("$typeName $listName"); ?></caption> 5 5 <?php 6 6 … … 36 36 , th(N_("entry.file_mtime")) 37 37 ; 38 if ($haveinode) { 39 echo 40 th(N_("entry.file_device")) 41 , th(N_("entry.file_inode")) 42 ; 43 } 38 echo 39 th(N_("entry.file_device")) 40 , th(N_("entry.file_inode")) 41 ; 44 42 } 45 43 echo -
trunk/htdocs/cacher/sub/summary.tpl.php
r1076 r1078 35 35 $l_normal = _('Normal'); 36 36 $l_confirm = _('Sure?'); 37 foreach ( $cacheinfosas $i => $ci) {37 foreach (getCacheInfos() as $i => $ci) { 38 38 $class = $cycleClass->next(); 39 39 echo <<<TR -
trunk/htdocs/cacher/summary.tpl.php
r1074 r1078 1 <?php include("../common/header.tpl.php"); ?> 2 <div class="switcher"><?php echo switcher("do", $listTypes); ?></div> 3 <?php 4 include "./sub/summary.tpl.php"; 5 6 if (ini_get("xcache.test")) { 7 ?> 8 <form method="post" action=""> 9 <div> 10 <input type="submit" name="coredump" value="Test coredump" class="submit" onclick="return confirm('<?php echo _('Sure?'); ?>');" /> 11 </div> 12 </form> 13 <?php 14 } 15 ?> 16 <?php include("./sub/moduleinfo.tpl.php"); ?> 17 18 <?php include("../common/footer.tpl.php"); ?> 1 <?php include "../common/header.tpl.php"; ?> 2 <div class="switcher"><?php echo switcher("do", $doTypes); ?></div> 3 <?php include "./sub/summary.tpl.php"; ?> 4 <?php include "./sub/moduleinfo.tpl.php"; ?> 5 <?php include "../common/footer.tpl.php"; ?>
Note: See TracChangeset
for help on using the changeset viewer.