diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-08-16 10:56:39 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-08-16 10:56:39 +0000 |
commit | a3e6db37cac7097abc4131b96b1ba522a4c0cdcf (patch) | |
tree | 5be8dcd8b153df194546b3259a170b1955473898 /mod/diagnostics/start.php | |
parent | 96dcdd542f9a7a7837028aa12a75d201e3dce0ae (diff) | |
download | elgg-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/diagnostics/start.php')
-rw-r--r-- | mod/diagnostics/start.php | 44 |
1 files changed, 40 insertions, 4 deletions
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 |