system: remove debug mode, disable display errors on runtime for development mode #5889

This commit is contained in:
Franco Fichtner 2022-07-19 16:47:00 +02:00
parent 0d77a46b1f
commit a256697cbf
4 changed files with 14 additions and 9 deletions

View File

@ -133,6 +133,13 @@ function webgui_configure_do($verbose = false, $interface = '')
/* regenerate the php.ini files in case the setup has changed */
configd_run('template reload OPNsense/WebGui');
/* we need a marker file for debug mode to ensure quick action */
if (empty($config['system']['deployment'])) {
@unlink('/var/run/development');
} else {
@touch('/var/run/development');
}
/*
* Force reloading all php-cgi children to
* avoid hiccups with moved include files.

View File

@ -25,10 +25,8 @@ error_reporting = E_ALL ^ (E_WARNING | E_NOTICE | E_DEPRECATED | E_STRICT | E_CO
{% else %}
error_reporting = E_ALL
{% endif %}
display_errors={% if system.deployment|default("") != "development" %}on{%else%}off{%endif%}
display_startup_errors={% if system.deployment|default("") == "debug" %}on{%else%}off{%endif%}
display_errors=on
display_startup_errors=off
log_errors=on
error_log=/tmp/PHP_errors.log
date.timezone="{{system.timezone|default('Etc/UTC')}}"

View File

@ -31,6 +31,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
if (file_exists('/var/run/development')) {
ini_set('display_errors', 0);
}
require_once("util.inc");
require_once("config.inc");

View File

@ -671,7 +671,7 @@ $(document).ready(function() {
<input name="httpaccesslog" type="checkbox" value="yes" <?= empty($pconfig['httpaccesslog']) ? '' : 'checked="checked"' ?> />
<?=gettext("Enable access log"); ?>
<div class="hidden" data-for="help_for_httpaccesslog">
<?=gettext("Enable access logging on the webinterface for debugging and analysis purposes.") ?>
<?=gettext("Enable access logging on the web GUI for debugging and analysis purposes.") ?>
</div>
</td>
</tr>
@ -1048,13 +1048,9 @@ $(document).ready(function() {
<option value="development" <?= $pconfig['deployment'] == 'development' ? 'selected="selected"' : '' ?>>
<?=gettext("Development");?>
</option>
<option value="debug" <?=$pconfig['deployment'] == 'debug' ? 'selected="selected"' : '' ?>>
<?=gettext("Debug");?>
</option>
</select>
<div class="hidden" data-for="help_for_deployment">
<?=gettext("Set the deployment type of this OPNsense instance.");?></br>
<?=gettext("Warning: enabling debug mode will affect the GUI's layout and may break usability.");?>
</div>
</td>
</tr>