mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-20 03:16:12 +00:00
firmware: disable crash reporter submission on non-production deployment
Just fiddling with the soon to be replaced functionality. Remove the pedantic check so we can see everything even from the dashboard hint.
This commit is contained in:
parent
0819c4232b
commit
b724e2e434
@ -82,8 +82,9 @@ if (isset($_SERVER['HTTP_USER_AGENT'])) {
|
||||
}
|
||||
|
||||
$user_agent = "{$g['product_name']}/{$g['product_version']}";
|
||||
$crash_reports = array();
|
||||
$crash_reports = [];
|
||||
$has_crashed = false;
|
||||
$is_prod = empty($config['system']['deployment']);
|
||||
|
||||
$pconfig = array();
|
||||
$pconfig['Email'] = isset($config['system']['contact_email']) ? $config['system']['contact_email'] : '';
|
||||
@ -147,7 +148,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
}
|
||||
} else {
|
||||
/* if there is no user activity probe for a crash report */
|
||||
$has_crashed = get_crash_report(true) != '';
|
||||
$has_crashed = !empty(get_crash_report());
|
||||
}
|
||||
|
||||
if ($has_crashed) {
|
||||
@ -186,7 +187,11 @@ if ($has_crashed) {
|
||||
|
||||
$message = gettext('No issues were detected.');
|
||||
if ($has_crashed) {
|
||||
$message = gettext('An issue was detected.');
|
||||
if ($is_prod) {
|
||||
$message = gettext('An issue was detected.');
|
||||
} else {
|
||||
$message = gettext('Non-production deployment is configured so crash reports cannot be sent.');
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($pconfig['Submit'])) {
|
||||
@ -197,7 +202,9 @@ if (isset($pconfig['Submit'])) {
|
||||
$message = gettext('This crash report contains no actual crash information. If you want to submit a problem please fill out your e-mail and description below.');
|
||||
}
|
||||
} elseif ($pconfig['Submit'] == 'no') {
|
||||
$message = gettext('Please consider submitting a crash report if the error persists.');
|
||||
if ($is_prod) {
|
||||
$message = gettext('Please consider submitting a crash report if the error persists.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -216,17 +223,20 @@ legacy_html_escape_form_data($pconfig);
|
||||
<div class="content-box">
|
||||
<form method="post">
|
||||
<div class="col-xs-12">
|
||||
<?php
|
||||
if ($has_crashed):?>
|
||||
<?php if ($has_crashed): ?>
|
||||
<br/><button name="Submit" type="submit" class="btn btn-default pull-right" value="no"><?=gettext('Dismiss this report');?></button>
|
||||
<?php if ($is_prod): ?>
|
||||
<button name="Submit" type="submit" class="btn btn-primary pull-right" style="margin-right: 8px;" value="yes"><?=gettext('Submit this report');?></button>
|
||||
<p><strong><?= $message ?></strong></p>
|
||||
<p><?=gettext("Would you like to submit this crash report to the developers?");?></p>
|
||||
<hr><p><?=gettext('You can help us further by adding your contact information and a problem description. ' .
|
||||
'Please note that providing your contact information greatly improves the chances of bugs being fixed.');?></p>
|
||||
<p><input type="text" placeholder="<?= html_safe(gettext('your@email.com')) ?>" name="Email" value="<?= $pconfig['Email'] ?>"></p>
|
||||
<p><input type="text" placeholder="<?= html_safe(gettext('your@email.com')) ?>" name="Email" value="<?= html_safe($pconfig['Email']) ?>"></p>
|
||||
<p><textarea rows="5" placeholder="<?= html_safe(gettext('A short problem description or steps to reproduce.')) ?>" name="Desc"><?= $pconfig['Desc'] ?></textarea></p>
|
||||
<hr><p><?=gettext("Please double-check the following contents to ensure you are comfortable submitting the following information.");?></p>
|
||||
<?php else: ?>
|
||||
<p><strong><?= $message ?></strong></p>
|
||||
<?php endif ?>
|
||||
<?php
|
||||
foreach ($crash_reports as $report => $content):?>
|
||||
<p>
|
||||
@ -237,7 +247,7 @@ legacy_html_escape_form_data($pconfig);
|
||||
endforeach;
|
||||
else:?>
|
||||
|
||||
<input type="hidden" name="Email" value="<?= $pconfig['Email'] ?>">
|
||||
<input type="hidden" name="Email" value="<?= html_safe($pconfig['Email'] ?? '') ?>">
|
||||
<br/><button name="Submit" type="submit" class="btn btn-primary pull-right" value="new"><?=gettext('Report an issue');?></button>
|
||||
<p><strong><?=$message;?></strong></p><br/>
|
||||
<?php
|
||||
|
||||
@ -471,7 +471,7 @@ if (!$timezone) {
|
||||
|
||||
date_default_timezone_set($timezone);
|
||||
|
||||
function get_crash_report($pedantic = false)
|
||||
function get_crash_report()
|
||||
{
|
||||
if (!userIsAdmin($_SESSION['Username'])) {
|
||||
return;
|
||||
@ -484,22 +484,12 @@ function get_crash_report($pedantic = false)
|
||||
);
|
||||
$skip_files = array('.', '..', 'minfree', 'bounds', '');
|
||||
$PHP_errors_log = '/tmp/PHP_errors.log';
|
||||
$excludes = array();
|
||||
$count = 0;
|
||||
|
||||
if (!$pedantic) {
|
||||
$excludes[] = 'PHP Notice:';
|
||||
}
|
||||
|
||||
if (file_exists($PHP_errors_log)) {
|
||||
$extra = '';
|
||||
foreach ($excludes as $exclude) {
|
||||
$extra .= sprintf('/usr/bin/grep -v %s | ', escapeshellarg($exclude));
|
||||
}
|
||||
$total = shell_exec(sprintf(
|
||||
'/bin/cat %s | %s /usr/bin/wc -l | /usr/bin/awk \'{ print $1 }\'',
|
||||
$PHP_errors_log,
|
||||
$extra
|
||||
'/bin/cat %s | /usr/bin/wc -l | /usr/bin/awk \'{ print $1 }\'',
|
||||
$PHP_errors_log
|
||||
));
|
||||
if ($total > 0) {
|
||||
$count++;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user