Feature #1671 Checkbox to enable/disable PHP (vhost settings + fpm pool) for an entire vhost

This commit is contained in:
Dominic Schallert
2016-11-13 14:41:39 +01:00
parent 7e4164da26
commit b0326c640c
5 changed files with 50 additions and 1 deletions

View File

@@ -453,6 +453,7 @@ if ($page == 'domains' || $page == 'overview') {
if ($userinfo['caneditphpsettings'] == '1' || $userinfo['change_serversettings'] == '1') { if ($userinfo['caneditphpsettings'] == '1' || $userinfo['change_serversettings'] == '1') {
$phpenabled = isset($POST_['phpenabled']) ? intval($_POST['phpenabled']) : 0;
$openbasedir = isset($_POST['openbasedir']) ? intval($_POST['openbasedir']) : 0; $openbasedir = isset($_POST['openbasedir']) ? intval($_POST['openbasedir']) : 0;
if ((int) Settings::Get('system.mod_fcgid') == 1 || (int) Settings::Get('phpfpm.enabled') == 1) { if ((int) Settings::Get('system.mod_fcgid') == 1 || (int) Settings::Get('phpfpm.enabled') == 1) {
@@ -493,7 +494,9 @@ if ($page == 'domains' || $page == 'overview') {
} }
} else { } else {
$phpenabled = '1';
$openbasedir = '1'; $openbasedir = '1';
if ((int) Settings::Get('phpfpm.enabled') == 1) { if ((int) Settings::Get('phpfpm.enabled') == 1) {
$phpsettingid = Settings::Get('phpfpm.defaultini'); $phpsettingid = Settings::Get('phpfpm.defaultini');
} else { } else {
@@ -688,6 +691,10 @@ if ($page == 'domains' || $page == 'overview') {
if (count($ipandports) == 0) { if (count($ipandports) == 0) {
standard_error('noipportgiven'); standard_error('noipportgiven');
} }
if($phpenabled != '1') {
$phpenabled = '0';
}
if ($openbasedir != '1') { if ($openbasedir != '1') {
$openbasedir = '0'; $openbasedir = '0';
@@ -768,6 +775,7 @@ if ($page == 'domains' || $page == 'overview') {
'ipandport' => serialize($ipandports), 'ipandport' => serialize($ipandports),
'ssl_redirect' => $ssl_redirect, 'ssl_redirect' => $ssl_redirect,
'ssl_ipandport' => serialize($ssl_ipandports), 'ssl_ipandport' => serialize($ssl_ipandports),
'phpenabled' => $phpenabled,
'openbasedir' => $openbasedir, 'openbasedir' => $openbasedir,
'phpsettingid' => $phpsettingid, 'phpsettingid' => $phpsettingid,
'mod_fcgid_starter' => $mod_fcgid_starter, 'mod_fcgid_starter' => $mod_fcgid_starter,
@@ -816,6 +824,7 @@ if ($page == 'domains' || $page == 'overview') {
'email_only' => $email_only, 'email_only' => $email_only,
'subcanemaildomain' => $subcanemaildomain, 'subcanemaildomain' => $subcanemaildomain,
'caneditdomain' => $caneditdomain, 'caneditdomain' => $caneditdomain,
'phpenabled' => $phpenabled,
'openbasedir' => $openbasedir, 'openbasedir' => $openbasedir,
'speciallogfile' => $speciallogfile, 'speciallogfile' => $speciallogfile,
'specialsettings' => $specialsettings, 'specialsettings' => $specialsettings,
@@ -852,6 +861,7 @@ if ($page == 'domains' || $page == 'overview') {
`email_only` = :email_only, `email_only` = :email_only,
`subcanemaildomain` = :subcanemaildomain, `subcanemaildomain` = :subcanemaildomain,
`caneditdomain` = :caneditdomain, `caneditdomain` = :caneditdomain,
`phpenabled` = :phpenabled,
`openbasedir` = :openbasedir, `openbasedir` = :openbasedir,
`speciallogfile` = :speciallogfile, `speciallogfile` = :speciallogfile,
`specialsettings` = :specialsettings, `specialsettings` = :specialsettings,
@@ -1326,6 +1336,7 @@ if ($page == 'domains' || $page == 'overview') {
if ($userinfo['caneditphpsettings'] == '1' || $userinfo['change_serversettings'] == '1') { if ($userinfo['caneditphpsettings'] == '1' || $userinfo['change_serversettings'] == '1') {
$phpenabled = isset($_POST['phpenabled']) ? intval($_POST['phpenabled']) : 0;
$openbasedir = isset($_POST['openbasedir']) ? intval($_POST['openbasedir']) : 0; $openbasedir = isset($_POST['openbasedir']) ? intval($_POST['openbasedir']) : 0;
if ((int) Settings::Get('system.mod_fcgid') == 1 || (int) Settings::Get('phpfpm.enabled') == 1) { if ((int) Settings::Get('system.mod_fcgid') == 1 || (int) Settings::Get('phpfpm.enabled') == 1) {
@@ -1360,6 +1371,7 @@ if ($page == 'domains' || $page == 'overview') {
$mod_fcgid_maxrequests = $result['mod_fcgid_maxrequests']; $mod_fcgid_maxrequests = $result['mod_fcgid_maxrequests'];
} }
} else { } else {
$phpenabled = $result['phpenabled'];
$openbasedir = $result['openbasedir']; $openbasedir = $result['openbasedir'];
$phpsettingid = $result['phpsettingid']; $phpsettingid = $result['phpsettingid'];
$mod_fcgid_starter = $result['mod_fcgid_starter']; $mod_fcgid_starter = $result['mod_fcgid_starter'];
@@ -1471,6 +1483,10 @@ if ($page == 'domains' || $page == 'overview') {
if (! preg_match('/^https?\:\/\//', $documentroot)) { if (! preg_match('/^https?\:\/\//', $documentroot)) {
$documentroot = makeCorrectDir($documentroot); $documentroot = makeCorrectDir($documentroot);
} }
if ($phpenabled != '1') {
$phpenabled = '0';
}
if ($openbasedir != '1') { if ($openbasedir != '1') {
$openbasedir = '0'; $openbasedir = '0';
@@ -1580,6 +1596,7 @@ if ($page == 'domains' || $page == 'overview') {
'dkim' => $dkim, 'dkim' => $dkim,
'selectserveralias' => $serveraliasoption, 'selectserveralias' => $serveraliasoption,
'ssl_redirect' => $ssl_redirect, 'ssl_redirect' => $ssl_redirect,
'phpenabled' => $phpenabled,
'openbasedir' => $openbasedir, 'openbasedir' => $openbasedir,
'phpsettingid' => $phpsettingid, 'phpsettingid' => $phpsettingid,
'mod_fcgid_starter' => $mod_fcgid_starter, 'mod_fcgid_starter' => $mod_fcgid_starter,
@@ -1615,7 +1632,7 @@ if ($page == 'domains' || $page == 'overview') {
$wwwserveralias = ($serveraliasoption == '1') ? '1' : '0'; $wwwserveralias = ($serveraliasoption == '1') ? '1' : '0';
$iswildcarddomain = ($serveraliasoption == '0') ? '1' : '0'; $iswildcarddomain = ($serveraliasoption == '0') ? '1' : '0';
if ($documentroot != $result['documentroot'] || $ssl_redirect != $result['ssl_redirect'] || $wwwserveralias != $result['wwwserveralias'] || $iswildcarddomain != $result['iswildcarddomain'] || $openbasedir != $result['openbasedir'] || $phpsettingid != $result['phpsettingid'] || $mod_fcgid_starter != $result['mod_fcgid_starter'] || $mod_fcgid_maxrequests != $result['mod_fcgid_maxrequests'] || $specialsettings != $result['specialsettings'] || $aliasdomain != $result['aliasdomain'] || $issubof != $result['ismainbutsubto'] || $email_only != $result['email_only'] || ($speciallogfile != $result['speciallogfile'] && $speciallogverified == '1') || $letsencrypt != $result['letsencrypt'] || $hsts_maxage != $result['hsts'] || $hsts_sub != $result['hsts_sub'] || $hsts_preload != $result['hsts_preload']) { if ($documentroot != $result['documentroot'] || $ssl_redirect != $result['ssl_redirect'] || $wwwserveralias != $result['wwwserveralias'] || $iswildcarddomain != $result['iswildcarddomain'] || $phpenabled != $result['phpenabled'] || $openbasedir != $result['openbasedir'] || $phpsettingid != $result['phpsettingid'] || $mod_fcgid_starter != $result['mod_fcgid_starter'] || $mod_fcgid_maxrequests != $result['mod_fcgid_maxrequests'] || $specialsettings != $result['specialsettings'] || $aliasdomain != $result['aliasdomain'] || $issubof != $result['ismainbutsubto'] || $email_only != $result['email_only'] || ($speciallogfile != $result['speciallogfile'] && $speciallogverified == '1') || $letsencrypt != $result['letsencrypt'] || $hsts_maxage != $result['hsts'] || $hsts_sub != $result['hsts_sub'] || $hsts_preload != $result['hsts_preload']) {
inserttask('1'); inserttask('1');
} }
@@ -1756,6 +1773,7 @@ if ($page == 'domains' || $page == 'overview') {
$update_data['zonefile'] = $zonefile; $update_data['zonefile'] = $zonefile;
$update_data['wwwserveralias'] = $wwwserveralias; $update_data['wwwserveralias'] = $wwwserveralias;
$update_data['iswildcarddomain'] = $iswildcarddomain; $update_data['iswildcarddomain'] = $iswildcarddomain;
$update_data['phpenabled'] = $phpenabled;
$update_data['openbasedir'] = $openbasedir; $update_data['openbasedir'] = $openbasedir;
$update_data['speciallogfile'] = $speciallogfile; $update_data['speciallogfile'] = $speciallogfile;
$update_data['phpsettingid'] = $phpsettingid; $update_data['phpsettingid'] = $phpsettingid;
@@ -1787,6 +1805,7 @@ if ($page == 'domains' || $page == 'overview') {
`zonefile` = :zonefile, `zonefile` = :zonefile,
`wwwserveralias` = :wwwserveralias, `wwwserveralias` = :wwwserveralias,
`iswildcarddomain` = :iswildcarddomain, `iswildcarddomain` = :iswildcarddomain,
`phpenabled` = :phpenabled,
`openbasedir` = :openbasedir, `openbasedir` = :openbasedir,
`speciallogfile` = :speciallogfile, `speciallogfile` = :speciallogfile,
`phpsettingid` = :phpsettingid, `phpsettingid` = :phpsettingid,
@@ -1806,6 +1825,7 @@ if ($page == 'domains' || $page == 'overview') {
$_update_data['customerid'] = $customerid; $_update_data['customerid'] = $customerid;
$_update_data['adminid'] = $adminid; $_update_data['adminid'] = $adminid;
$_update_data['phpenabled'] = $phpenabled;
$_update_data['openbasedir'] = $openbasedir; $_update_data['openbasedir'] = $openbasedir;
$_update_data['phpsettingid'] = $phpsettingid; $_update_data['phpsettingid'] = $phpsettingid;
$_update_data['mod_fcgid_starter'] = $mod_fcgid_starter; $_update_data['mod_fcgid_starter'] = $mod_fcgid_starter;
@@ -1824,6 +1844,7 @@ if ($page == 'domains' || $page == 'overview') {
UPDATE `" . TABLE_PANEL_DOMAINS . "` SET UPDATE `" . TABLE_PANEL_DOMAINS . "` SET
`customerid` = :customerid, `customerid` = :customerid,
`adminid` = :adminid, `adminid` = :adminid,
`phpenabled` = :phpenabled,
`openbasedir` = :openbasedir, `openbasedir` = :openbasedir,
`phpsettingid` = :phpsettingid, `phpsettingid` = :phpsettingid,
`mod_fcgid_starter` = :mod_fcgid_starter, `mod_fcgid_starter` = :mod_fcgid_starter,

View File

@@ -237,6 +237,7 @@ CREATE TABLE `panel_domains` (
`dkim_pubkey` text, `dkim_pubkey` text,
`wwwserveralias` tinyint(1) NOT NULL default '1', `wwwserveralias` tinyint(1) NOT NULL default '1',
`parentdomainid` int(11) NOT NULL default '0', `parentdomainid` int(11) NOT NULL default '0',
`phpenabled` tinyint(1) NOT NULL default '0',
`openbasedir` tinyint(1) NOT NULL default '0', `openbasedir` tinyint(1) NOT NULL default '0',
`openbasedir_path` tinyint(1) NOT NULL default '0', `openbasedir_path` tinyint(1) NOT NULL default '0',
`speciallogfile` tinyint(1) NOT NULL default '0', `speciallogfile` tinyint(1) NOT NULL default '0',

View File

@@ -3513,3 +3513,14 @@ if (isFroxlorVersion('0.9.38-rc1')) {
showUpdateStep("Updating from 0.9.38-rc1 to 0.9.38-rc2", false); showUpdateStep("Updating from 0.9.38-rc1 to 0.9.38-rc2", false);
updateToVersion('0.9.38-rc2'); updateToVersion('0.9.38-rc2');
} }
if (isFroxlorVersion('0.9.38-rc2')) {
showUpdateStep("Updating from 0.9.38-rc2 to 0.9.38-rc3", false);
showUpdateStep("Updating database table definition for panel_domains");
Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` ADD `phpenabled` tinyint(1) NOT NULL default '1' AFTER `openbasedir`;");
lastStepStatus(0);
updateToVersion('0.9.38-rc3');
}

View File

@@ -202,6 +202,14 @@ return array(
'image' => 'icons/domain_add.png', 'image' => 'icons/domain_add.png',
'visible' => (($userinfo['change_serversettings'] == '1' || $userinfo['caneditphpsettings'] == '1') ? true : false), 'visible' => (($userinfo['change_serversettings'] == '1' || $userinfo['caneditphpsettings'] == '1') ? true : false),
'fields' => array( 'fields' => array(
'phpenabled' => array(
'label' => $lng['admin']['phpenabled'],
'type' => 'checkbox',
'values' => array(
array ('label' => $lng['panel']['yes'], 'value' => '1')
),
'value' => array('1')
),
'openbasedir' => array( 'openbasedir' => array(
'label' => 'OpenBasedir', 'label' => 'OpenBasedir',
'type' => 'checkbox', 'type' => 'checkbox',

View File

@@ -225,6 +225,14 @@ return array(
'image' => 'icons/domain_edit.png', 'image' => 'icons/domain_edit.png',
'visible' => (($userinfo['change_serversettings'] == '1' || $userinfo['caneditphpsettings'] == '1') ? true : false), 'visible' => (($userinfo['change_serversettings'] == '1' || $userinfo['caneditphpsettings'] == '1') ? true : false),
'fields' => array( 'fields' => array(
'phpenabled' => array(
'label' => $lng['admin']['phpenabled'],
'type' => 'checkbox',
'values' => array(
array ('label' => $lng['panel']['yes'], 'value' => '1')
),
'value' => array('1')
),
'openbasedir' => array( 'openbasedir' => array(
'label' => 'OpenBasedir', 'label' => 'OpenBasedir',
'type' => 'checkbox', 'type' => 'checkbox',