summaryrefslogtreecommitdiffstats
path: root/usr/local/www/crash_reporter.php
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2015-04-27 08:55:48 -0300
committerRenato Botelho <garga@FreeBSD.org>2015-04-27 08:55:48 -0300
commit701833bb9306089fa28bcc03b443cb9a5e3c3e11 (patch)
treeb6eba40f1472978f56c16e3e2372b118bc7da88a /usr/local/www/crash_reporter.php
parentdaac712a3cab2c67c09baed3fa3b518ea2aad263 (diff)
parent962f215d1fa05724f782e25490210fc0d1527155 (diff)
downloadpfsense-701833bb9306089fa28bcc03b443cb9a5e3c3e11.zip
pfsense-701833bb9306089fa28bcc03b443cb9a5e3c3e11.tar.gz
Merge pull request #1622 from phil-davis/usr-local-www
Diffstat (limited to 'usr/local/www/crash_reporter.php')
-rw-r--r--usr/local/www/crash_reporter.php19
1 files changed, 10 insertions, 9 deletions
diff --git a/usr/local/www/crash_reporter.php b/usr/local/www/crash_reporter.php
index fa18621..fe4c7ca 100644
--- a/usr/local/www/crash_reporter.php
+++ b/usr/local/www/crash_reporter.php
@@ -49,7 +49,7 @@ function upload_crash_report($files) {
global $g;
$post = array();
$counter = 0;
- foreach($files as $file) {
+ foreach ($files as $file) {
$post["file{$counter}"] = "@{$file}";
$counter++;
}
@@ -98,10 +98,11 @@ exec("/usr/bin/grep -vi warning /tmp/PHP_errors.log", $php_errors);
<?php
if (gettext($_POST['Submit']) == "Yes") {
echo gettext("Processing...");
- if (!is_dir("/var/crash"))
+ if (!is_dir("/var/crash")) {
mkdir("/var/crash", 0750, true);
+ }
@file_put_contents("/var/crash/crashreport_header.txt", $crash_report_header);
- if(file_exists("/tmp/PHP_errors.log")) {
+ if (file_exists("/tmp/PHP_errors.log")) {
copy("/tmp/PHP_errors.log", "/var/crash/PHP_errors.log");
}
exec("find /var/crash -type l -exec rm {} +");
@@ -111,7 +112,7 @@ exec("/usr/bin/grep -vi warning /tmp/PHP_errors.log", $php_errors);
echo gettext("Uploading...");
ob_flush();
flush();
- if(is_array($files_to_upload)) {
+ if (is_array($files_to_upload)) {
$resp = upload_crash_report($files_to_upload);
array_map('unlink', glob("/var/crash/*"));
// Erase the contents of the PHP error log
@@ -122,7 +123,7 @@ exec("/usr/bin/grep -vi warning /tmp/PHP_errors.log", $php_errors);
} else {
echo "Could not find any crash files.";
}
- } else if(gettext($_POST['Submit']) == "No") {
+ } else if (gettext($_POST['Submit']) == "No") {
array_map('unlink', glob("/var/crash/*"));
// Erase the contents of the PHP error log
fclose(fopen("/tmp/PHP_errors.log", 'w'));
@@ -135,14 +136,14 @@ exec("/usr/bin/grep -vi warning /tmp/PHP_errors.log", $php_errors);
$crash_reports .= "\nPHP Errors:\n";
$crash_reports .= implode("\n", $php_errors) . "\n\n";
}
- if(is_array($crash_files)) {
- foreach($crash_files as $cf) {
- if(filesize($cf) < FILE_SIZE) {
+ if (is_array($crash_files)) {
+ foreach ($crash_files as $cf) {
+ if (filesize($cf) < FILE_SIZE) {
$crash_reports .= "\nFilename: {$cf}\n";
$crash_reports .= file_get_contents($cf);
}
}
- } else {
+ } else {
echo "Could not locate any crash data.";
}
output_crash_reporter_html($crash_reports);
OpenPOWER on IntegriCloud