aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-08-16 10:56:39 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-08-16 10:56:39 +0000
commita3e6db37cac7097abc4131b96b1ba522a4c0cdcf (patch)
tree5be8dcd8b153df194546b3259a170b1955473898 /mod
parent96dcdd542f9a7a7837028aa12a75d201e3dce0ae (diff)
downloadelgg-a3e6db37cac7097abc4131b96b1ba522a4c0cdcf.tar.gz
elgg-a3e6db37cac7097abc4131b96b1ba522a4c0cdcf.tar.bz2
Globals and PHP info added to diagnostics
git-svn-id: https://code.elgg.org/elgg/trunk@1963 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod')
-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