From ec8338592d229a3038272a9ea61bf4170db99f5f Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Tue, 8 Nov 2022 10:24:31 +0100 Subject: [PATCH] add notice for settings that might require reconfiguration of specific services Signed-off-by: Michael Kaufmann --- actions/admin/settings/120.system.php | 3 +- actions/admin/settings/122.froxlorvhost.php | 103 +++++++++++--------- actions/admin/settings/130.webserver.php | 15 ++- actions/admin/settings/131.ssl.php | 27 ++--- actions/admin/settings/135.fcgid.php | 9 +- actions/admin/settings/136.phpfpm.php | 3 +- actions/admin/settings/140.statistics.php | 4 +- actions/admin/settings/150.mail.php | 9 +- actions/admin/settings/160.nameserver.php | 15 ++- lib/Froxlor/User.php | 2 + lib/configfiles/bionic.xml | 3 +- lib/configfiles/bookworm.xml | 3 +- lib/configfiles/bullseye.xml | 3 +- lib/configfiles/buster.xml | 3 +- lib/configfiles/focal.xml | 3 +- lib/configfiles/gentoo.xml | 3 +- lib/configfiles/jammy.xml | 3 +- lng/de.lng.php | 1 + lng/en.lng.php | 1 + templates/Froxlor/form/formfields.html.twig | 10 ++ 20 files changed, 124 insertions(+), 99 deletions(-) diff --git a/actions/admin/settings/120.system.php b/actions/admin/settings/120.system.php index 23c60083..b304fd43 100644 --- a/actions/admin/settings/120.system.php +++ b/actions/admin/settings/120.system.php @@ -40,7 +40,8 @@ return [ 'plausibility_check_method' => [ '\\Froxlor\\Validate\\Check', 'checkPathConflicts' - ] + ], + 'requires_reconf' => ['http'] ], 'system_documentroot_use_default_value' => [ 'label' => lng('serversettings.documentroot_use_default_value'), diff --git a/actions/admin/settings/122.froxlorvhost.php b/actions/admin/settings/122.froxlorvhost.php index 4f8c3871..6d58e44e 100644 --- a/actions/admin/settings/122.froxlorvhost.php +++ b/actions/admin/settings/122.froxlorvhost.php @@ -29,9 +29,9 @@ return [ 'groups' => [ 'froxlorvhost' => [ 'title' => lng('admin.froxlorvhost') . (call_user_func([ - '\Froxlor\Settings\FroxlorVhostSettings', - 'hasVhostContainerEnabled' - ]) == false ? lng('admin.novhostcontainer') : ''), + '\Froxlor\Settings\FroxlorVhostSettings', + 'hasVhostContainerEnabled' + ]) == false ? lng('admin.novhostcontainer') : ''), 'icon' => 'fa-solid fa-wrench', 'fields' => [ /** @@ -67,9 +67,10 @@ return [ 'default' => false, 'save_method' => 'storeSettingClearCertificates', 'visible' => Settings::Get('system.leenabled') && call_user_func([ - '\Froxlor\Settings\FroxlorVhostSettings', - 'hasVhostContainerEnabled' - ], true) + '\Froxlor\Settings\FroxlorVhostSettings', + 'hasVhostContainerEnabled' + ], true), + 'requires_reconf' => ['http'] ], 'system_le_froxlor_redirect' => [ 'label' => lng('serversettings.le_froxlor_redirect'), @@ -79,9 +80,9 @@ return [ 'default' => false, 'save_method' => 'storeSettingField', 'visible' => Settings::Get('system.use_ssl') && call_user_func([ - '\Froxlor\Settings\FroxlorVhostSettings', - 'hasVhostContainerEnabled' - ], true) + '\Froxlor\Settings\FroxlorVhostSettings', + 'hasVhostContainerEnabled' + ], true) ], 'system_hsts_maxage' => [ 'label' => lng('admin.domain_hsts_maxage'), @@ -93,9 +94,9 @@ return [ 'default' => 10368000, 'save_method' => 'storeSettingField', 'visible' => Settings::Get('system.use_ssl') && call_user_func([ - '\Froxlor\Settings\FroxlorVhostSettings', - 'hasVhostContainerEnabled' - ], true), + '\Froxlor\Settings\FroxlorVhostSettings', + 'hasVhostContainerEnabled' + ], true), 'advanced_mode' => true ], 'system_hsts_incsub' => [ @@ -106,9 +107,9 @@ return [ 'default' => false, 'save_method' => 'storeSettingField', 'visible' => Settings::Get('system.use_ssl') && call_user_func([ - '\Froxlor\Settings\FroxlorVhostSettings', - 'hasVhostContainerEnabled' - ], true), + '\Froxlor\Settings\FroxlorVhostSettings', + 'hasVhostContainerEnabled' + ], true), 'advanced_mode' => true ], 'system_hsts_preload' => [ @@ -119,9 +120,9 @@ return [ 'default' => false, 'save_method' => 'storeSettingField', 'visible' => Settings::Get('system.use_ssl') && call_user_func([ - '\Froxlor\Settings\FroxlorVhostSettings', - 'hasVhostContainerEnabled' - ], true), + '\Froxlor\Settings\FroxlorVhostSettings', + 'hasVhostContainerEnabled' + ], true), 'advanced_mode' => true ], 'system_honorcipherorder' => [ @@ -132,9 +133,9 @@ return [ 'default' => false, 'save_method' => 'storeSettingField', 'visible' => Settings::Get('system.use_ssl') && call_user_func([ - '\Froxlor\Settings\FroxlorVhostSettings', - 'hasVhostContainerEnabled' - ], true), + '\Froxlor\Settings\FroxlorVhostSettings', + 'hasVhostContainerEnabled' + ], true), 'advanced_mode' => true ], 'system_sessiontickets' => [ @@ -145,9 +146,9 @@ return [ 'default' => true, 'save_method' => 'storeSettingField', 'visible' => Settings::Get('system.use_ssl') && call_user_func([ - '\Froxlor\Settings\FroxlorVhostSettings', - 'hasVhostContainerEnabled' - ], true), + '\Froxlor\Settings\FroxlorVhostSettings', + 'hasVhostContainerEnabled' + ], true), 'advanced_mode' => true ], /** @@ -164,9 +165,10 @@ return [ 'apache2' ], 'visible' => Settings::Get('system.mod_fcgid') && call_user_func([ - '\Froxlor\Settings\FroxlorVhostSettings', - 'hasVhostContainerEnabled' - ]) + '\Froxlor\Settings\FroxlorVhostSettings', + 'hasVhostContainerEnabled' + ]), + 'requires_reconf' => ['system:fcgid'] ], 'system_mod_fcgid_httpuser' => [ 'label' => lng('admin.mod_fcgid_user'), @@ -179,9 +181,10 @@ return [ 'apache2' ], 'visible' => Settings::Get('system.mod_fcgid') && call_user_func([ - '\Froxlor\Settings\FroxlorVhostSettings', - 'hasVhostContainerEnabled' - ]) + '\Froxlor\Settings\FroxlorVhostSettings', + 'hasVhostContainerEnabled' + ]), + 'requires_reconf' => ['system:fcgid'] ], 'system_mod_fcgid_httpgroup' => [ 'label' => lng('admin.mod_fcgid_group'), @@ -194,9 +197,10 @@ return [ 'apache2' ], 'visible' => Settings::Get('system.mod_fcgid') && call_user_func([ - '\Froxlor\Settings\FroxlorVhostSettings', - 'hasVhostContainerEnabled' - ]) + '\Froxlor\Settings\FroxlorVhostSettings', + 'hasVhostContainerEnabled' + ]), + 'requires_reconf' => ['system:fcgid'] ], 'system_mod_fcgid_defaultini_ownvhost' => [ 'label' => lng('serversettings.mod_fcgid.defaultini_ownvhost'), @@ -213,9 +217,9 @@ return [ 'apache2' ], 'visible' => Settings::Get('system.mod_fcgid') && call_user_func([ - '\Froxlor\Settings\FroxlorVhostSettings', - 'hasVhostContainerEnabled' - ]) + '\Froxlor\Settings\FroxlorVhostSettings', + 'hasVhostContainerEnabled' + ]) ], /** * php-fpm @@ -228,9 +232,10 @@ return [ 'default' => true, 'save_method' => 'storeSettingField', 'visible' => Settings::Get('phpfpm.enabled') && call_user_func([ - '\Froxlor\Settings\FroxlorVhostSettings', - 'hasVhostContainerEnabled' - ]) + '\Froxlor\Settings\FroxlorVhostSettings', + 'hasVhostContainerEnabled' + ]), + 'requires_reconf' => ['system:php-fpm'] ], 'system_phpfpm_httpuser' => [ 'label' => lng('phpfpm.vhost_httpuser'), @@ -240,9 +245,10 @@ return [ 'default' => 'froxlorlocal', 'save_method' => 'storeSettingWebserverFcgidFpmUser', 'visible' => Settings::Get('phpfpm.enabled') && call_user_func([ - '\Froxlor\Settings\FroxlorVhostSettings', - 'hasVhostContainerEnabled' - ]) + '\Froxlor\Settings\FroxlorVhostSettings', + 'hasVhostContainerEnabled' + ]), + 'requires_reconf' => ['system:php-fpm'] ], 'system_phpfpm_httpgroup' => [ 'label' => lng('phpfpm.vhost_httpgroup'), @@ -252,9 +258,10 @@ return [ 'default' => 'froxlorlocal', 'save_method' => 'storeSettingField', 'visible' => Settings::Get('phpfpm.enabled') && call_user_func([ - '\Froxlor\Settings\FroxlorVhostSettings', - 'hasVhostContainerEnabled' - ]) + '\Froxlor\Settings\FroxlorVhostSettings', + 'hasVhostContainerEnabled' + ]), + 'requires_reconf' => ['system:php-fpm'] ], 'system_phpfpm_defaultini_ownvhost' => [ 'label' => lng('serversettings.mod_fcgid.defaultini_ownvhost'), @@ -268,9 +275,9 @@ return [ ], 'save_method' => 'storeSettingField', 'visible' => Settings::Get('phpfpm.enabled') && call_user_func([ - '\Froxlor\Settings\FroxlorVhostSettings', - 'hasVhostContainerEnabled' - ]) + '\Froxlor\Settings\FroxlorVhostSettings', + 'hasVhostContainerEnabled' + ]) ], /** * DNS diff --git a/actions/admin/settings/130.webserver.php b/actions/admin/settings/130.webserver.php index 2b48d5f0..4e7cead4 100644 --- a/actions/admin/settings/130.webserver.php +++ b/actions/admin/settings/130.webserver.php @@ -46,7 +46,8 @@ return [ 'plausibility_check_method' => [ '\\Froxlor\\Validate\\Check', 'checkPhpInterfaceSetting' - ] + ], + 'requires_reconf' => ['http'] ], 'system_apache_24' => [ 'label' => lng('serversettings.apache_24'), @@ -120,7 +121,8 @@ return [ 'type' => 'text', 'string_type' => 'filedir', 'default' => '/etc/apache2/sites-enabled/', - 'save_method' => 'storeSettingField' + 'save_method' => 'storeSettingField', + 'requires_reconf' => ['http'] ], 'system_apacheconf_diroptions' => [ 'label' => lng('serversettings.apacheconf_diroptions'), @@ -129,7 +131,8 @@ return [ 'type' => 'text', 'string_type' => 'filedir', 'default' => '/etc/apache2/sites-enabled/', - 'save_method' => 'storeSettingField' + 'save_method' => 'storeSettingField', + 'requires_reconf' => ['http'] ], 'system_apacheconf_htpasswddir' => [ 'label' => lng('serversettings.apacheconf_htpasswddir'), @@ -147,7 +150,8 @@ return [ 'type' => 'text', 'string_type' => 'dir', 'default' => '/var/customers/logs/', - 'save_method' => 'storeSettingField' + 'save_method' => 'storeSettingField', + 'requires_reconf' => ['http'] ], 'system_logfiles_script' => [ 'label' => lng('serversettings.logfiles_script'), @@ -252,7 +256,8 @@ return [ 'string_type' => 'dir', 'string_emptyallowed' => true, 'default' => '', - 'save_method' => 'storeSettingField' + 'save_method' => 'storeSettingField', + 'requires_reconf' => ['http'] ], 'system_default_vhostconf' => [ 'label' => lng('serversettings.default_vhostconf'), diff --git a/actions/admin/settings/131.ssl.php b/actions/admin/settings/131.ssl.php index 4b1174e5..bde8d857 100644 --- a/actions/admin/settings/131.ssl.php +++ b/actions/admin/settings/131.ssl.php @@ -39,7 +39,8 @@ return [ 'type' => 'checkbox', 'default' => false, 'save_method' => 'storeSettingField', - 'overview_option' => true + 'overview_option' => true, + 'requires_reconf' => ['http'] ], 'system_ssl_protocols' => [ 'label' => lng('serversettings.ssl.ssl_protocols'), @@ -145,7 +146,8 @@ return [ 'type' => 'checkbox', 'default' => false, 'cronmodule' => 'froxlor/letsencrypt', - 'save_method' => 'storeSettingField' + 'save_method' => 'storeSettingField', + 'requires_reconf' => ['http'] ], 'system_acmeshpath' => [ 'label' => lng('serversettings.acmeshpath'), @@ -164,23 +166,9 @@ return [ 'type' => 'text', 'string_type' => 'file', 'default' => '/etc/apache2/conf-enabled/acme.conf', - 'save_method' => 'storeSettingField' + 'save_method' => 'storeSettingField', + 'requires_reconf' => ['http'] ], - /** - * currently the only option anyway - * - * 'system_leapiversion' => array( - * 'label' => lng('serversettings.leapiversion'), - * 'settinggroup' => 'system', - * 'varname' => 'leapiversion', - * 'type' => 'select', - * 'default' => '2', - * 'select_var' => array( - * '2' => 'ACME v2' - * ), - * 'save_method' => 'storeSettingField' - * ), - */ 'system_letsencryptca' => [ 'label' => lng('serversettings.letsencryptca'), 'settinggroup' => 'system', @@ -204,7 +192,8 @@ return [ 'string_emptyallowed' => false, 'default' => Froxlor::getInstallDir(), 'save_method' => 'storeSettingField', - 'advanced_mode' => true + 'advanced_mode' => true, + 'requires_reconf' => ['http'] ], 'system_letsencryptkeysize' => [ 'label' => lng('serversettings.letsencryptkeysize'), diff --git a/actions/admin/settings/135.fcgid.php b/actions/admin/settings/135.fcgid.php index c8dd03c8..60598c01 100644 --- a/actions/admin/settings/135.fcgid.php +++ b/actions/admin/settings/135.fcgid.php @@ -44,7 +44,8 @@ return [ '\\Froxlor\\Validate\\Check', 'checkFcgidPhpFpm' ], - 'overview_option' => true + 'overview_option' => true, + 'requires_reconf' => ['http', 'system:fcgid'] ], 'system_mod_fcgid_configdir' => [ 'label' => lng('serversettings.mod_fcgid.configdir'), @@ -57,7 +58,8 @@ return [ '\\Froxlor\\Validate\\Check', 'checkPathConflicts' ], - 'save_method' => 'storeSettingField' + 'save_method' => 'storeSettingField', + 'requires_reconf' => ['system:fcgid'] ], 'system_mod_fcgid_tmpdir' => [ 'label' => lng('serversettings.mod_fcgid.tmpdir'), @@ -66,7 +68,8 @@ return [ 'type' => 'text', 'string_type' => 'dir', 'default' => '/var/customers/tmp/', - 'save_method' => 'storeSettingField' + 'save_method' => 'storeSettingField', + 'requires_reconf' => ['http'] ], 'system_mod_fcgid_peardir' => [ 'label' => lng('serversettings.mod_fcgid.peardir'), diff --git a/actions/admin/settings/136.phpfpm.php b/actions/admin/settings/136.phpfpm.php index 68d6b3e0..bdbcbbc4 100644 --- a/actions/admin/settings/136.phpfpm.php +++ b/actions/admin/settings/136.phpfpm.php @@ -42,7 +42,8 @@ return [ '\\Froxlor\\Validate\\Check', 'checkFcgidPhpFpm' ], - 'overview_option' => true + 'overview_option' => true, + 'requires_reconf' => ['http', 'system:php-fpm'] ], 'system_phpfpm_defaultini' => [ 'label' => lng('serversettings.mod_fcgid.defaultini'), diff --git a/actions/admin/settings/140.statistics.php b/actions/admin/settings/140.statistics.php index 6f4939ef..1973c488 100644 --- a/actions/admin/settings/140.statistics.php +++ b/actions/admin/settings/140.statistics.php @@ -43,6 +43,7 @@ return [ 'goaccess' => lng('serversettings.traffictool.goaccess') ], 'save_method' => 'storeSettingUpdateTrafficTool', + 'requires_reconf' => ['system'] ], 'system_webalizer_quiet' => [ 'label' => lng('serversettings.webalizer_quiet'), @@ -86,7 +87,8 @@ return [ 'string_type' => 'dir', 'default' => '/etc/awstats/', 'save_method' => 'storeSettingField', - 'visible' => Settings::Get('system.traffictool') == 'awstats' + 'visible' => Settings::Get('system.traffictool') == 'awstats', + 'requires_reconf' => ['system:awstats'] ], 'system_awstats_icons' => [ 'label' => lng('serversettings.awstats_icons'), diff --git a/actions/admin/settings/150.mail.php b/actions/admin/settings/150.mail.php index be05588f..5093c625 100644 --- a/actions/admin/settings/150.mail.php +++ b/actions/admin/settings/150.mail.php @@ -38,7 +38,8 @@ return [ 'min' => 2, 'max' => 65535, 'save_method' => 'storeSettingField', - 'advanced_mode' => true + 'advanced_mode' => true, + 'requires_reconf' => ['smtp'] ], 'system_vmail_gid' => [ 'label' => lng('serversettings.vmail_gid'), @@ -49,7 +50,8 @@ return [ 'min' => 2, 'max' => 65535, 'save_method' => 'storeSettingField', - 'advanced_mode' => true + 'advanced_mode' => true, + 'requires_reconf' => ['smtp'] ], 'system_vmail_homedir' => [ 'label' => lng('serversettings.vmail_homedir'), @@ -58,7 +60,8 @@ return [ 'type' => 'text', 'string_type' => 'dir', 'default' => '/var/customers/mail/', - 'save_method' => 'storeSettingField' + 'save_method' => 'storeSettingField', + 'requires_reconf' => ['smtp'] ], 'system_vmail_maildirname' => [ 'label' => lng('serversettings.vmail_maildirname'), diff --git a/actions/admin/settings/160.nameserver.php b/actions/admin/settings/160.nameserver.php index 21c72b7f..ad51acce 100644 --- a/actions/admin/settings/160.nameserver.php +++ b/actions/admin/settings/160.nameserver.php @@ -23,6 +23,8 @@ * @license https://files.froxlor.org/misc/COPYING.txt GPLv2 */ +use Froxlor\Settings; + return [ 'groups' => [ 'nameserver' => [ @@ -36,7 +38,8 @@ return [ 'type' => 'checkbox', 'default' => true, 'save_method' => 'storeSettingField', - 'overview_option' => true + 'overview_option' => true, + 'requires_reconf' => ['dns'] ], 'system_dnsenabled' => [ 'label' => lng('serversettings.dnseditorenable'), @@ -56,7 +59,8 @@ return [ 'Bind' => 'Bind9', 'PowerDNS' => 'PowerDNS' ], - 'save_method' => 'storeSettingField' + 'save_method' => 'storeSettingField', + 'requires_reconf' => ['dns'] ], 'system_bindconf_directory' => [ 'label' => lng('serversettings.bindconf_directory'), @@ -65,7 +69,9 @@ return [ 'type' => 'text', 'string_type' => 'dir', 'default' => '/etc/bind/', - 'save_method' => 'storeSettingField' + 'save_method' => 'storeSettingField', + 'visible' => Settings::Get('system.dns_server') == 'Bind', + 'requires_reconf' => ['dns:bind'] ], 'system_bindreload_command' => [ 'label' => lng('serversettings.bindreload_command'), @@ -117,7 +123,8 @@ return [ 'Master' => 'Master' ], 'save_method' => 'storeSettingField', - 'advanced_mode' => true + 'advanced_mode' => true, + 'visible' => Settings::Get('system.dns_server') == 'PowerDNS', ], 'system_dns_createmailentry' => [ 'label' => lng('serversettings.mail_also_with_mxservers'), diff --git a/lib/Froxlor/User.php b/lib/Froxlor/User.php index 2dd99d11..5d87e8a5 100644 --- a/lib/Froxlor/User.php +++ b/lib/Froxlor/User.php @@ -337,6 +337,8 @@ class User if ($field == 'diskspace' && ($customer_arr[$field] / 1024) != '-1') { $arr[$used_field] += intval($customer_arr[$field]); } elseif ($field == 'traffic_used') { + // no check for -1 here because we don't want the assigned traffic for admins/resellers but + // the actually used (for stats reasons) $arr[$used_field] += intval($customer_arr[$field]); } } diff --git a/lib/configfiles/bionic.xml b/lib/configfiles/bionic.xml index 716600c8..eea2968a 100644 --- a/lib/configfiles/bionic.xml +++ b/lib/configfiles/bionic.xml @@ -48,8 +48,6 @@ - - {{settings.system.deactivateddocroot}} @@ -4671,6 +4669,7 @@ aliases: files +