1
0
Fork 0

fixed undefined variable when XCache is not loaded

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@1169 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
3.0
Xuefer 2012-11-13 06:16:50 +00:00
parent ceb8518110
commit d04f6a8c72
1 changed files with 32 additions and 27 deletions

View File

@ -217,35 +217,40 @@ else {
}
// }}}
checking(_T("Hash Slots")); // {{{
$slotsTooBig = null;
$slotsTooSmall = null;
foreach ($cacheInfos as $cacheInfo) {
if ($cacheInfo['size'] < '1024000' && $cacheInfo['slots'] >= '8192') {
$slotsTooBig = $cacheInfo['type'];
break;
}
if ($cacheInfo['slots'] < $cacheInfo['cached'] / 2) {
$slotsTooSmall = $cacheInfo['type'];
break;
}
}
if (isset($slotsTooBig)) {
$prefix = $slotsTooBig == XC_TYPE_PHP ? '' : 'var_';
result(N_("warning")
, _T("Slots value too big")
, sprintf(_T("A very small value is set to %s value and leave %s value is too big.\n"
. "Decrease %s if small cache is really what you want"), "xcache.{$prefix}size", "xcache.{$prefix}slots", "xcache.{$prefix}slots")
);
}
else if (isset($slotsTooSmall)) {
$prefix = $slotsTooSmall == XC_TYPE_PHP ? '' : 'var_';
result(N_("warning")
, _T("Slots value too small")
, sprintf(_T("So many item are cached. Increase %s to a more proper value"), "xcache.{$prefix}slots")
);
if (!$xcacheLoaded) {
result(N_("skipped"), "XCache not loaded");
}
else {
result(N_("info"), _T('Looks good'));
$slotsTooBig = null;
$slotsTooSmall = null;
foreach ($cacheInfos as $cacheInfo) {
if ($cacheInfo['size'] < '1024000' && $cacheInfo['slots'] >= '8192') {
$slotsTooBig = $cacheInfo['type'];
break;
}
if ($cacheInfo['slots'] < $cacheInfo['cached'] / 2) {
$slotsTooSmall = $cacheInfo['type'];
break;
}
}
if (isset($slotsTooBig)) {
$prefix = $slotsTooBig == XC_TYPE_PHP ? '' : 'var_';
result(N_("warning")
, _T("Slots value too big")
, sprintf(_T("A very small value is set to %s value and leave %s value is too big.\n"
. "Decrease %s if small cache is really what you want"), "xcache.{$prefix}size", "xcache.{$prefix}slots", "xcache.{$prefix}slots")
);
}
else if (isset($slotsTooSmall)) {
$prefix = $slotsTooSmall == XC_TYPE_PHP ? '' : 'var_';
result(N_("warning")
, _T("Slots value too small")
, sprintf(_T("So many item are cached. Increase %s to a more proper value"), "xcache.{$prefix}slots")
);
}
else {
result(N_("info"), _T('Looks good'));
}
}
// }}}
checking(_T("Cache Status")); // {{{