From 095e54d88dfdad2a1e7c73c4ed2b9435c00fe4ee Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Tue, 25 Sep 2018 08:17:31 +0200 Subject: [PATCH 1/5] fix missing update in version.inc.php Signed-off-by: Michael Kaufmann --- lib/version.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/version.inc.php b/lib/version.inc.php index eb1a527a..e2b46e06 100644 --- a/lib/version.inc.php +++ b/lib/version.inc.php @@ -19,7 +19,7 @@ $version = '0.9.39.5'; // Database version (YYYYMMDDC where C is a daily counter) -$dbversion = '201805290'; +$dbversion = '201809180'; // Distribution branding-tag (used for Debian etc.) $branding = ''; From 108c4c25b3e82999559eacab6c5733ae65c7f59e Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Wed, 26 Sep 2018 13:29:30 +0200 Subject: [PATCH 2/5] move 'enable http/2' setting from froxlor-vhost-settings to webserver-settings, fixes #575 Signed-off-by: Michael Kaufmann --- actions/admin/settings/122.froxlorvhost.php | 13 ------------- actions/admin/settings/130.webserver.php | 13 +++++++++++++ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/actions/admin/settings/122.froxlorvhost.php b/actions/admin/settings/122.froxlorvhost.php index 5ddbfc30..6175bb73 100644 --- a/actions/admin/settings/122.froxlorvhost.php +++ b/actions/admin/settings/122.froxlorvhost.php @@ -80,19 +80,6 @@ return array( 'save_method' => 'storeSettingField', 'visible' => Settings::Get('system.use_ssl') ), - 'system_http2_support' => array( - 'label' => $lng['serversettings']['http2_support'], - 'settinggroup' => 'system', - 'varname' => 'http2_support', - 'type' => 'bool', - 'default' => false, - 'save_method' => 'storeSettingField', - 'websrv_avail' => array( - 'apache2', - 'nginx' - ), - 'visible' => Settings::Get('system.use_ssl') - ), /** * FCGID */ diff --git a/actions/admin/settings/130.webserver.php b/actions/admin/settings/130.webserver.php index 4caa875f..84e81f18 100644 --- a/actions/admin/settings/130.webserver.php +++ b/actions/admin/settings/130.webserver.php @@ -60,6 +60,19 @@ return array( 'apache2' ) ), + 'system_http2_support' => array( + 'label' => $lng['serversettings']['http2_support'], + 'settinggroup' => 'system', + 'varname' => 'http2_support', + 'type' => 'bool', + 'default' => false, + 'save_method' => 'storeSettingField', + 'websrv_avail' => array( + 'apache2', + 'nginx' + ), + 'visible' => Settings::Get('system.use_ssl') + ), 'system_httpuser' => array( 'label' => $lng['admin']['webserver_user'], 'settinggroup' => 'system', From 6c7ee0c2227d1ec697532768f910c17060147dca Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Fri, 28 Sep 2018 10:55:08 +0200 Subject: [PATCH 3/5] add possibility to specify pm-related settings per php-config (if override of fpm-daemon settings is set to yes), fixes #573 Signed-off-by: Michael Kaufmann --- admin_phpsettings.php | 96 ++++++++++++++++++- install/froxlor.sql | 19 ++-- .../updates/froxlor/0.9/update_0.9.inc.php | 49 ++++++++++ .../phpinterface/class.phpinterface_fpm.php | 12 +++ .../phpconfig/formfield.phpconfig_add.php | 64 +++++++++++++ .../phpconfig/formfield.phpconfig_edit.php | 63 ++++++++++++ lib/version.inc.php | 2 +- lng/english.lng.php | 2 + lng/german.lng.php | 2 + 9 files changed, 295 insertions(+), 14 deletions(-) diff --git a/admin_phpsettings.php b/admin_phpsettings.php index 1d922b3f..904acb4b 100644 --- a/admin_phpsettings.php +++ b/admin_phpsettings.php @@ -125,12 +125,35 @@ if ($page == 'overview') { $fpm_reqtermtimeout = 0; $fpm_reqslowtimeout = 0; $fpm_pass_authorizationheader = 0; + $override_fpmconfig = 0; + $stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_FPMDAEMONS . "` WHERE `id` = :id"); + $def_fpmconfig = Database::pexecute_first($stmt, array( + 'id' => $fpm_config_id + )); + $pm = $def_fpmconfig['pm']; + $max_children = $def_fpmconfig['max_children']; + $start_servers = $def_fpmconfig['start_servers']; + $min_spare_servers = $def_fpmconfig['min_spare_servers']; + $max_spare_servers = $def_fpmconfig['max_spare_servers']; + $max_requests = $def_fpmconfig['max_requests']; + $idle_timeout = $def_fpmconfig['idle_timeout']; + $limit_extensions = $def_fpmconfig['limit_extensions']; + } elseif (Settings::Get('phpfpm.enabled') == 1) { $fpm_config_id = intval($_POST['fpmconfig']); $fpm_enableslowlog = isset($_POST['phpfpm_enable_slowlog']) ? (int) $_POST['phpfpm_enable_slowlog'] : 0; $fpm_reqtermtimeout = validate($_POST['phpfpm_reqtermtimeout'], 'phpfpm_reqtermtimeout', '/^([0-9]+)(|s|m|h|d)$/'); $fpm_reqslowtimeout = validate($_POST['phpfpm_reqslowtimeout'], 'phpfpm_reqslowtimeout', '/^([0-9]+)(|s|m|h|d)$/'); $fpm_pass_authorizationheader = isset($_POST['phpfpm_pass_authorizationheader']) ? (int) $_POST['phpfpm_pass_authorizationheader'] : 0; + $override_fpmconfig = isset($_POST['override_fpmconfig']) ? (int) $_POST['override_fpmconfig'] : 0; + $pm = $_POST['pm']; + $max_children = isset($_POST['max_children']) ? (int) $_POST['max_children'] : 0; + $start_servers = isset($_POST['start_servers']) ? (int) $_POST['start_servers'] : 0; + $min_spare_servers = isset($_POST['min_spare_servers']) ? (int) $_POST['min_spare_servers'] : 0; + $max_spare_servers = isset($_POST['max_spare_servers']) ? (int) $_POST['max_spare_servers'] : 0; + $max_requests = isset($_POST['max_requests']) ? (int) $_POST['max_requests'] : 0; + $idle_timeout = isset($_POST['idle_timeout']) ? (int) $_POST['idle_timeout'] : 0; + $limit_extensions = validate($_POST['limit_extensions'], 'limit_extensions', '/^(\.[a-z]([a-z0-9]+)\ ?)+$/'); // disable fcgid stuff $binary = '/usr/bin/php-cgi'; $file_extensions = 'php'; @@ -156,7 +179,16 @@ if ($page == 'overview') { `fpm_reqslow` = :fpmreqslow, `phpsettings` = :phpsettings, `fpmsettingid` = :fpmsettingid, - `pass_authorizationheader` = :fpmpassauth"); + `pass_authorizationheader` = :fpmpassauth, + `override_fpmconfig` = :ofc, + `pm` = :pm, + `max_children` = :max_children, + `start_servers` = :start_servers, + `min_spare_servers` = :min_spare_servers, + `max_spare_servers` = :max_spare_servers, + `max_requests` = :max_requests, + `idle_timeout` = :idle_timeout, + `limit_extensions` = :limit_extensions"); $ins_data = array( 'desc' => $description, 'binary' => $binary, @@ -169,7 +201,16 @@ if ($page == 'overview') { 'fpmreqslow' => $fpm_reqslowtimeout, 'phpsettings' => $phpsettings, 'fpmsettingid' => $fpm_config_id, - 'fpmpassauth' => $fpm_pass_authorizationheader + 'fpmpassauth' => $fpm_pass_authorizationheader, + 'ofc' => $override_fpmconfig, + 'pm' => $pm, + 'max_children' => $max_children, + 'start_servers' => $start_servers, + 'min_spare_servers' => $min_spare_servers, + 'max_spare_servers' => $max_spare_servers, + 'max_requests' => $max_requests, + 'idle_timeout' => $idle_timeout, + 'limit_extensions' => $limit_extensions ); Database::pexecute($ins_stmt, $ins_data); @@ -190,6 +231,10 @@ if ($page == 'overview') { $fpmconfigs .= makeoption($row['description'], $row['id'], 1, true, true); } + $pm_select = makeoption('static', 'static', 'static', true, true); + $pm_select.= makeoption('dynamic', 'dynamic', 'static', true, true); + $pm_select.= makeoption('ondemand', 'ondemand', 'static', true, true); + $phpconfig_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/phpconfig/formfield.phpconfig_add.php'; $phpconfig_add_form = htmlform::genHTMLForm($phpconfig_add_data); @@ -288,12 +333,35 @@ if ($page == 'overview') { $fpm_reqtermtimeout = 0; $fpm_reqslowtimeout = 0; $fpm_pass_authorizationheader = 0; + $override_fpmconfig = 0; + $stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_FPMDAEMONS . "` WHERE `id` = :id"); + $def_fpmconfig = Database::pexecute_first($stmt, array( + 'id' => $fpm_config_id + )); + $pm = $def_fpmconfig['pm']; + $max_children = $def_fpmconfig['max_children']; + $start_servers = $def_fpmconfig['start_servers']; + $min_spare_servers = $def_fpmconfig['min_spare_servers']; + $max_spare_servers = $def_fpmconfig['max_spare_servers']; + $max_requests = $def_fpmconfig['max_requests']; + $idle_timeout = $def_fpmconfig['idle_timeout']; + $limit_extensions = $def_fpmconfig['limit_extensions']; + } elseif (Settings::Get('phpfpm.enabled') == 1) { $fpm_config_id = intval($_POST['fpmconfig']); $fpm_enableslowlog = isset($_POST['phpfpm_enable_slowlog']) ? (int) $_POST['phpfpm_enable_slowlog'] : 0; $fpm_reqtermtimeout = validate($_POST['phpfpm_reqtermtimeout'], 'phpfpm_reqtermtimeout', '/^([0-9]+)(|s|m|h|d)$/'); $fpm_reqslowtimeout = validate($_POST['phpfpm_reqslowtimeout'], 'phpfpm_reqslowtimeout', '/^([0-9]+)(|s|m|h|d)$/'); $fpm_pass_authorizationheader = isset($_POST['phpfpm_pass_authorizationheader']) ? (int) $_POST['phpfpm_pass_authorizationheader'] : 0; + $override_fpmconfig = isset($_POST['override_fpmconfig']) ? (int) $_POST['override_fpmconfig'] : $result['override_fpmconfig']; + $pm = $_POST['pm']; + $max_children = isset($_POST['max_children']) ? (int) $_POST['max_children'] : $result['max_children']; + $start_servers = isset($_POST['start_servers']) ? (int) $_POST['start_servers'] : $result['start_servers']; + $min_spare_servers = isset($_POST['min_spare_servers']) ? (int) $_POST['min_spare_servers'] : $result['min_spare_servers']; + $max_spare_servers = isset($_POST['max_spare_servers']) ? (int) $_POST['max_spare_servers'] : $result['max_spare_servers']; + $max_requests = isset($_POST['max_requests']) ? (int) $_POST['max_requests'] : $result['max_requests']; + $idle_timeout = isset($_POST['idle_timeout']) ? (int) $_POST['idle_timeout'] : $result['idle_timeout']; + $limit_extensions = validate($_POST['limit_extensions'], 'limit_extensions', '/^(\.[a-z]([a-z0-9]+)\ ?)+$/'); // disable fcgid stuff $binary = '/usr/bin/php-cgi'; $file_extensions = 'php'; @@ -319,7 +387,16 @@ if ($page == 'overview') { `fpm_reqslow` = :fpmreqslow, `phpsettings` = :phpsettings, `fpmsettingid` = :fpmsettingid, - `pass_authorizationheader` = :fpmpassauth + `pass_authorizationheader` = :fpmpassauth, + `override_fpmconfig` = :ofc, + `pm` = :pm, + `max_children` = :max_children, + `start_servers` = :start_servers, + `min_spare_servers` = :min_spare_servers, + `max_spare_servers` = :max_spare_servers, + `max_requests` = :max_requests, + `idle_timeout` = :idle_timeout, + `limit_extensions` = :limit_extensions WHERE `id` = :id"); $upd_data = array( 'desc' => $description, @@ -334,6 +411,15 @@ if ($page == 'overview') { 'phpsettings' => $phpsettings, 'fpmsettingid' => $fpm_config_id, 'fpmpassauth' => $fpm_pass_authorizationheader, + 'ofc' => $override_fpmconfig, + 'pm' => $pm, + 'max_children' => $max_children, + 'start_servers' => $start_servers, + 'min_spare_servers' => $min_spare_servers, + 'max_spare_servers' => $max_spare_servers, + 'max_requests' => $max_requests, + 'idle_timeout' => $idle_timeout, + 'limit_extensions' => $limit_extensions, 'id' => $id ); Database::pexecute($upd_stmt, $upd_data); @@ -351,6 +437,10 @@ if ($page == 'overview') { while ($row = $configs->fetch(PDO::FETCH_ASSOC)) { $fpmconfigs .= makeoption($row['description'], $row['id'], $result['fpmsettingid'], true, true); } + + $pm_select = makeoption('static', 'static', $result['pm'], true, true); + $pm_select.= makeoption('dynamic', 'dynamic', $result['pm'], true, true); + $pm_select.= makeoption('ondemand', 'ondemand', $result['pm'], true, true); $phpconfig_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/phpconfig/formfield.phpconfig_edit.php'; $phpconfig_edit_form = htmlform::genHTMLForm($phpconfig_edit_data); diff --git a/install/froxlor.sql b/install/froxlor.sql index 80091911..82b0c6d3 100644 --- a/install/froxlor.sql +++ b/install/froxlor.sql @@ -406,21 +406,12 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('login', 'maxloginattempts', '3'), ('login', 'deactivatetime', '900'), ('phpfpm', 'enabled', '0'), - ('phpfpm', 'configdir', '/etc/php-fpm.d/'), - ('phpfpm', 'reload', '/etc/init.d/php-fpm restart'), - ('phpfpm', 'pm', 'static'), - ('phpfpm', 'max_children', '1'), - ('phpfpm', 'start_servers', '20'), - ('phpfpm', 'min_spare_servers', '5'), - ('phpfpm', 'max_spare_servers', '35'), - ('phpfpm', 'max_requests', '0'), ('phpfpm', 'tmpdir', '/var/customers/tmp/'), ('phpfpm', 'peardir', '/usr/share/php/:/usr/share/php5/'), ('phpfpm', 'envpath', '/usr/local/bin:/usr/bin:/bin'), ('phpfpm', 'enabled_ownvhost', '0'), ('phpfpm', 'vhost_httpuser', 'froxlorlocal'), ('phpfpm', 'vhost_httpgroup', 'froxlorlocal'), - ('phpfpm', 'idle_timeout', '30'), ('phpfpm', 'aliasconfigdir', '/var/www/php-fpm/'), ('phpfpm', 'defaultini', '1'), ('phpfpm', 'vhost_defaultini', '2'), @@ -694,7 +685,7 @@ opcache.interned_strings_buffer'), ('panel', 'password_special_char', '!?<>§$%+#=@'), ('panel', 'customer_hide_options', ''), ('panel', 'version', '0.9.39.5'), - ('panel', 'db_version', '201809180'); + ('panel', 'db_version', '201809280'); DROP TABLE IF EXISTS `panel_tasks`; @@ -902,6 +893,14 @@ CREATE TABLE `panel_phpconfigs` ( `phpsettings` text NOT NULL, `fpmsettingid` int(11) NOT NULL DEFAULT '1', `pass_authorizationheader` tinyint(1) NOT NULL default '0', + `pm` varchar(15) NOT NULL DEFAULT 'static', + `max_children` int(4) NOT NULL DEFAULT '1', + `start_servers` int(4) NOT NULL DEFAULT '20', + `min_spare_servers` int(4) NOT NULL DEFAULT '5', + `max_spare_servers` int(4) NOT NULL DEFAULT '35', + `max_requests` int(4) NOT NULL DEFAULT '0', + `idle_timeout` int(4) NOT NULL DEFAULT '30', + `limit_extensions` varchar(255) NOT NULL default '.php', PRIMARY KEY (`id`), KEY `fpmsettingid` (`fpmsettingid`) ) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; diff --git a/install/updates/froxlor/0.9/update_0.9.inc.php b/install/updates/froxlor/0.9/update_0.9.inc.php index 6b07bc11..6aeea723 100644 --- a/install/updates/froxlor/0.9/update_0.9.inc.php +++ b/install/updates/froxlor/0.9/update_0.9.inc.php @@ -4011,3 +4011,52 @@ if (isDatabaseVersion('201805290')) { updateToDbVersion('201809180'); } + +if (isDatabaseVersion('201809180')) { + + showUpdateStep("Adding new fields for php configs"); + Database::query("ALTER TABLE `" . TABLE_PANEL_PHPCONFIGS . "` ADD `override_fpmconfig` tinyint(1) NOT NULL DEFAULT '0';"); + Database::query("ALTER TABLE `" . TABLE_PANEL_PHPCONFIGS . "` ADD `pm` varchar(15) NOT NULL DEFAULT 'static';"); + Database::query("ALTER TABLE `" . TABLE_PANEL_PHPCONFIGS . "` ADD `max_children` int(4) NOT NULL DEFAULT '1';"); + Database::query("ALTER TABLE `" . TABLE_PANEL_PHPCONFIGS . "` ADD `start_servers` int(4) NOT NULL DEFAULT '20';"); + Database::query("ALTER TABLE `" . TABLE_PANEL_PHPCONFIGS . "` ADD `min_spare_servers` int(4) NOT NULL DEFAULT '5';"); + Database::query("ALTER TABLE `" . TABLE_PANEL_PHPCONFIGS . "` ADD `max_spare_servers` int(4) NOT NULL DEFAULT '35';"); + Database::query("ALTER TABLE `" . TABLE_PANEL_PHPCONFIGS . "` ADD `max_requests` int(4) NOT NULL DEFAULT '0';"); + Database::query("ALTER TABLE `" . TABLE_PANEL_PHPCONFIGS . "` ADD `idle_timeout` int(4) NOT NULL DEFAULT '30';"); + Database::query("ALTER TABLE `" . TABLE_PANEL_PHPCONFIGS . "` ADD `limit_extensions` varchar(255) NOT NULL default '.php';"); + lastStepStatus(0); + + showUpdateStep("Synchronize fpm-daemon process manager settings with php-configs"); + // get all fpm-daemons + $sel_stmt = Database::prepare("SELECT * FROM `panel_fpmdaemons`;"); + Database::pexecute($sel_stmt); + $fpm_daemons = $sel_stmt->fetchAll(PDO::FETCH_ASSOC); + $upd_stmt = Database::prepare("UPDATE `" . TABLE_PANEL_PHPCONFIGS . "` SET + `pm` = :pm, + `max_children` = :maxc, + `start_servers` = :starts, + `min_spare_servers` = :minss, + `max_spare_servers` = :maxss, + `max_requests` = :maxr, + `idle_timeout` = :it, + `limit_extensions` = :le + WHERE `fpmsettingid` = :fpmid + "); + // update all php-configs with the pm data from the fpm-daemon + foreach ($fpm_daemons as $fpm_daemon) { + Database::pexecute($upd_stmt, array( + 'pm' => $fpm_daemon['pm'], + 'maxc' => $fpm_daemon['max_children'], + 'starts' => $fpm_daemon['start_servers'], + 'minss' => $fpm_daemon['min_spare_servers'], + 'maxss' => $fpm_daemon['max_spare_servers'], + 'maxr' => $fpm_daemon['max_requests'], + 'it' => $fpm_daemon['idle_timeout'], + 'le' => $fpm_daemon['limit_extensions'], + 'fpmid' => $fpm_daemon['id'] + )); + } + lastStepStatus(0); + + updateToDbVersion('201809280'); +} diff --git a/lib/classes/phpinterface/class.phpinterface_fpm.php b/lib/classes/phpinterface/class.phpinterface_fpm.php index 8ec93b3e..6e9c67ce 100644 --- a/lib/classes/phpinterface/class.phpinterface_fpm.php +++ b/lib/classes/phpinterface/class.phpinterface_fpm.php @@ -91,6 +91,18 @@ class phpinterface_fpm $fh = @fopen($this->getConfigFile(), 'w'); if ($fh) { + + if ($phpconfig['override_fpmconfig'] == 1) { + $this->_fpm_cfg['pm'] = $phpconfig['pm']; + $this->_fpm_cfg['max_children'] = $phpconfig['max_children']; + $this->_fpm_cfg['start_servers'] = $phpconfig['start_servers']; + $this->_fpm_cfg['min_spare_servers'] = $phpconfig['min_spare_servers']; + $this->_fpm_cfg['max_spare_servers'] = $phpconfig['max_spare_servers']; + $this->_fpm_cfg['max_requests'] = $phpconfig['max_requests']; + $this->_fpm_cfg['idle_timeout'] = $phpconfig['idle_timeout']; + $this->_fpm_cfg['limit_extensions'] = $phpconfig['limit_extensions']; + } + $fpm_pm = $this->_fpm_cfg['pm']; $fpm_children = (int) $this->_fpm_cfg['max_children']; $fpm_start_servers = (int) $this->_fpm_cfg['start_servers']; diff --git a/lib/formfields/admin/phpconfig/formfield.phpconfig_add.php b/lib/formfields/admin/phpconfig/formfield.phpconfig_add.php index 6d30adfd..73ca458e 100644 --- a/lib/formfields/admin/phpconfig/formfield.phpconfig_add.php +++ b/lib/formfields/admin/phpconfig/formfield.phpconfig_add.php @@ -99,6 +99,70 @@ return array( ), 'value' => array() ), + 'override_fpmconfig' => array( + 'label' => $lng['serversettings']['phpfpm_settings']['override_fpmconfig'], + 'type' => 'checkbox', + 'values' => array( + array ('label' => $lng['panel']['yes'], 'value' => '1') + ), + 'value' => array() + ), + 'pm' => array( + 'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false), + 'label' => $lng['serversettings']['phpfpm_settings']['pm'], + 'desc' => $lng['serversettings']['phpfpm_settings']['override_fpmconfig_addinfo'], + 'type' => 'select', + 'select_var' => $pm_select + ), + 'max_children' => array( + 'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false), + 'label' => $lng['serversettings']['phpfpm_settings']['max_children']['title'], + 'desc' => $lng['serversettings']['phpfpm_settings']['max_children']['description'].$lng['serversettings']['phpfpm_settings']['override_fpmconfig_addinfo'], + 'type' => 'int', + 'value' => 1 + ), + 'start_servers' => array( + 'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false), + 'label' => $lng['serversettings']['phpfpm_settings']['start_servers']['title'], + 'desc' => $lng['serversettings']['phpfpm_settings']['start_servers']['description'].$lng['serversettings']['phpfpm_settings']['override_fpmconfig_addinfo'], + 'type' => 'int', + 'value' => 20 + ), + 'min_spare_servers' => array( + 'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false), + 'label' => $lng['serversettings']['phpfpm_settings']['min_spare_servers']['title'], + 'desc' => $lng['serversettings']['phpfpm_settings']['min_spare_servers']['description'].$lng['serversettings']['phpfpm_settings']['override_fpmconfig_addinfo'], + 'type' => 'int', + 'value' => 5 + ), + 'max_spare_servers' => array( + 'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false), + 'label' => $lng['serversettings']['phpfpm_settings']['max_spare_servers']['title'], + 'desc' => $lng['serversettings']['phpfpm_settings']['max_spare_servers']['description'].$lng['serversettings']['phpfpm_settings']['override_fpmconfig_addinfo'], + 'type' => 'int', + 'value' => 35 + ), + 'max_requests' => array( + 'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false), + 'label' => $lng['serversettings']['phpfpm_settings']['max_requests']['title'], + 'desc' => $lng['serversettings']['phpfpm_settings']['max_requests']['description'].$lng['serversettings']['phpfpm_settings']['override_fpmconfig_addinfo'], + 'type' => 'int', + 'value' => 0 + ), + 'idle_timeout' => array( + 'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false), + 'label' => $lng['serversettings']['phpfpm_settings']['idle_timeout']['title'], + 'desc' => $lng['serversettings']['phpfpm_settings']['idle_timeout']['description'].$lng['serversettings']['phpfpm_settings']['override_fpmconfig_addinfo'], + 'type' => 'int', + 'value' => 30 + ), + 'limit_extensions' => array( + 'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false), + 'label' => $lng['serversettings']['phpfpm_settings']['limit_extensions']['title'], + 'desc' => $lng['serversettings']['phpfpm_settings']['limit_extensions']['description'].$lng['serversettings']['phpfpm_settings']['override_fpmconfig_addinfo'], + 'type' => 'text', + 'value' => '.php' + ), 'phpsettings' => array( 'style' => 'align-top', 'label' => $lng['admin']['phpsettings']['phpinisettings'], diff --git a/lib/formfields/admin/phpconfig/formfield.phpconfig_edit.php b/lib/formfields/admin/phpconfig/formfield.phpconfig_edit.php index e2e8fd11..beb5b014 100644 --- a/lib/formfields/admin/phpconfig/formfield.phpconfig_edit.php +++ b/lib/formfields/admin/phpconfig/formfield.phpconfig_edit.php @@ -102,6 +102,69 @@ return array( ), 'value' => array($result['pass_authorizationheader']) ), + 'override_fpmconfig' => array( + 'label' => $lng['serversettings']['phpfpm_settings']['override_fpmconfig'], + 'type' => 'checkbox', + 'values' => array( + array ('label' => $lng['panel']['yes'], 'value' => '1') + ), + 'value' => array($result['override_fpmconfig']) + ), + 'pm' => array( + 'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false), + 'label' => $lng['serversettings']['phpfpm_settings']['pm'], + 'type' => 'select', + 'select_var' => $pm_select + ), + 'max_children' => array( + 'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false), + 'label' => $lng['serversettings']['phpfpm_settings']['max_children']['title'], + 'desc' => $lng['serversettings']['phpfpm_settings']['max_children']['description'], + 'type' => 'int', + 'value' => $result['max_children'] + ), + 'start_servers' => array( + 'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false), + 'label' => $lng['serversettings']['phpfpm_settings']['start_servers']['title'], + 'desc' => $lng['serversettings']['phpfpm_settings']['start_servers']['description'], + 'type' => 'int', + 'value' => $result['start_servers'] + ), + 'min_spare_servers' => array( + 'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false), + 'label' => $lng['serversettings']['phpfpm_settings']['min_spare_servers']['title'], + 'desc' => $lng['serversettings']['phpfpm_settings']['min_spare_servers']['description'], + 'type' => 'int', + 'value' => $result['min_spare_servers'] + ), + 'max_spare_servers' => array( + 'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false), + 'label' => $lng['serversettings']['phpfpm_settings']['max_spare_servers']['title'], + 'desc' => $lng['serversettings']['phpfpm_settings']['max_spare_servers']['description'], + 'type' => 'int', + 'value' => $result['max_spare_servers'] + ), + 'max_requests' => array( + 'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false), + 'label' => $lng['serversettings']['phpfpm_settings']['max_requests']['title'], + 'desc' => $lng['serversettings']['phpfpm_settings']['max_requests']['description'], + 'type' => 'int', + 'value' => $result['max_requests'] + ), + 'idle_timeout' => array( + 'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false), + 'label' => $lng['serversettings']['phpfpm_settings']['idle_timeout']['title'], + 'desc' => $lng['serversettings']['phpfpm_settings']['idle_timeout']['description'], + 'type' => 'int', + 'value' => $result['idle_timeout'] + ), + 'limit_extensions' => array( + 'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false), + 'label' => $lng['serversettings']['phpfpm_settings']['limit_extensions']['title'], + 'desc' => $lng['serversettings']['phpfpm_settings']['limit_extensions']['description'], + 'type' => 'text', + 'value' => $result['limit_extensions'] + ), 'phpsettings' => array( 'style' => 'align-top', 'label' => $lng['admin']['phpsettings']['phpinisettings'], diff --git a/lib/version.inc.php b/lib/version.inc.php index e2b46e06..f3233942 100644 --- a/lib/version.inc.php +++ b/lib/version.inc.php @@ -19,7 +19,7 @@ $version = '0.9.39.5'; // Database version (YYYYMMDDC where C is a daily counter) -$dbversion = '201809180'; +$dbversion = '201809280'; // Distribution branding-tag (used for Debian etc.) $branding = ''; diff --git a/lng/english.lng.php b/lng/english.lng.php index 5b226c45..9af2071e 100644 --- a/lng/english.lng.php +++ b/lng/english.lng.php @@ -2125,3 +2125,5 @@ $lng['admin']['plans']['use_plan'] = 'Apply plan'; $lng['question']['plan_reallydelete'] = 'Do you really want to delete the hosting plan %s?'; $lng['admin']['notryfiles']['title'] = 'No autogenerated try_files'; $lng['admin']['notryfiles']['description'] = 'Say yes here if you want to specify a custom try_files directive in specialsettings (needed for some wordpress plugins for example).'; +$lng['serversettings']['phpfpm_settings']['override_fpmconfig'] = 'Override FPM-daemon settings (pm, max_children, etc.)'; +$lng['serversettings']['phpfpm_settings']['override_fpmconfig_addinfo'] = '
Only used if "Override FPM-daemon settings" is set to "Yes"'; diff --git a/lng/german.lng.php b/lng/german.lng.php index 14c9f6b5..f5da555f 100644 --- a/lng/german.lng.php +++ b/lng/german.lng.php @@ -1775,3 +1775,5 @@ $lng['admin']['plans']['use_plan'] = 'Plan übernehmen'; $lng['question']['plan_reallydelete'] = 'Wollen Sie den Hosting-Plan "%s" wirklich löschen?'; $lng['admin']['notryfiles']['title'] = 'Keine generierte try_files Anweisung'; $lng['admin']['notryfiles']['description'] = 'Wähle "Ja", wenn eine eigene try_files Direktive in den "eigenen Vhost Einstellungen" angegeben werden soll (z.B. nötig für manche Wordpress Plugins).'; +$lng['serversettings']['phpfpm_settings']['override_fpmconfig'] = 'Überschreibe FPM-Daemon Einstellungen (pm, max_children, etc.)'; +$lng['serversettings']['phpfpm_settings']['override_fpmconfig_addinfo'] = '
Nur verwendet wenn "Überschreibe FPM-Daemon Einstellungen" auf "Ja" gestellt ist'; From 37988fa6457d5736f7a4f656ce061d5b640dccc4 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Fri, 28 Sep 2018 10:57:43 +0200 Subject: [PATCH 4/5] forgot to add override_fpmconfig flag to panel_phpconfigs, refs #573 Signed-off-by: Michael Kaufmann --- install/froxlor.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/install/froxlor.sql b/install/froxlor.sql index 82b0c6d3..9e2f4121 100644 --- a/install/froxlor.sql +++ b/install/froxlor.sql @@ -893,6 +893,7 @@ CREATE TABLE `panel_phpconfigs` ( `phpsettings` text NOT NULL, `fpmsettingid` int(11) NOT NULL DEFAULT '1', `pass_authorizationheader` tinyint(1) NOT NULL default '0', + `override_fpmconfig` tinyint(1) NOT NULL DEFAULT '0', `pm` varchar(15) NOT NULL DEFAULT 'static', `max_children` int(4) NOT NULL DEFAULT '1', `start_servers` int(4) NOT NULL DEFAULT '20', From 23d4bee1846c0cd24a023be06fc9c245923575cb Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Fri, 28 Sep 2018 11:00:56 +0200 Subject: [PATCH 5/5] add override-required info to php-config edit formfields like in add formfields, refs #573 Signed-off-by: Michael Kaufmann --- .../admin/phpconfig/formfield.phpconfig_edit.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/formfields/admin/phpconfig/formfield.phpconfig_edit.php b/lib/formfields/admin/phpconfig/formfield.phpconfig_edit.php index beb5b014..080a80d7 100644 --- a/lib/formfields/admin/phpconfig/formfield.phpconfig_edit.php +++ b/lib/formfields/admin/phpconfig/formfield.phpconfig_edit.php @@ -113,55 +113,56 @@ return array( 'pm' => array( 'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false), 'label' => $lng['serversettings']['phpfpm_settings']['pm'], + 'desc' => $lng['serversettings']['phpfpm_settings']['override_fpmconfig_addinfo'], 'type' => 'select', 'select_var' => $pm_select ), 'max_children' => array( 'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false), 'label' => $lng['serversettings']['phpfpm_settings']['max_children']['title'], - 'desc' => $lng['serversettings']['phpfpm_settings']['max_children']['description'], + 'desc' => $lng['serversettings']['phpfpm_settings']['max_children']['description'].$lng['serversettings']['phpfpm_settings']['override_fpmconfig_addinfo'], 'type' => 'int', 'value' => $result['max_children'] ), 'start_servers' => array( 'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false), 'label' => $lng['serversettings']['phpfpm_settings']['start_servers']['title'], - 'desc' => $lng['serversettings']['phpfpm_settings']['start_servers']['description'], + 'desc' => $lng['serversettings']['phpfpm_settings']['start_servers']['description'].$lng['serversettings']['phpfpm_settings']['override_fpmconfig_addinfo'], 'type' => 'int', 'value' => $result['start_servers'] ), 'min_spare_servers' => array( 'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false), 'label' => $lng['serversettings']['phpfpm_settings']['min_spare_servers']['title'], - 'desc' => $lng['serversettings']['phpfpm_settings']['min_spare_servers']['description'], + 'desc' => $lng['serversettings']['phpfpm_settings']['min_spare_servers']['description'].$lng['serversettings']['phpfpm_settings']['override_fpmconfig_addinfo'], 'type' => 'int', 'value' => $result['min_spare_servers'] ), 'max_spare_servers' => array( 'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false), 'label' => $lng['serversettings']['phpfpm_settings']['max_spare_servers']['title'], - 'desc' => $lng['serversettings']['phpfpm_settings']['max_spare_servers']['description'], + 'desc' => $lng['serversettings']['phpfpm_settings']['max_spare_servers']['description'].$lng['serversettings']['phpfpm_settings']['override_fpmconfig_addinfo'], 'type' => 'int', 'value' => $result['max_spare_servers'] ), 'max_requests' => array( 'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false), 'label' => $lng['serversettings']['phpfpm_settings']['max_requests']['title'], - 'desc' => $lng['serversettings']['phpfpm_settings']['max_requests']['description'], + 'desc' => $lng['serversettings']['phpfpm_settings']['max_requests']['description'].$lng['serversettings']['phpfpm_settings']['override_fpmconfig_addinfo'], 'type' => 'int', 'value' => $result['max_requests'] ), 'idle_timeout' => array( 'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false), 'label' => $lng['serversettings']['phpfpm_settings']['idle_timeout']['title'], - 'desc' => $lng['serversettings']['phpfpm_settings']['idle_timeout']['description'], + 'desc' => $lng['serversettings']['phpfpm_settings']['idle_timeout']['description'].$lng['serversettings']['phpfpm_settings']['override_fpmconfig_addinfo'], 'type' => 'int', 'value' => $result['idle_timeout'] ), 'limit_extensions' => array( 'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false), 'label' => $lng['serversettings']['phpfpm_settings']['limit_extensions']['title'], - 'desc' => $lng['serversettings']['phpfpm_settings']['limit_extensions']['description'], + 'desc' => $lng['serversettings']['phpfpm_settings']['limit_extensions']['description'].$lng['serversettings']['phpfpm_settings']['override_fpmconfig_addinfo'], 'type' => 'text', 'value' => $result['limit_extensions'] ),