From 29c754e700cfedd4e311579005d21e81e19814e0 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Thu, 29 Nov 2018 09:37:18 +0100 Subject: [PATCH] add new CUSTOMER_HOMEDIR replacer for php-configs, thx to rubberduck for the hint Signed-off-by: Michael Kaufmann --- lib/classes/phpinterface/class.phpinterface_fcgid.php | 3 ++- lib/classes/phpinterface/class.phpinterface_fpm.php | 3 ++- lng/english.lng.php | 3 ++- lng/german.lng.php | 3 ++- scripts/jobs/cron_tasks.inc.http.10.apache.php | 11 ++++++++--- scripts/jobs/cron_tasks.inc.http.15.apache_fcgid.php | 1 + scripts/jobs/cron_tasks.inc.http.20.lighttpd.php | 10 +++++++--- .../jobs/cron_tasks.inc.http.25.lighttpd_fcgid.php | 3 ++- scripts/jobs/cron_tasks.inc.http.30.nginx.php | 7 +++++-- scripts/jobs/cron_tasks.inc.http.35.nginx_phpfpm.php | 3 ++- templates/Sparkle/admin/phpconfig/overview_add.tpl | 4 ++++ templates/Sparkle/admin/phpconfig/overview_edit.tpl | 4 ++++ 12 files changed, 41 insertions(+), 14 deletions(-) diff --git a/lib/classes/phpinterface/class.phpinterface_fcgid.php b/lib/classes/phpinterface/class.phpinterface_fcgid.php index ca611661..fd69855c 100644 --- a/lib/classes/phpinterface/class.phpinterface_fcgid.php +++ b/lib/classes/phpinterface/class.phpinterface_fcgid.php @@ -153,7 +153,8 @@ class phpinterface_fcgid { 'OPEN_BASEDIR' => $openbasedir, 'OPEN_BASEDIR_C' => $openbasedirc, 'OPEN_BASEDIR_GLOBAL' => Settings::Get('system.phpappendopenbasedir'), - 'DOCUMENT_ROOT' => makeCorrectDir($this->_domain['documentroot']) + 'DOCUMENT_ROOT' => makeCorrectDir($this->_domain['documentroot']), + 'CUSTOMER_HOMEDIR' => makeCorrectDir($this->_domain['customerroot']) ); //insert a small header for the file diff --git a/lib/classes/phpinterface/class.phpinterface_fpm.php b/lib/classes/phpinterface/class.phpinterface_fpm.php index 6e9c67ce..a20a438d 100644 --- a/lib/classes/phpinterface/class.phpinterface_fpm.php +++ b/lib/classes/phpinterface/class.phpinterface_fpm.php @@ -229,7 +229,8 @@ class phpinterface_fpm 'OPEN_BASEDIR' => $openbasedir, 'OPEN_BASEDIR_C' => '', 'OPEN_BASEDIR_GLOBAL' => Settings::Get('system.phpappendopenbasedir'), - 'DOCUMENT_ROOT' => makeCorrectDir($this->_domain['documentroot']) + 'DOCUMENT_ROOT' => makeCorrectDir($this->_domain['documentroot']), + 'CUSTOMER_HOMEDIR' => makeCorrectDir($this->_domain['customerroot']) ); $phpini = replace_variables($phpconfig['phpsettings'], $php_ini_variables); diff --git a/lng/english.lng.php b/lng/english.lng.php index 6607c09c..94425822 100644 --- a/lng/english.lng.php +++ b/lng/english.lng.php @@ -967,7 +967,8 @@ $lng['admin']['phpconfig']['admin_email'] = 'Will be replaced with e-mail addres $lng['admin']['phpconfig']['domain'] = 'Will be replaced with the domain.'; $lng['admin']['phpconfig']['customer'] = 'Will be replaced with the loginname of the customer who owns this domain.'; $lng['admin']['phpconfig']['admin'] = 'Will be replaced with the loginname of the admin who owns this domain.'; -$lng['admin']['phpconfig']['docroot'] = 'Will be replaces with the customer\'s document-root.'; +$lng['admin']['phpconfig']['docroot'] = 'Will be replaced with the domain\'s document-root.'; +$lng['admin']['phpconfig']['homedir'] = 'Will be replaced with the customer\'s home-directory.'; $lng['login']['backtologin'] = 'Back to login'; $lng['serversettings']['mod_fcgid']['starter']['title'] = 'Processes per domain'; $lng['serversettings']['mod_fcgid']['starter']['description'] = 'How many processes should be started/allowed per domain? The value 0 is recommended cause PHP will then manage the amount of processes itself very efficiently.'; diff --git a/lng/german.lng.php b/lng/german.lng.php index c5ab80ac..455588fd 100644 --- a/lng/german.lng.php +++ b/lng/german.lng.php @@ -961,7 +961,8 @@ $lng['admin']['phpconfig']['admin_email'] = 'Wird mit der E-Mail-Adresse des Adm $lng['admin']['phpconfig']['domain'] = 'Wird mit der Domain ersetzt.'; $lng['admin']['phpconfig']['customer'] = 'Wird mit dem Loginnamen des Kunden ersetzt, dem die Domain gehört.'; $lng['admin']['phpconfig']['admin'] = 'Wird mit dem Loginnamen des Admins ersetzt, dem die Domain gehört.'; -$lng['admin']['phpconfig']['docroot'] = 'Wird mit dem Heimatverzeichnis des Kunden ersetzt.'; +$lng['admin']['phpconfig']['docroot'] = 'Wird mit dem Heimatverzeichnis der Domain ersetzt.'; +$lng['admin']['phpconfig']['homedir'] = 'Wird mit dem Heimatverzeichnis des Kunden ersetzt.'; $lng['login']['backtologin'] = 'Zurück zum Login'; $lng['serversettings']['mod_fcgid']['starter']['title'] = 'Prozesse je Domain'; $lng['serversettings']['mod_fcgid']['starter']['description'] = 'Wieviele PHP-Prozesse pro Domain sollen gestartet/erlaubt werden. Der Wert 0 wird empfohlen, da PHP die Anzahl dann selbst effizient verwaltet.'; diff --git a/scripts/jobs/cron_tasks.inc.http.10.apache.php b/scripts/jobs/cron_tasks.inc.http.10.apache.php index 566f34ae..c4408beb 100644 --- a/scripts/jobs/cron_tasks.inc.http.10.apache.php +++ b/scripts/jobs/cron_tasks.inc.http.10.apache.php @@ -262,7 +262,8 @@ class apache extends HttpConfigBase 'openbasedir' => 0, 'email' => Settings::Get('panel.adminmail'), 'loginname' => 'froxlor.panel', - 'documentroot' => $mypath + 'documentroot' => $mypath, + 'customerroot' => $mypath ); $php = new phpinterface($domain); $phpconfig = $php->getPhpConfig(Settings::Get('system.mod_fcgid_defaultini_ownvhost')); @@ -315,6 +316,7 @@ class apache extends HttpConfigBase 'email' => Settings::Get('panel.adminmail'), 'loginname' => 'froxlor.panel', 'documentroot' => $mypath, + 'customerroot' => $mypath, 'fpm_config_id' => isset($fpm_config['id']) ? $fpm_config['id'] : 1 ); @@ -389,7 +391,8 @@ class apache extends HttpConfigBase 'openbasedir' => 0, 'email' => Settings::Get('panel.adminmail'), 'loginname' => 'froxlor.panel', - 'documentroot' => $mypath + 'documentroot' => $mypath, + 'customerroot' => $mypath ); } } // end of ssl-redirect check @@ -398,7 +401,8 @@ class apache extends HttpConfigBase $domain = array( 'domain' => Settings::Get('system.hostname'), 'loginname' => 'froxlor.panel', - 'documentroot' => $mypath + 'documentroot' => $mypath, + 'customerroot' => $mypath ); } @@ -446,6 +450,7 @@ class apache extends HttpConfigBase 'adminid' => 1, /* first admin-user (superadmin) */ 'loginname' => 'froxlor.panel', 'documentroot' => $mypath, + 'customerroot' => $mypath, 'parentdomainid' => 0 ); diff --git a/scripts/jobs/cron_tasks.inc.http.15.apache_fcgid.php b/scripts/jobs/cron_tasks.inc.http.15.apache_fcgid.php index fb20d742..d03c9405 100644 --- a/scripts/jobs/cron_tasks.inc.http.15.apache_fcgid.php +++ b/scripts/jobs/cron_tasks.inc.http.15.apache_fcgid.php @@ -206,6 +206,7 @@ class apache_fcgid extends apache 'email' => Settings::Get('panel.adminmail'), 'loginname' => 'froxlor.panel', 'documentroot' => $mypath, + 'customerroot' => $mypath, 'fpm_config_id' => isset($fpm_config['id']) ? $fpm_config['id'] : 1 ); diff --git a/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php b/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php index 10fb96be..b5a38dd9 100644 --- a/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php +++ b/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php @@ -162,7 +162,8 @@ class lighttpd extends HttpConfigBase 'openbasedir' => 0, 'email' => Settings::Get('panel.adminmail'), 'loginname' => 'froxlor.panel', - 'documentroot' => $mypath + 'documentroot' => $mypath, + 'customerroot' => $mypath ); $php = new phpinterface($domain); @@ -185,7 +186,8 @@ class lighttpd extends HttpConfigBase 'openbasedir' => 0, 'email' => Settings::Get('panel.adminmail'), 'loginname' => 'froxlor.panel', - 'documentroot' => $mypath + 'documentroot' => $mypath, + 'customerroot' => $mypath ); } } else { @@ -193,7 +195,8 @@ class lighttpd extends HttpConfigBase $domain = array( 'domain' => Settings::Get('system.hostname'), 'loginname' => 'froxlor.panel', - 'documentroot' => $mypath + 'documentroot' => $mypath, + 'customerroot' => $mypath ); } @@ -219,6 +222,7 @@ class lighttpd extends HttpConfigBase 'adminid' => 1, /* first admin-user (superadmin) */ 'loginname' => 'froxlor.panel', 'documentroot' => $mypath, + 'customerroot' => $mypath, 'parentdomainid' => 0, ); diff --git a/scripts/jobs/cron_tasks.inc.http.25.lighttpd_fcgid.php b/scripts/jobs/cron_tasks.inc.http.25.lighttpd_fcgid.php index a53c4b24..5e7dd3bf 100644 --- a/scripts/jobs/cron_tasks.inc.http.25.lighttpd_fcgid.php +++ b/scripts/jobs/cron_tasks.inc.http.25.lighttpd_fcgid.php @@ -126,7 +126,8 @@ class lighttpd_fcgid extends lighttpd 'openbasedir' => 0, 'email' => Settings::Get('panel.adminmail'), 'loginname' => 'froxlor.panel', - 'documentroot' => $mypath + 'documentroot' => $mypath, + 'customerroot' => $mypath ); // all the files and folders have to belong to the local user diff --git a/scripts/jobs/cron_tasks.inc.http.30.nginx.php b/scripts/jobs/cron_tasks.inc.http.30.nginx.php index eeb8fbde..d43a4c46 100644 --- a/scripts/jobs/cron_tasks.inc.http.30.nginx.php +++ b/scripts/jobs/cron_tasks.inc.http.30.nginx.php @@ -185,6 +185,7 @@ class nginx extends HttpConfigBase 'adminid' => 1, /* first admin-user (superadmin) */ 'loginname' => 'froxlor.panel', 'documentroot' => $mypath, + 'customerroot' => $mypath, 'parentdomainid' => 0 ); @@ -255,7 +256,8 @@ class nginx extends HttpConfigBase $this->nginx_data[$vhost_filename] .= $this->processSpecialConfigTemplate($row_ipsandports['specialsettings'], array( 'domain' => Settings::Get('system.hostname'), 'loginname' => Settings::Get('phpfpm.vhost_httpuser'), - 'documentroot' => $mypath + 'documentroot' => $mypath, + 'customerroot' => $mypath ), $row_ipsandports['ip'], $row_ipsandports['port'], $row_ipsandports['ssl'] == '1') . "\n"; } @@ -290,7 +292,8 @@ class nginx extends HttpConfigBase 'openbasedir' => 0, 'email' => Settings::Get('panel.adminmail'), 'loginname' => 'froxlor.panel', - 'documentroot' => $mypath + 'documentroot' => $mypath, + 'customerroot' => $mypath ); $php = new phpinterface($domain); diff --git a/scripts/jobs/cron_tasks.inc.http.35.nginx_phpfpm.php b/scripts/jobs/cron_tasks.inc.http.35.nginx_phpfpm.php index 4a94c51d..b7cc0836 100644 --- a/scripts/jobs/cron_tasks.inc.http.35.nginx_phpfpm.php +++ b/scripts/jobs/cron_tasks.inc.http.35.nginx_phpfpm.php @@ -75,7 +75,8 @@ class nginx_phpfpm extends nginx 'openbasedir' => 0, 'email' => Settings::Get('panel.adminmail'), 'loginname' => 'froxlor.panel', - 'documentroot' => $mypath + 'documentroot' => $mypath, + 'customerroot' => $mypath ); // all the files and folders have to belong to the local user diff --git a/templates/Sparkle/admin/phpconfig/overview_add.tpl b/templates/Sparkle/admin/phpconfig/overview_add.tpl index f11be390..9a1fa9c8 100644 --- a/templates/Sparkle/admin/phpconfig/overview_add.tpl +++ b/templates/Sparkle/admin/phpconfig/overview_add.tpl @@ -88,6 +88,10 @@ $header {DOCUMENT_ROOT} {$lng['admin']['phpconfig']['docroot']} + + {CUSTOMER_HOMEDIR} + {$lng['admin']['phpconfig']['homedir']} + diff --git a/templates/Sparkle/admin/phpconfig/overview_edit.tpl b/templates/Sparkle/admin/phpconfig/overview_edit.tpl index b5d73071..6f712b68 100644 --- a/templates/Sparkle/admin/phpconfig/overview_edit.tpl +++ b/templates/Sparkle/admin/phpconfig/overview_edit.tpl @@ -84,6 +84,10 @@ $header {DOCUMENT_ROOT} {$lng['admin']['phpconfig']['docroot']} + + {CUSTOMER_HOMEDIR} + {$lng['admin']['phpconfig']['homedir']} +