aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mod/diagnostics/languages/en.php10
-rw-r--r--mod/diagnostics/start.php44
2 files changed, 48 insertions, 6 deletions
diff --git a/mod/diagnostics/languages/en.php b/mod/diagnostics/languages/en.php
index ff3198393..15c8b6750 100644
--- a/mod/diagnostics/languages/en.php
+++ b/mod/diagnostics/languages/en.php
@@ -28,8 +28,8 @@ Generated %s by %s
Elgg Release %s, version %s
------------------------------------------------------------------------',
- 'diagnostics:report:session' => '
-Current session:
+ 'diagnostics:report:php' => '
+PHP info:
%s
------------------------------------------------------------------------',
'diagnostics:report:plugins' => '
@@ -42,6 +42,12 @@ Installed files and checksums:
%s
------------------------------------------------------------------------',
+ 'diagnostics:report:globals' => '
+Global variables:
+
+%s
+------------------------------------------------------------------------',
+
);
add_translation("en",$english);
diff --git a/mod/diagnostics/start.php b/mod/diagnostics/start.php
index a9e3828e5..38cb6b167 100644
--- a/mod/diagnostics/start.php
+++ b/mod/diagnostics/start.php
@@ -130,18 +130,53 @@
}
/**
- * Get some information about the current session
+ * Get some information about the php install
*
* @param unknown_type $hook
* @param unknown_type $entity_type
* @param unknown_type $returnvalue
* @param unknown_type $params
*/
- function diagnostics_session_hook($hook, $entity_type, $returnvalue, $params)
+ function diagnostics_phpinfo_hook($hook, $entity_type, $returnvalue, $params)
{
global $CONFIG;
- $returnvalue .= sprintf(elgg_echo('diagnostics:report:session'), print_r($_SESSION, true));
+ ob_start();
+ phpinfo();
+ $phpinfo = array('phpinfo' => array());
+
+ if(preg_match_all('#(?:<h2>(?:<a name=".*?">)?(.*?)(?:</a>)?</h2>)|(?:<tr(?: class=".*?")?><t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>)?)?</tr>)#s', ob_get_clean(), $matches, PREG_SET_ORDER))
+
+ foreach($matches as $match)
+ {
+ if(strlen($match[1]))
+ $phpinfo[$match[1]] = array();
+ else if(isset($match[3]))
+ $phpinfo[end(array_keys($phpinfo))][$match[2]] = isset($match[4]) ? array($match[3], $match[4]) : $match[3];
+ else
+ $phpinfo[end(array_keys($phpinfo))][] = $match[2];
+ }
+
+
+ $returnvalue .= sprintf(elgg_echo('diagnostics:report:php'), print_r($phpinfo, true));
+
+ return $returnvalue;
+ }
+
+ /**
+ * Get global variables.
+ *
+ * @param unknown_type $hook
+ * @param unknown_type $entity_type
+ * @param unknown_type $returnvalue
+ * @param unknown_type $params
+ * @return unknown
+ */
+ function diagnostics_globals_hook($hook, $entity_type, $returnvalue, $params)
+ {
+ global $CONFIG;
+
+ $returnvalue .= sprintf(elgg_echo('diagnostics:report:globals'), print_r($GLOBALS, true));
return $returnvalue;
}
@@ -154,5 +189,6 @@
register_plugin_hook("diagnostics:report", "all", "diagnostics_plugins_hook", 2); // Now the plugins
register_plugin_hook("diagnostics:report", "all", "diagnostics_sigs_hook", 1); // Now the signatures
- register_plugin_hook("diagnostics:report", "all", "diagnostics_session_hook"); // Session
+ register_plugin_hook("diagnostics:report", "all", "diagnostics_globals_hook"); // Global variables
+ register_plugin_hook("diagnostics:report", "all", "diagnostics_phpinfo_hook"); // PHP info
?> \ No newline at end of file