Commit d78e5726 authored by Franco Fichtner's avatar Franco Fichtner

crash_reporter: more tweaking for better error reporting

parent 9e1b921e
......@@ -59,8 +59,7 @@ $g = array(
"hidebackupbeforeupgrade" => false,
"disablehelpmenu" => false,
"disablehelpicon" => false,
"disablecrashreporter" => false,
"crashreporterurl" => "https://crashreporter.opnsense.org/crash_reporter.php",
"crashreporterurl" => "https://crash.opnsense.org/",
"debug" => false,
"latest_config" => "11.1",
"nopkg_platforms" => array("cdrom"),
......
<?php
/*
Copyright (C) 2014 Deciso B.V.
Copyright (C) 2011 Scott Ullrich
......@@ -72,7 +73,7 @@ $crash_report_header .= php_uname("r") . "\n";
$crash_report_header .= php_uname("v") . "\n";
$crash_report_header .= "\nCrash report details:\n";
exec("/usr/bin/grep -vi warning /tmp/PHP_errors.log", $php_errors);
$php_errors = @file_get_contents('/tmp/PHP_errors.log');
?>
......@@ -123,9 +124,9 @@ exec("/usr/bin/grep -vi warning /tmp/PHP_errors.log", $php_errors);
} else {
$crash_files = glob("/var/crash/*");
$crash_reports = $crash_report_header;
if (count($php_errors) > 0) {
if (!empty($php_errors)) {
$crash_reports .= "\nPHP Errors:\n";
$crash_reports .= implode("\n", $php_errors) . "\n\n";
$crash_reports .= $php_errors;
}
if(is_array($crash_files)) {
foreach($crash_files as $cf) {
......
<?php
/*
Copyright (C) 2014 Deciso B.V.
Copyright (C) 2004-2012 Scott Ullrich
......@@ -50,26 +51,34 @@ if ($_REQUEST['act'] == 'alias_info_popup' && !preg_match("/\D/",$_REQUEST['alia
exit;
}
if($g['disablecrashreporter'] != true) {
// Check to see if we have a crash report
$x = 0;
if(file_exists("/tmp/PHP_errors.log")) {
$total = `/usr/bin/grep -vi warning /tmp/PHP_errors.log | /usr/bin/wc -l | /usr/bin/awk '{ print $1 }'`;
if($total > 0)
$x++;
/* CRASH REPORT BEGIN */
$x = 0;
if (file_exists('/tmp/PHP_errors.log')) {
/* don't notify about crash report when there's only errors */
$total = `/usr/bin/grep -v 'PHP Warning:' /tmp/PHP_errors.log | /usr/bin/wc -l | /usr/bin/awk '{ print $1 }'`;
if($total > 0) {
$x++;
}
$crash = glob("/var/crash/*");
$skip_files = array(".", "..", "minfree", "");
if(is_array($crash)) {
foreach($crash as $c) {
if (!in_array(basename($c), $skip_files))
$x++;
}
$crash = glob('/var/crash/*');
if (is_array($crash)) {
$skip_files = array('.', '..', 'minfree', '');
foreach($crash as $c) {
if (!in_array(basename($c), $skip_files)) {
$x++;
}
if($x > 0)
$savemsg = "{$g['product_name']} has detected a crash report or programming bug. Click <a href='crash_reporter.php'>here</a> for more information.";
}
}
if($x > 0) {
$savemsg = "{$g['product_name']} has detected a crash report or programming bug. Click <a href='crash_reporter.php'>here</a> for more information.";
}
/* CRASH REPORT END */
##build list of widgets
$directory = "/usr/local/www/widgets/widgets/";
$dirhandle = opendir($directory);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment