Browse Source

cacher/admin: adds more phpinfo when XCache is not loaded. improve looking in module info

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@1041 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
3.0
Xuefer 10 years ago
parent
commit
1cf7c83962
  1. 17
      mod_cacher/htdocs/xcache.css
  2. 31
      mod_cacher/htdocs/xcache.php
  3. 2
      mod_cacher/htdocs/xcache.tpl.php

17
mod_cacher/htdocs/xcache.css

@ -1,7 +1,8 @@
input, table { font-family: sans-serif; }
input { font-size: 12px; }
table { border-collapse: collapse; font-size: 11px; margin: 0; margin-bottom: 10px; }
table caption, h2 { font-size: 16px; font-weight: bold; text-align: left; padding-top: 20px; margin-bottom: 2px; }
table { border-collapse: collapse; font-size: 11px; margin: 0; }
table caption, h2, h3 { font-size: 16px; font-weight: bold; text-align: left; padding-top: 20px; margin-bottom: 2px; }
h3 { font-size: 14px; padding-top: 2px; margin-bottom: 0px; }
td, th { white-space: pre; }
table.cycles { border: 1px solid black; margin-top: 5px; margin-bottom: 5px; }
table.cycles .col1 { background-color: #f5f5f5; }
@ -10,12 +11,12 @@ table.cycles th, table.cycles td { border: 1px solid black; font-family: monospa
table.cycles th { background-color: #9999cc; color: black; font-weight: bold; height: 20px; line-height: 20px; font-family: serif; }
th a { color: black; font-weight: bold; display: block; width: 100%; height: 100%; }
th { font-size: 12px; }
.moduleinfo table { border: 1px solid black; }
.moduleinfo table th, .moduleinfo table td { border: 1px solid black; }
.moduleinfo table th { font-weight: bold; }
.moduleinfo .e {background-color: #ccccff; font-weight: bold; color: #000000;}
.moduleinfo .h {background-color: #9999cc; font-weight: bold; color: #000000;}
.moduleinfo .v {background-color: #cccccc; color: #000000;}
.phpinfo table { border: 1px solid black; margin-bottom: 1px; }
.phpinfo table th, .phpinfo table td { border: 1px solid black; }
.phpinfo table th { font-weight: bold; }
.phpinfo .e {background-color: #ccccff; font-weight: bold; color: #000000;}
.phpinfo .h {background-color: #9999cc; font-weight: bold; color: #000000;}
.phpinfo .v {background-color: #cccccc; color: #000000;}
.button { }
span.sortarrow { color: white; text-decoration: none; }
form {margin: 0; padding: 0}

31
mod_cacher/htdocs/xcache.php

@ -206,12 +206,25 @@ function th($name, $attrs = null)
, "\n");
}
$php_version = phpversion();
$xcache_version = XCACHE_VERSION;
$xcache_modules = XCACHE_MODULES;
if (!extension_loaded('XCache')) {
include("header.tpl.php");
echo '<h1>XCache is not loaded</h1>';
ob_start();
phpinfo();
phpinfo(INFO_GENERAL);
$info = ob_get_clean();
if (preg_match('!<td class="v">(.*\\.ini)!', $info, $m)) {
if (preg_match_all("!<tr>[^<]*<td[^>]*>[^<]*(?:Configuration|ini|Server API)[^<]*</td>[^<]*<td[^>]*>[^<]*</td>[^<]*</tr>!s", $info, $m)) {
echo '<div class="phpinfo">';
echo 'PHP Info';
echo '<table>';
echo implode('', $m[0]);
echo '</table>';
echo '</div>';
}
if (preg_match('!<td class="v">(.*?\\.ini)!', $info, $m)) {
echo "Please check $m[1]";
}
else if (preg_match('!Configuration File \\(php.ini\\) Path *</td><td class="v">([^<]+)!', $info, $m)) {
@ -220,6 +233,8 @@ if (!extension_loaded('XCache')) {
else {
echo "You don't even have a php.ini yet?";
}
echo "(See above)";
include("footer.tpl.php");
exit;
}
$pcnt = xcache_count(XC_TYPE_PHP);
@ -368,8 +383,13 @@ default:
ob_start();
phpinfo(INFO_MODULES);
$moduleinfo = ob_get_clean();
if (preg_match_all('!XCache[^<]*</a></h2>(.*?)<h2>!is', $moduleinfo, $m)) {
$moduleinfo = implode('', $m[1]);
if (preg_match_all('!(XCache[^<>]*)</a></h2>(.*?)<h2>!is', $moduleinfo, $m)) {
$moduleinfo = array();
foreach ($m[1] as $i => $dummy) {
$moduleinfo[] = '<h3>' . trim($m[1][$i]) . '</h3>';
$moduleinfo[] = str_replace('<br />', '', trim($m[2][$i]));
}
$moduleinfo = implode('', $moduleinfo);
}
else {
$moduleinfo = null;
@ -381,9 +401,6 @@ default:
$type_php = XC_TYPE_PHP;
$type_var = XC_TYPE_VAR;
$types = array($type_none => _('Statistics'), $type_php => _('List PHP'), $type_var => _('List Var Data'));
$php_version = phpversion();
$xcache_version = XCACHE_VERSION;
$xcache_modules = XCACHE_MODULES;
include("xcache.tpl.php");

2
mod_cacher/htdocs/xcache.tpl.php

@ -294,7 +294,7 @@ if ($moduleinfo) {
$t_moduleinfo = _("Module Info");
echo <<<HTML
<h2>$t_moduleinfo</h2>
<div class="moduleinfo">$moduleinfo</div>
<div class="phpinfo">$moduleinfo</div>
HTML;
}
?>

Loading…
Cancel
Save