Index: trunk/htdocs/diagnosis/index.php
===================================================================
--- trunk/htdocs/diagnosis/index.php	(revision 1089)
+++ trunk/htdocs/diagnosis/index.php	(revision 1090)
@@ -6,5 +6,5 @@
 
 $notes = array();
-function note($type, $reason, $suggestion)
+function note($type, $reason, $suggestion = "ok") // {{{
 {
 	global $notes;
@@ -15,5 +15,5 @@
 			);
 }
-
+// }}}
 function getCacheInfos() // {{{
 {
@@ -35,49 +35,105 @@
 	return $cacheInfos;
 }
+// }}}
 
-$cacheInfos = getCacheInfos();
+if (!extension_loaded('XCache')) {
+	ob_start();
+	phpinfo(INFO_GENERAL);
+	$info = ob_get_clean();
+	ob_start();
+	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)) {
+		echo "Please put a php.ini in $m[1] and load XCache extension";
+	}
+	else {
+		echo "You don't even have a php.ini yet?";
+	}
+	echo "(See above)";
+	note("error", _T('XCache is not loaded'), ob_get_clean());
+}
+else {
+	note("info", _T('XCache loaded'));
 
-// if (!$ini['xcache.size'] || !$ini['xcache.cacher']) {
+	$cacheInfos = getCacheInfos();
 
-foreach ($cacheInfos as $cacheInfo) {
-	if ($cacheInfo['ooms']) {
+	if (!ini_get("xcache.size") || !ini_get("xcache.cacher")) {
+		note(
+			"error"
+			, _T("XCache is not enabled. Website is not accelerated by XCache")
+			, _T("Set xcache.size to non-zero, set xcache.cacher = On")
+			);
+	}
+	else {
+		note("info", _T('XCache Enabled'));
+	}
+
+	$ooms = false;
+	foreach ($cacheInfos as $cacheInfo) {
+		if ($cacheInfo['ooms']) {
+			$ooms = true;
+			break;
+		}
+	}
+	if ($ooms) {
 		note(
 			"warning"
-			, "Out of memory happened when trying to write to cache"
+			, _T("Out of memory happened when trying to write to cache")
 			, "Increase xcache.size and/or xcache.var_size"
 			);
-		break;
 	}
-}
+	else {
+		note("info", _T('XCache Memory Size'));
+	}
 
-foreach ($cacheInfos as $cacheInfo) {
-	if ($cacheInfo['errors']) {
+	$errors = false;
+	foreach ($cacheInfos as $cacheInfo) {
+		if ($cacheInfo['errors']) {
+			$errors = true;
+			break;
+		}
+	}
+	if ($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"
+			, _T("Error happened when compiling at least one of your PHP code")
+			, _T("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;
 	}
+	else {
+		note("info", _T('All PHP scripts seem fine'));
+	}
+
+	/*
+	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 ($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()) {
