Browse Source

adds diagnosis module

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@1089 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
3.0
Xuefer 9 years ago
parent
commit
f9b4ab0c41
  1. 2
      htdocs/common/common-zh-simplified.lang.php
  2. 2
      htdocs/common/common-zh-traditional.lang.php
  3. 3
      htdocs/common/common.php
  4. 2
      htdocs/diagnosis/diagnosis.tpl.php
  5. 103
      htdocs/diagnosis/index.php

2
htdocs/common/common-zh-simplified.lang.php

@ -5,6 +5,8 @@ $strings += array(
=> '缓存器',
'Coverager'
=> '代码覆盖查看器',
'Diagnosis'
=> '诊断',
'Document'
=> '帮助文档',
'INI Reference'

2
htdocs/common/common-zh-traditional.lang.php

@ -5,6 +5,8 @@ $strings += array(
=> '快取器',
'Coverager'
=> '代码覆盖查看器',
'Diagnosis'
=> '診斷',
'Document'
=> '幫助文檔',
'INI Reference'

3
htdocs/common/common.php

@ -269,6 +269,9 @@ if (file_exists("../cacher/index.php")) {
if (file_exists("../coverager/index.php")) {
$modules["coverager"] = _T("Coverager");
}
if (file_exists("../diagnosis/index.php")) {
$modules["diagnosis"] = _T("Diagnosis");
}
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
header("Content-Type: text/html; " . $GLOBALS['config']['charset']);

2
htdocs/diagnosis/diagnosis.tpl.php

@ -0,0 +1,2 @@
<?php include "../common/header.tpl.php"; ?>
<?php include "../common/footer.tpl.php"; ?>

103
htdocs/diagnosis/index.php

@ -0,0 +1,103 @@
<?php
include "../common/common.php";
$module = "diagnosis";
$notes = array();
function note($type, $reason, $suggestion)
{
global $notes;
$notes[] = array(
'type' => $type
, 'reason' => $reason
, 'suggestion' => $suggestion
);
}
function getCacheInfos() // {{{
{
$phpCacheCount = xcache_count(XC_TYPE_PHP);
$varCacheCount = xcache_count(XC_TYPE_VAR);
$cacheInfos = array();
for ($i = 0; $i < $phpCacheCount; $i ++) {
$cacheInfo = xcache_info(XC_TYPE_PHP, $i);
$cacheInfo['type'] = XC_TYPE_PHP;
$cacheInfos[] = $cacheInfo;
}
for ($i = 0; $i < $varCacheCount; $i ++) {
$cacheInfo = xcache_info(XC_TYPE_VAR, $i);
$cacheInfo['type'] = XC_TYPE_VAR;
$cacheInfos[] = $cacheInfo;
}
return $cacheInfos;
}
$cacheInfos = getCacheInfos();
// if (!$ini['xcache.size'] || !$ini['xcache.cacher']) {
foreach ($cacheInfos as $cacheInfo) {
if ($cacheInfo['ooms']) {
note(
"warning"
, "Out of memory happened when trying to write to cache"
, "Increase xcache.size and/or xcache.var_size"
);
break;
}
}
foreach ($cacheInfos as $cacheInfo) {
if ($cacheInfo['errors']) {
note(
"warning"
, "Error happened when compiling your PHP code"
, "This usually means there is syntax error in your PHP code. Enable PHP error_log to see what parser error is it, fix your code"
);
break;
}
}
/*
if ($ini['xcache.count'] < cpucount() * 2) {
}
if ($ini['xcache.size'] is small $ini['xcache.slots'] is big) {
}
if ($ini['xcache.readonly_protection']) {
}
if ($cache['compiling']) {
}
if ($cache['compiling']) {
}
if ($cache['disabled']) {
}
if (($coredumpFiles = globCoreDumpFiles()) {
}
if (module not for server) {
}
$phpVersion = php_version();
foreach ($knownUnstablePhpVersion as $unstablePhpVersion => $reason) {
if (substr($phpVersion, 0, strlen($unstablePhpVersion)) == $unstablePhpVersion) {
// ..
}
}
if (Zend Optimizer is loaded, zend optimize level > 0) {
warn("disabled");
}
*/
include "./diagnosis.tpl.php";
Loading…
Cancel
Save