PHP80: Add deployment options

Since PHP80 decided to turn certain notices into warnings, a way to silence these is necessary, which also presents us with the opportunity to make this configurable.
This commit is contained in:
Stephan 2022-06-02 13:15:48 +02:00
parent a9211efbfc
commit 0488d3669a
2 changed files with 39 additions and 3 deletions

View File

@ -20,8 +20,13 @@ zlib.output_compression = {% if system.webgui.compression|default('') != "" %}On
zlib.output_compression_level = {{system.webgui.compression|default('1')}}
include_path = "/usr/local/etc/inc:/usr/local/www:/usr/local/opnsense/mvc:/usr/local/opnsense/contrib:/usr/local/share/pear:/usr/local/share"
ignore_repeated_errors = on
error_reporting = E_ALL ^ (E_NOTICE | E_DEPRECATED | E_STRICT)
display_errors=on
{% if system.deployment|default("production") == "production" %}
error_reporting = E_ALL ^ (E_WARNING | E_NOTICE | E_DEPRECATED | E_STRICT | E_CORE_WARNING | E_COMPILE_WARNING)
{% else %}
error_reporting = E_ALL
{% endif %}
display_errors={% if system.deployment|default("production") == "debug" %}on{%else%}off{%endif%}
log_errors=on
error_log=/tmp/PHP_errors.log
date.timezone="{{system.timezone|default('Etc/UTC')}}"

View File

@ -73,6 +73,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig['ssh-macs'] = !empty($config['system']['ssh']['macs']) ? explode(',', $config['system']['ssh']['macs']) : array();
$pconfig['ssh-keys'] = !empty($config['system']['ssh']['keys']) ? explode(',', $config['system']['ssh']['keys']) : array();
$pconfig['ssh-keysig'] = !empty($config['system']['ssh']['keysig']) ? explode(',', $config['system']['ssh']['keysig']) : array();
$pconfig['deployment'] = $config['system']['deployment'] ?? "production";
/* XXX listtag "fun" */
$pconfig['sshlogingroup'] = !empty($config['system']['ssh']['group'][0]) ? $config['system']['ssh']['group'][0] : null;
@ -145,7 +146,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$config['system']['webgui']['interfaces'] != $newinterfaces ||
(empty($pconfig['httpaccesslog'])) != empty($config['system']['webgui']['httpaccesslog']) ||
(empty($pconfig['ssl-hsts'])) != empty($config['system']['webgui']['ssl-hsts']) ||
($pconfig['disablehttpredirect'] == "yes") != !empty($config['system']['webgui']['disablehttpredirect']);
($pconfig['disablehttpredirect'] == "yes") != !empty($config['system']['webgui']['disablehttpredirect']) ||
($config['system']['deployment'] ?? null) != $pconfig['deployment'];
$config['system']['webgui']['protocol'] = $pconfig['webguiproto'];
$config['system']['webgui']['port'] = $pconfig['webguiport'];
@ -153,6 +155,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$config['system']['webgui']['ssl-ciphers'] = $newciphers;
$config['system']['webgui']['interfaces'] = $newinterfaces;
$config['system']['webgui']['compression'] = $pconfig['compression'];
$config['system']['deployment'] = $pconfig['deployment'];
if (!empty($pconfig['ssl-hsts'])) {
$config['system']['webgui']['ssl-hsts'] = true;
@ -1024,6 +1027,34 @@ $(document).ready(function() {
</tr>
</table>
</div>
<div class="content-box tab-content table-responsive __mb">
<table class="table table-striped opnsense_standard_table_form">
<tr>
<td style="width:22%"><strong><?= gettext('Deployment') ?></strong></td>
<td style="width:78%"></td>
</tr>
<tr>
<td><a id="help_for_deployment" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Deployment type")?></td>
<td>
<select name="deployment" class="selectpicker">
<option value="production" <?=$pconfig['deployment'] == "production" ? 'selected="selected"' : '';?>>
<?=gettext("Production");?>
</option>
<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>
</table>
</div>
<div class="content-box tab-content table-responsive">
<table class="table table-striped opnsense_standard_table_form">
<tr>