From 3d647a2c2e2e15c9f6466bb5b92540f388b1d57f Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Sun, 9 Dec 2018 11:05:36 +0100 Subject: [PATCH] fix read in correct fpm-daemon config-id for nginx and lighttpd own-vhost, thx again to heavygale Signed-off-by: Michael Kaufmann --- scripts/jobs/cron_tasks.inc.http.10.apache.php | 2 +- scripts/jobs/cron_tasks.inc.http.20.lighttpd.php | 14 ++++++++++++-- scripts/jobs/cron_tasks.inc.http.30.nginx.php | 12 +++++++++++- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/scripts/jobs/cron_tasks.inc.http.10.apache.php b/scripts/jobs/cron_tasks.inc.http.10.apache.php index c4408beb..9dc817ed 100644 --- a/scripts/jobs/cron_tasks.inc.http.10.apache.php +++ b/scripts/jobs/cron_tasks.inc.http.10.apache.php @@ -294,7 +294,7 @@ class apache extends HttpConfigBase } $this->virtualhosts_data[$vhosts_filename] .= ' ' . "\n"; } - } elseif (Settings::Get('phpfpm.enabled') == '1') { + } elseif (Settings::Get('phpfpm.enabled') == '1' && (int) Settings::Get('phpfpm.enabled_ownvhost') == 1) { // get fpm config $fpm_sel_stmt = Database::prepare(" SELECT f.id FROM `" . TABLE_PANEL_FPMDAEMONS . "` f diff --git a/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php b/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php index b5a38dd9..cd182c49 100644 --- a/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php +++ b/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php @@ -151,7 +151,16 @@ class lighttpd extends HttpConfigBase /** * own php-fpm vhost */ - if ((int) Settings::Get('phpfpm.enabled') == 1) { + if ((int) Settings::Get('phpfpm.enabled') == 1 && (int) Settings::Get('phpfpm.enabled_ownvhost') == 1) { + // get fpm config + $fpm_sel_stmt = Database::prepare(" + SELECT f.id FROM `" . TABLE_PANEL_FPMDAEMONS . "` f + LEFT JOIN `" . TABLE_PANEL_PHPCONFIGS . "` p ON p.fpmsettingid = f.id + WHERE p.id = :phpconfigid + "); + $fpm_config = Database::pexecute_first($fpm_sel_stmt, array( + 'phpconfigid' => Settings::Get('phpfpm.vhost_defaultini') + )); $domain = array( 'id' => 'none', 'domain' => Settings::Get('system.hostname'), @@ -163,7 +172,8 @@ class lighttpd extends HttpConfigBase 'email' => Settings::Get('panel.adminmail'), 'loginname' => 'froxlor.panel', 'documentroot' => $mypath, - 'customerroot' => $mypath + 'customerroot' => $mypath, + 'fpm_config_id' => isset($fpm_config['id']) ? $fpm_config['id'] : 1 ); $php = new phpinterface($domain); diff --git a/scripts/jobs/cron_tasks.inc.http.30.nginx.php b/scripts/jobs/cron_tasks.inc.http.30.nginx.php index d43a4c46..c1e17d19 100644 --- a/scripts/jobs/cron_tasks.inc.http.30.nginx.php +++ b/scripts/jobs/cron_tasks.inc.http.30.nginx.php @@ -282,6 +282,15 @@ class nginx extends HttpConfigBase } if ((int) Settings::Get('phpfpm.enabled') == 1 && (int) Settings::Get('phpfpm.enabled_ownvhost') == 1) { + // get fpm config + $fpm_sel_stmt = Database::prepare(" + SELECT f.id FROM `" . TABLE_PANEL_FPMDAEMONS . "` f + LEFT JOIN `" . TABLE_PANEL_PHPCONFIGS . "` p ON p.fpmsettingid = f.id + WHERE p.id = :phpconfigid + "); + $fpm_config = Database::pexecute_first($fpm_sel_stmt, array( + 'phpconfigid' => Settings::Get('phpfpm.vhost_defaultini') + )); $domain = array( 'id' => 'none', 'domain' => Settings::Get('system.hostname'), @@ -293,7 +302,8 @@ class nginx extends HttpConfigBase 'email' => Settings::Get('panel.adminmail'), 'loginname' => 'froxlor.panel', 'documentroot' => $mypath, - 'customerroot' => $mypath + 'customerroot' => $mypath, + 'fpm_config_id' => isset($fpm_config['id']) ? $fpm_config['id'] : 1 ); $php = new phpinterface($domain);