add possibility to add multiple php-fpm instances
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -40,15 +40,6 @@ return array(
|
||||
'option_options_method' => 'getPhpConfigs',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_phpfpm_configdir' => array(
|
||||
'label' => $lng['serversettings']['phpfpm_settings']['configdir'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
'varname' => 'configdir',
|
||||
'type' => 'string',
|
||||
'string_type' => 'confdir',
|
||||
'default' => '/etc/php-fpm.d/',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_phpfpm_aliasconfigdir' => array(
|
||||
'label' => $lng['serversettings']['phpfpm_settings']['aliasconfigdir'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
@@ -87,72 +78,6 @@ return array(
|
||||
'default' => '/var/lib/apache2/fastcgi/',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_phpfpm_reload' => array(
|
||||
'label' => $lng['serversettings']['phpfpm_settings']['reload'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
'varname' => 'reload',
|
||||
'type' => 'string',
|
||||
'default' => '/etc/init.d/php-fpm restart',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_phpfpm_pm' => array(
|
||||
'label' => $lng['serversettings']['phpfpm_settings']['pm'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
'varname' => 'pm',
|
||||
'type' => 'option',
|
||||
'default' => 'static',
|
||||
'option_mode' => 'one',
|
||||
'option_options' => array('static' => 'static', 'dynamic' => 'dynamic', 'ondemand' => 'ondemand'),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_phpfpm_max_children' => array(
|
||||
'label' => $lng['serversettings']['phpfpm_settings']['max_children'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
'varname' => 'max_children',
|
||||
'type' => 'int',
|
||||
'default' => 1,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_phpfpm_start_servers' => array(
|
||||
'label' => $lng['serversettings']['phpfpm_settings']['start_servers'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
'varname' => 'start_servers',
|
||||
'type' => 'int',
|
||||
'default' => 20,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_phpfpm_min_spare_servers' => array(
|
||||
'label' => $lng['serversettings']['phpfpm_settings']['min_spare_servers'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
'varname' => 'min_spare_servers',
|
||||
'type' => 'int',
|
||||
'default' => 5,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_phpfpm_max_spare_servers' => array(
|
||||
'label' => $lng['serversettings']['phpfpm_settings']['max_spare_servers'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
'varname' => 'max_spare_servers',
|
||||
'type' => 'int',
|
||||
'default' => 35,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_phpfpm_max_requests' => array(
|
||||
'label' => $lng['serversettings']['phpfpm_settings']['max_requests'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
'varname' => 'max_requests',
|
||||
'type' => 'int',
|
||||
'default' => 0,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_phpfpm_idle_timeout' => array(
|
||||
'label' => $lng['serversettings']['phpfpm_settings']['idle_timeout'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
'varname' => 'idle_timeout',
|
||||
'type' => 'int',
|
||||
'default' => 30,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_phpfpm_use_mod_proxy' => array(
|
||||
'label' => $lng['phpfpm']['use_mod_proxy'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
* @package Panel
|
||||
*
|
||||
*/
|
||||
|
||||
define('AREA', 'admin');
|
||||
require './lib/init.php';
|
||||
|
||||
@@ -32,33 +31,39 @@ if ($page == 'overview') {
|
||||
|
||||
$tablecontent = '';
|
||||
$count = 0;
|
||||
$result = Database::query("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "`");
|
||||
$result = Database::query("
|
||||
SELECT c.*, fd.description as fpmdesc
|
||||
FROM `" . TABLE_PANEL_PHPCONFIGS . "` c
|
||||
LEFT JOIN `" . TABLE_PANEL_FPMDAEMONS . "` fd ON fd.id = c.fpmsettingid
|
||||
ORDER BY c.description ASC
|
||||
");
|
||||
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
$domainresult = false;
|
||||
$query_params = array('id' => $row['id']);
|
||||
$query_params = array(
|
||||
'id' => $row['id']
|
||||
);
|
||||
|
||||
$query = "SELECT * FROM `".TABLE_PANEL_DOMAINS."`
|
||||
$query = "SELECT * FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||
WHERE `phpsettingid` = :id
|
||||
AND `parentdomainid` = '0'";
|
||||
|
||||
if ((int)$userinfo['domains_see_all'] == 0) {
|
||||
if ((int) $userinfo['domains_see_all'] == 0) {
|
||||
$query .= " AND `adminid` = :adminid";
|
||||
$query_params['adminid'] = $userinfo['adminid'];
|
||||
}
|
||||
|
||||
if ((int)Settings::Get('panel.phpconfigs_hidestdsubdomain') == 1) {
|
||||
if ((int) Settings::Get('panel.phpconfigs_hidestdsubdomain') == 1) {
|
||||
$ssdids_res = Database::query("
|
||||
SELECT DISTINCT `standardsubdomain` FROM `".TABLE_PANEL_CUSTOMERS."`
|
||||
WHERE `standardsubdomain` > 0 ORDER BY `standardsubdomain` ASC;"
|
||||
);
|
||||
SELECT DISTINCT `standardsubdomain` FROM `" . TABLE_PANEL_CUSTOMERS . "`
|
||||
WHERE `standardsubdomain` > 0 ORDER BY `standardsubdomain` ASC;");
|
||||
$ssdids = array();
|
||||
while ($ssd = $ssdids_res->fetch(PDO::FETCH_ASSOC)) {
|
||||
$ssdids[] = $ssd['standardsubdomain'];
|
||||
}
|
||||
if (count($ssdids) > 0) {
|
||||
$query .= " AND `id` NOT IN (".implode(', ', $ssdids).")";
|
||||
$query .= " AND `id` NOT IN (" . implode(', ', $ssdids) . ")";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,14 +73,12 @@ if ($page == 'overview') {
|
||||
$domains = '';
|
||||
if (Database::num_rows() > 0) {
|
||||
while ($row2 = $domainresult_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$domains.= $row2['domain'] . '<br/>';
|
||||
$domains .= $row2['domain'] . '<br/>';
|
||||
}
|
||||
}
|
||||
|
||||
// check whether we use that config as froxor-vhost config
|
||||
if (Settings::Get('system.mod_fcgid_defaultini_ownvhost') == $row['id']
|
||||
|| Settings::Get('phpfpm.vhost_defaultini') == $row['id']
|
||||
) {
|
||||
if (Settings::Get('system.mod_fcgid_defaultini_ownvhost') == $row['id'] || Settings::Get('phpfpm.vhost_defaultini') == $row['id']) {
|
||||
$domains .= Settings::Get('system.hostname');
|
||||
}
|
||||
|
||||
@@ -84,12 +87,8 @@ if ($page == 'overview') {
|
||||
}
|
||||
|
||||
// check whether this is our default config
|
||||
if ((Settings::Get('system.mod_fcgid') == '1'
|
||||
&& Settings::Get('system.mod_fcgid_defaultini') == $row['id'])
|
||||
|| (Settings::Get('phpfpm.enabled') == '1'
|
||||
&& Settings::Get('phpfpm.defaultini') == $row['id'])
|
||||
) {
|
||||
$row['description'] = '<b>'.$row['description'].'</b>';
|
||||
if ((Settings::Get('system.mod_fcgid') == '1' && Settings::Get('system.mod_fcgid_defaultini') == $row['id']) || (Settings::Get('phpfpm.enabled') == '1' && Settings::Get('phpfpm.defaultini') == $row['id'])) {
|
||||
$row['description'] = '<b>' . $row['description'] . '</b>';
|
||||
}
|
||||
|
||||
$count ++;
|
||||
@@ -102,27 +101,32 @@ if ($page == 'overview') {
|
||||
|
||||
if ($action == 'add') {
|
||||
|
||||
if ((int)$userinfo['change_serversettings'] == 1) {
|
||||
if ((int) $userinfo['change_serversettings'] == 1) {
|
||||
|
||||
if (isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send'
|
||||
) {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
$description = validate($_POST['description'], 'description');
|
||||
$phpsettings = validate(str_replace("\r\n", "\n", $_POST['phpsettings']), 'phpsettings', '/^[^\0]*$/');
|
||||
|
||||
if (Settings::Get('system.mod_fcgid') == 1) {
|
||||
$binary = makeCorrectFile(validate($_POST['binary'], 'binary'));
|
||||
$file_extensions = validate($_POST['file_extensions'], 'file_extensions', '/^[a-zA-Z0-9\s]*$/');
|
||||
$mod_fcgid_starter = validate($_POST['mod_fcgid_starter'], 'mod_fcgid_starter', '/^[0-9]*$/', '', array('-1', ''));
|
||||
$mod_fcgid_maxrequests = validate($_POST['mod_fcgid_maxrequests'], 'mod_fcgid_maxrequests', '/^[0-9]*$/', '', array('-1', ''));
|
||||
$mod_fcgid_starter = validate($_POST['mod_fcgid_starter'], 'mod_fcgid_starter', '/^[0-9]*$/', '', array(
|
||||
'-1',
|
||||
''
|
||||
));
|
||||
$mod_fcgid_maxrequests = validate($_POST['mod_fcgid_maxrequests'], 'mod_fcgid_maxrequests', '/^[0-9]*$/', '', array(
|
||||
'-1',
|
||||
''
|
||||
));
|
||||
$mod_fcgid_umask = validate($_POST['mod_fcgid_umask'], 'mod_fcgid_umask', '/^[0-9]*$/');
|
||||
// disable fpm stuff
|
||||
$fpm_config_id = 1;
|
||||
$fpm_enableslowlog = 0;
|
||||
$fpm_reqtermtimeout = 0;
|
||||
$fpm_reqslowtimeout = 0;
|
||||
}
|
||||
elseif (Settings::Get('phpfpm.enabled') == 1) {
|
||||
$fpm_enableslowlog = isset($_POST['phpfpm_enable_slowlog']) ? (int)$_POST['phpfpm_enable_slowlog'] : 0;
|
||||
} 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)$/');
|
||||
// disable fcgid stuff
|
||||
@@ -133,9 +137,7 @@ if ($page == 'overview') {
|
||||
$mod_fcgid_umask = "022";
|
||||
}
|
||||
|
||||
if (strlen($description) == 0
|
||||
|| strlen($description) > 50
|
||||
) {
|
||||
if (strlen($description) == 0 || strlen($description) > 50) {
|
||||
standard_error('descriptioninvalid');
|
||||
}
|
||||
|
||||
@@ -150,8 +152,8 @@ if ($page == 'overview') {
|
||||
`fpm_slowlog` = :fpmslow,
|
||||
`fpm_reqterm` = :fpmreqterm,
|
||||
`fpm_reqslow` = :fpmreqslow,
|
||||
`phpsettings` = :phpsettings"
|
||||
);
|
||||
`phpsettings` = :phpsettings,
|
||||
`fpmsettingid` = :fpmsettingid");
|
||||
$ins_data = array(
|
||||
'desc' => $description,
|
||||
'binary' => $binary,
|
||||
@@ -162,20 +164,29 @@ if ($page == 'overview') {
|
||||
'fpmslow' => $fpm_enableslowlog,
|
||||
'fpmreqterm' => $fpm_reqtermtimeout,
|
||||
'fpmreqslow' => $fpm_reqslowtimeout,
|
||||
'phpsettings' => $phpsettings
|
||||
'phpsettings' => $phpsettings,
|
||||
'fpmsettingid' => $fpm_config_id
|
||||
);
|
||||
Database::pexecute($ins_stmt, $ins_data);
|
||||
|
||||
inserttask('1');
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "php.ini setting with description '" . $description . "' has been created by '" . $userinfo['loginname'] . "'");
|
||||
redirectTo($filename, array('page' => $page, 's' => $s));
|
||||
|
||||
redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
|
||||
$result_stmt = Database::query("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = 1");
|
||||
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
$phpconfig_add_data = include_once dirname(__FILE__).'/lib/formfields/admin/phpconfig/formfield.phpconfig_add.php';
|
||||
$fpmconfigs = '';
|
||||
$configs = Database::query("SELECT * FROM `" . TABLE_PANEL_FPMDAEMONS . "` ORDER BY `description` ASC");
|
||||
while ($row = $configs->fetch(PDO::FETCH_ASSOC)) {
|
||||
$fpmconfigs .= makeoption($row['description'], $row['id'], 1, 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);
|
||||
|
||||
$title = $phpconfig_add_data['phpconfig_add']['title'];
|
||||
@@ -183,7 +194,6 @@ if ($page == 'overview') {
|
||||
|
||||
eval("echo \"" . getTemplate("phpconfig/overview_add") . "\";");
|
||||
}
|
||||
|
||||
} else {
|
||||
standard_error('nopermissionsorinvalidid');
|
||||
}
|
||||
@@ -192,54 +202,50 @@ if ($page == 'overview') {
|
||||
if ($action == 'delete') {
|
||||
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = :id"
|
||||
);
|
||||
$result = Database::pexecute_first($result_stmt, array('id' => $id));
|
||||
SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = :id");
|
||||
$result = Database::pexecute_first($result_stmt, array(
|
||||
'id' => $id
|
||||
));
|
||||
|
||||
if ((Settings::Get('system.mod_fcgid') == '1'
|
||||
&& Settings::Get('system.mod_fcgid_defaultini_ownvhost') == $id)
|
||||
|| (Settings::Get('phpfpm.enabled') == '1'
|
||||
&& Settings::Get('phpfpm.vhost_defaultini') == $id)
|
||||
) {
|
||||
if ((Settings::Get('system.mod_fcgid') == '1' && Settings::Get('system.mod_fcgid_defaultini_ownvhost') == $id) || (Settings::Get('phpfpm.enabled') == '1' && Settings::Get('phpfpm.vhost_defaultini') == $id)) {
|
||||
standard_error('cannotdeletehostnamephpconfig');
|
||||
}
|
||||
|
||||
if ((Settings::Get('system.mod_fcgid') == '1'
|
||||
&& Settings::Get('system.mod_fcgid_defaultini') == $id)
|
||||
|| (Settings::Get('phpfpm.enabled') == '1'
|
||||
&& Settings::Get('phpfpm.defaultini') == $id)
|
||||
) {
|
||||
if ((Settings::Get('system.mod_fcgid') == '1' && Settings::Get('system.mod_fcgid_defaultini') == $id) || (Settings::Get('phpfpm.enabled') == '1' && Settings::Get('phpfpm.defaultini') == $id)) {
|
||||
standard_error('cannotdeletedefaultphpconfig');
|
||||
}
|
||||
|
||||
if ($result['id'] != 0
|
||||
&& $result['id'] == $id
|
||||
&& (int)$userinfo['change_serversettings'] == 1
|
||||
&& $id != 1 // cannot delete the default php.config
|
||||
) {
|
||||
if ($result['id'] != 0 && $result['id'] == $id && (int) $userinfo['change_serversettings'] == 1 && $id != 1) // cannot delete the default php.config
|
||||
{
|
||||
|
||||
if (isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send'
|
||||
) {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
// set php-config to default for all domains using the
|
||||
// config that is to be deleted
|
||||
$upd_stmt = Database::prepare("
|
||||
UPDATE `" . TABLE_PANEL_DOMAINS . "` SET
|
||||
`phpsettingid` = '1' WHERE `phpsettingid` = :id"
|
||||
);
|
||||
Database::pexecute($upd_stmt, array('id' => $id));
|
||||
`phpsettingid` = '1' WHERE `phpsettingid` = :id");
|
||||
Database::pexecute($upd_stmt, array(
|
||||
'id' => $id
|
||||
));
|
||||
|
||||
$del_stmt = Database::prepare("
|
||||
DELETE FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = :id"
|
||||
);
|
||||
Database::pexecute($del_stmt, array('id' => $id));
|
||||
DELETE FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = :id");
|
||||
Database::pexecute($del_stmt, array(
|
||||
'id' => $id
|
||||
));
|
||||
|
||||
inserttask('1');
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "php.ini setting with id #" . (int)$id . " has been deleted by '" . $userinfo['loginname'] . "'");
|
||||
redirectTo($filename, array('page' => $page, 's' => $s));
|
||||
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "php.ini setting with id #" . (int) $id . " has been deleted by '" . $userinfo['loginname'] . "'");
|
||||
redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
ask_yesno('phpsetting_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['description']);
|
||||
ask_yesno('phpsetting_reallydelete', $filename, array(
|
||||
'id' => $id,
|
||||
'page' => $page,
|
||||
'action' => $action
|
||||
), $result['description']);
|
||||
}
|
||||
} else {
|
||||
standard_error('nopermissionsorinvalidid');
|
||||
@@ -249,34 +255,37 @@ if ($page == 'overview') {
|
||||
if ($action == 'edit') {
|
||||
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = :id"
|
||||
);
|
||||
$result = Database::pexecute_first($result_stmt, array('id' => $id));
|
||||
SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = :id");
|
||||
$result = Database::pexecute_first($result_stmt, array(
|
||||
'id' => $id
|
||||
));
|
||||
|
||||
if ($result['id'] != 0
|
||||
&& $result['id'] == $id
|
||||
&& (int)$userinfo['change_serversettings'] == 1
|
||||
) {
|
||||
if ($result['id'] != 0 && $result['id'] == $id && (int) $userinfo['change_serversettings'] == 1) {
|
||||
|
||||
if (isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send'
|
||||
) {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
$description = validate($_POST['description'], 'description');
|
||||
$phpsettings = validate(str_replace("\r\n", "\n", $_POST['phpsettings']), 'phpsettings', '/^[^\0]*$/');
|
||||
|
||||
if (Settings::Get('system.mod_fcgid') == 1) {
|
||||
$binary = makeCorrectFile(validate($_POST['binary'], 'binary'));
|
||||
$file_extensions = validate($_POST['file_extensions'], 'file_extensions', '/^[a-zA-Z0-9\s]*$/');
|
||||
$mod_fcgid_starter = validate($_POST['mod_fcgid_starter'], 'mod_fcgid_starter', '/^[0-9]*$/', '', array('-1', ''));
|
||||
$mod_fcgid_maxrequests = validate($_POST['mod_fcgid_maxrequests'], 'mod_fcgid_maxrequests', '/^[0-9]*$/', '', array('-1', ''));
|
||||
$mod_fcgid_starter = validate($_POST['mod_fcgid_starter'], 'mod_fcgid_starter', '/^[0-9]*$/', '', array(
|
||||
'-1',
|
||||
''
|
||||
));
|
||||
$mod_fcgid_maxrequests = validate($_POST['mod_fcgid_maxrequests'], 'mod_fcgid_maxrequests', '/^[0-9]*$/', '', array(
|
||||
'-1',
|
||||
''
|
||||
));
|
||||
$mod_fcgid_umask = validate($_POST['mod_fcgid_umask'], 'mod_fcgid_umask', '/^[0-9]*$/');
|
||||
// disable fpm stuff
|
||||
$fpm_config_id = 1;
|
||||
$fpm_enableslowlog = 0;
|
||||
$fpm_reqtermtimeout = 0;
|
||||
$fpm_reqslowtimeout = 0;
|
||||
}
|
||||
elseif (Settings::Get('phpfpm.enabled') == 1) {
|
||||
$fpm_enableslowlog = isset($_POST['phpfpm_enable_slowlog']) ? (int)$_POST['phpfpm_enable_slowlog'] : 0;
|
||||
} 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)$/');
|
||||
// disable fcgid stuff
|
||||
@@ -287,9 +296,7 @@ if ($page == 'overview') {
|
||||
$mod_fcgid_umask = "022";
|
||||
}
|
||||
|
||||
if (strlen($description) == 0
|
||||
|| strlen($description) > 50
|
||||
) {
|
||||
if (strlen($description) == 0 || strlen($description) > 50) {
|
||||
standard_error('descriptioninvalid');
|
||||
}
|
||||
|
||||
@@ -304,9 +311,9 @@ if ($page == 'overview') {
|
||||
`fpm_slowlog` = :fpmslow,
|
||||
`fpm_reqterm` = :fpmreqterm,
|
||||
`fpm_reqslow` = :fpmreqslow,
|
||||
`phpsettings` = :phpsettings
|
||||
WHERE `id` = :id"
|
||||
);
|
||||
`phpsettings` = :phpsettings,
|
||||
`fpmsettingid` = :fpmsettingid
|
||||
WHERE `id` = :id");
|
||||
$upd_data = array(
|
||||
'desc' => $description,
|
||||
'binary' => $binary,
|
||||
@@ -318,17 +325,26 @@ if ($page == 'overview') {
|
||||
'fpmreqterm' => $fpm_reqtermtimeout,
|
||||
'fpmreqslow' => $fpm_reqslowtimeout,
|
||||
'phpsettings' => $phpsettings,
|
||||
'fpmsettingid' => $fpm_config_id,
|
||||
'id' => $id
|
||||
);
|
||||
Database::pexecute($upd_stmt, $upd_data);
|
||||
|
||||
inserttask('1');
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "php.ini setting with description '" . $description . "' has been changed by '" . $userinfo['loginname'] . "'");
|
||||
redirectTo($filename, array('page' => $page, 's' => $s));
|
||||
|
||||
redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
|
||||
$phpconfig_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/phpconfig/formfield.phpconfig_edit.php';
|
||||
$fpmconfigs = '';
|
||||
$configs = Database::query("SELECT * FROM `" . TABLE_PANEL_FPMDAEMONS . "` ORDER BY `description` ASC");
|
||||
while ($row = $configs->fetch(PDO::FETCH_ASSOC)) {
|
||||
$fpmconfigs .= makeoption($row['description'], $row['id'], $id, 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);
|
||||
|
||||
$title = $phpconfig_edit_data['phpconfig_edit']['title'];
|
||||
@@ -336,7 +352,243 @@ if ($page == 'overview') {
|
||||
|
||||
eval("echo \"" . getTemplate("phpconfig/overview_edit") . "\";");
|
||||
}
|
||||
} else {
|
||||
standard_error('nopermissionsorinvalidid');
|
||||
}
|
||||
}
|
||||
} elseif ($page == 'fpmdaemons') {
|
||||
|
||||
if ($action == '') {
|
||||
|
||||
$tablecontent = '';
|
||||
$count = 0;
|
||||
$result = Database::query("SELECT * FROM `" . TABLE_PANEL_FPMDAEMONS . "` ORDER BY `description` ASC");
|
||||
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
$query_params = array(
|
||||
'id' => $row['id']
|
||||
);
|
||||
|
||||
$query = "SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `fpmsettingid` = :id";
|
||||
|
||||
$configresult_stmt = Database::prepare($query);
|
||||
Database::pexecute($configresult_stmt, $query_params);
|
||||
|
||||
$configs = '';
|
||||
if (Database::num_rows() > 0) {
|
||||
while ($row2 = $configresult_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$configs .= $row2['description'] . '<br/>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($configs == '') {
|
||||
$configs = $lng['admin']['phpsettings']['notused'];
|
||||
}
|
||||
|
||||
$count ++;
|
||||
eval("\$tablecontent.=\"" . getTemplate("phpconfig/fpmdaemons_overview") . "\";");
|
||||
}
|
||||
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "fpm daemons setting overview has been viewed by '" . $userinfo['loginname'] . "'");
|
||||
eval("echo \"" . getTemplate("phpconfig/fpmdaemons") . "\";");
|
||||
}
|
||||
|
||||
if ($action == 'add') {
|
||||
|
||||
if ((int) $userinfo['change_serversettings'] == 1) {
|
||||
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
$description = validate($_POST['description'], 'description');
|
||||
$reload_cmd = validate($_POST['reload_cmd'], 'reload_cmd');
|
||||
$config_dir = validate($_POST['config_dir'], 'config_dir');
|
||||
$pm = validate($_POST['pm'], '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;
|
||||
|
||||
if (strlen($description) == 0 || strlen($description) > 50) {
|
||||
standard_error('descriptioninvalid');
|
||||
}
|
||||
|
||||
$ins_stmt = Database::prepare("
|
||||
INSERT INTO `" . TABLE_PANEL_FPMDAEMONS . "` SET
|
||||
`description` = :desc,
|
||||
`reload_cmd` = :reload_cmd,
|
||||
`config_dir` = :config_dir,
|
||||
`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
|
||||
");
|
||||
$ins_data = array(
|
||||
'desc' => $description,
|
||||
'reload_cmd' => $reload_cmd,
|
||||
'config_dir' => makeCorrectDir($config_dir),
|
||||
'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
|
||||
);
|
||||
Database::pexecute($ins_stmt, $ins_data);
|
||||
|
||||
inserttask('1');
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "fpm-daemon setting with description '" . $description . "' has been created by '" . $userinfo['loginname'] . "'");
|
||||
redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
|
||||
$pm_select = makeoption('static', 'static', 'static', true, true);
|
||||
$pm_select.= makeoption('dynamic', 'dynamic', 'static', true, true);
|
||||
$pm_select.= makeoption('ondemand', 'ondemand', 'static', true, true);
|
||||
|
||||
$fpmconfig_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/phpconfig/formfield.fpmconfig_add.php';
|
||||
$fpmconfig_add_form = htmlform::genHTMLForm($fpmconfig_add_data);
|
||||
|
||||
$title = $fpmconfig_add_data['fpmconfig_add']['title'];
|
||||
$image = $fpmconfig_add_data['fpmconfig_add']['image'];
|
||||
|
||||
eval("echo \"" . getTemplate("phpconfig/fpmconfig_add") . "\";");
|
||||
}
|
||||
} else {
|
||||
standard_error('nopermissionsorinvalidid');
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'delete') {
|
||||
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT * FROM `" . TABLE_PANEL_FPMDAEMONS . "` WHERE `id` = :id");
|
||||
$result = Database::pexecute_first($result_stmt, array(
|
||||
'id' => $id
|
||||
));
|
||||
|
||||
if ($id == 1) {
|
||||
standard_error('cannotdeletedefaultphpconfig');
|
||||
}
|
||||
|
||||
if ($result['id'] != 0 && $result['id'] == $id && (int) $userinfo['change_serversettings'] == 1 && $id != 1) // cannot delete the default php.config
|
||||
{
|
||||
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
// set default fpm daemon config for all php-config that use this config that is to be deleted
|
||||
$upd_stmt = Database::prepare("
|
||||
UPDATE `" . TABLE_PANEL_PHPCONFIGS . "` SET
|
||||
`phpsettingid` = '1' WHERE `phpsettingid` = :id");
|
||||
Database::pexecute($upd_stmt, array(
|
||||
'id' => $id
|
||||
));
|
||||
|
||||
$del_stmt = Database::prepare("
|
||||
DELETE FROM `" . TABLE_PANEL_FPMDAEMONS . "` WHERE `id` = :id");
|
||||
Database::pexecute($del_stmt, array(
|
||||
'id' => $id
|
||||
));
|
||||
|
||||
inserttask('1');
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "fpm-daemon setting with id #" . (int) $id . " has been deleted by '" . $userinfo['loginname'] . "'");
|
||||
redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
ask_yesno('fpmsetting_reallydelete', $filename, array(
|
||||
'id' => $id,
|
||||
'page' => $page,
|
||||
'action' => $action
|
||||
), $result['description']);
|
||||
}
|
||||
} else {
|
||||
standard_error('nopermissionsorinvalidid');
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'edit') {
|
||||
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT * FROM `" . TABLE_PANEL_FPMDAEMONS . "` WHERE `id` = :id");
|
||||
$result = Database::pexecute_first($result_stmt, array(
|
||||
'id' => $id
|
||||
));
|
||||
|
||||
if ($result['id'] != 0 && $result['id'] == $id && (int) $userinfo['change_serversettings'] == 1) {
|
||||
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
$description = validate($_POST['description'], 'description');
|
||||
$reload_cmd = validate($_POST['reload_cmd'], 'reload_cmd');
|
||||
$config_dir = validate($_POST['config_dir'], 'config_dir');
|
||||
$pm = validate($_POST['pm'], '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'];
|
||||
|
||||
if (strlen($description) == 0 || strlen($description) > 50) {
|
||||
standard_error('descriptioninvalid');
|
||||
}
|
||||
|
||||
$upd_stmt = Database::prepare("
|
||||
UPDATE `" . TABLE_PANEL_PHPCONFIGS . "` SET
|
||||
`description` = :desc,
|
||||
`reload_cmd` = :reload_cmd,
|
||||
`config_dir` = :config_dir,
|
||||
`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
|
||||
WHERE `id` = :id
|
||||
");
|
||||
$upd_data = array(
|
||||
'desc' => $description,
|
||||
'reload_cmd' => $reload_cmd,
|
||||
'config_dir' => makeCorrectDir($config_dir),
|
||||
'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,
|
||||
'id' => $id
|
||||
);
|
||||
Database::pexecute($upd_stmt, $upd_data);
|
||||
|
||||
inserttask('1');
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "fpm-daemon setting with description '" . $description . "' has been changed by '" . $userinfo['loginname'] . "'");
|
||||
redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
|
||||
$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);
|
||||
|
||||
$fpmconfig_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/phpconfig/formfield.fpmconfig_edit.php';
|
||||
$fpmconfig_edit_form = htmlform::genHTMLForm($fpmconfig_edit_data);
|
||||
|
||||
$title = $fpmconfig_edit_data['fpmconfig_edit']['title'];
|
||||
$image = $fpmconfig_edit_data['fpmconfig_edit']['image'];
|
||||
|
||||
eval("echo \"" . getTemplate("phpconfig/fpmconfig_edit") . "\";");
|
||||
}
|
||||
} else {
|
||||
standard_error('nopermissionsorinvalidid');
|
||||
}
|
||||
|
||||
@@ -587,7 +587,7 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
|
||||
('panel', 'password_special_char', '!?<>§$%+#=@'),
|
||||
('panel', 'customer_hide_options', ''),
|
||||
('panel', 'version', '0.9.38.8'),
|
||||
('panel', 'db_version', '201712310');
|
||||
('panel', 'db_version', '201801070');
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `panel_tasks`;
|
||||
@@ -753,6 +753,32 @@ CREATE TABLE IF NOT EXISTS `panel_syslog` (
|
||||
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `panel_fpmdaemons`;
|
||||
CREATE TABLE `panel_fpmdaemons` (
|
||||
`id` int(11) unsigned NOT NULL auto_increment,
|
||||
`description` varchar(50) NOT NULL,
|
||||
`reload_cmd` varchar(255) NOT NULL,
|
||||
`config_dir` varchar(255) NOT NULL,
|
||||
`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',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `reload` (`reload_cmd`),
|
||||
UNIQUE KEY `config` (`config_dir`)
|
||||
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
|
||||
|
||||
|
||||
INSERT INTO `panel_fpmdaemons` (`id`, `description`, `reload_cmd`, `config_dir`) VALUES
|
||||
(1, 'System default', 'service php7.0-fpm restart', '/etc/php/7.0/fpm/pool.d/');
|
||||
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `panel_phpconfigs`;
|
||||
CREATE TABLE `panel_phpconfigs` (
|
||||
`id` int(11) unsigned NOT NULL auto_increment,
|
||||
@@ -766,7 +792,9 @@ CREATE TABLE `panel_phpconfigs` (
|
||||
`fpm_reqterm` varchar(15) NOT NULL default '60s',
|
||||
`fpm_reqslow` varchar(15) NOT NULL default '5s',
|
||||
`phpsettings` text NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
`fpmsettingid` int(11) NOT NULL DEFAULT '1',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `fpmsettingid` (`fpmsettingid`)
|
||||
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
|
||||
|
||||
|
||||
@@ -3646,3 +3646,73 @@ if (isDatabaseVersion('201708240')) {
|
||||
showUpdateStep("Updating from 0.9.38.7 to 0.9.38.8", false);
|
||||
updateToVersion('0.9.38.8');
|
||||
}
|
||||
|
||||
if (isDatabaseVersion('201712310')) {
|
||||
|
||||
showUpdateStep("Adding field for fpm-daemon configs");
|
||||
Database::query("ALTER TABLE `" . TABLE_PANEL_PHPCONFIGS . "` ADD `fpmsettingid` int(11) NOT NULL DEFAULT '1';");
|
||||
lastStepStatus(0);
|
||||
|
||||
showUpdateStep("Adding new fpm-daemons table");
|
||||
Database::query("DROP TABLE IF EXISTS `panel_fpmdaemons`;");
|
||||
$sql = "CREATE TABLE `panel_fpmdaemons` (
|
||||
`id` int(11) unsigned NOT NULL auto_increment,
|
||||
`description` varchar(50) NOT NULL,
|
||||
`reload_cmd` varchar(255) NOT NULL,
|
||||
`config_dir` varchar(255) NOT NULL,
|
||||
`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',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `reload` (`reload_cmd`),
|
||||
UNIQUE KEY `config` (`config_dir`)
|
||||
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;";
|
||||
Database::query($sql);
|
||||
lastStepStatus(0);
|
||||
|
||||
showUpdateStep("Converting php-fpm settings to new layout");
|
||||
$ins_stmt = Database::prepare("
|
||||
INSERT INTO `panel_fpmdaemons` SET
|
||||
`id` = 1,
|
||||
`description` = 'System default',
|
||||
`reload_cmd` = :reloadcmd,
|
||||
`config_dir` = :confdir,
|
||||
`pm` = :pm,
|
||||
`max_children` = :maxc,
|
||||
`start_servers` = :starts,
|
||||
`min_spare_servers` = :minss,
|
||||
`max_spare_servers` = :maxss,
|
||||
`max_requests` = :maxr,
|
||||
`idle_timeout` = :it
|
||||
");
|
||||
Database::pexecute($ins_stmt, array(
|
||||
'reloadcmd' => Settings::Get('phpfpm.reload'),
|
||||
'confdir' => Settings::Get('phpfpm.configdir'),
|
||||
'pm' => Settings::Get('phpfpm.pm'),
|
||||
'maxc' => Settings::Get('phpfpm.max_children'),
|
||||
'starts' => Settings::Get('phpfpm.start_servers'),
|
||||
'minss' => Settings::Get('phpfpm.min_spare_servers'),
|
||||
'maxss' => Settings::Get('phpfpm.max_spare_servers'),
|
||||
'maxr' => Settings::Get('phpfpm.max_requests'),
|
||||
'it' => Settings::Get('phpfpm.idle_timeout')
|
||||
));
|
||||
lastStepStatus(0);
|
||||
|
||||
showUpdateStep("Deleting unneeded settings");
|
||||
Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `settinggroup` = 'phpfpm' AND `varname` = 'reload'");
|
||||
Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `settinggroup` = 'phpfpm' AND `varname` = 'configdir'");
|
||||
Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `settinggroup` = 'phpfpm' AND `varname` = 'pm'");
|
||||
Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `settinggroup` = 'phpfpm' AND `varname` = 'max_children'");
|
||||
Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `settinggroup` = 'phpfpm' AND `varname` = 'start_servers'");
|
||||
Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `settinggroup` = 'phpfpm' AND `varname` = 'min_spare_servers'");
|
||||
Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `settinggroup` = 'phpfpm' AND `varname` = 'max_spare_servers'");
|
||||
Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `settinggroup` = 'phpfpm' AND `varname` = 'max_requests'");
|
||||
Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `settinggroup` = 'phpfpm' AND `varname` = 'idle_timeout'");
|
||||
lastStepStatus(0);
|
||||
|
||||
updateToDbVersion('201801070');
|
||||
}
|
||||
|
||||
@@ -18,17 +18,26 @@
|
||||
* @since 0.9.16
|
||||
*
|
||||
*/
|
||||
|
||||
class phpinterface_fpm {
|
||||
class phpinterface_fpm
|
||||
{
|
||||
|
||||
/**
|
||||
* Domain-Data array
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_domain = array();
|
||||
|
||||
/**
|
||||
* fpm config
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_fpm_cfg = array();
|
||||
|
||||
/**
|
||||
* Admin-Date cache array
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_admin_cache = array();
|
||||
@@ -149,8 +158,18 @@ class phpinterface_fpm {
|
||||
/**
|
||||
* main constructor
|
||||
*/
|
||||
public function __construct($domain) {
|
||||
public function __construct($domain)
|
||||
{
|
||||
$this->_domain = $domain;
|
||||
$this->_readFpmConfig($domain['fpm_config_id']);
|
||||
}
|
||||
|
||||
private function _readFpmConfig($fpm_config_id)
|
||||
{
|
||||
$stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_FPMDAEMONS . "` WHERE `id` = :id");
|
||||
$this->_fpm_cfg = Database::pexecute_first($stmt, array(
|
||||
'id' => $fpm_config_id
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -158,46 +177,46 @@ class phpinterface_fpm {
|
||||
*
|
||||
* @param array $phpconfig
|
||||
*/
|
||||
public function createConfig($phpconfig) {
|
||||
|
||||
public function createConfig($phpconfig)
|
||||
{
|
||||
$fh = @fopen($this->getConfigFile(), 'w');
|
||||
|
||||
if ($fh) {
|
||||
$fpm_pm = Settings::Get('phpfpm.pm');
|
||||
$fpm_children = (int)Settings::Get('phpfpm.max_children');
|
||||
$fpm_start_servers = (int)Settings::Get('phpfpm.start_servers');
|
||||
$fpm_min_spare_servers = (int)Settings::Get('phpfpm.min_spare_servers');
|
||||
$fpm_max_spare_servers = (int)Settings::Get('phpfpm.max_spare_servers');
|
||||
$fpm_requests = (int)Settings::Get('phpfpm.max_requests');
|
||||
$fpm_process_idle_timeout = (int)Settings::Get('phpfpm.idle_timeout');
|
||||
$fpm_pm = $this->_fpm_cfg['pm'];
|
||||
$fpm_children = (int) $this->_fpm_cfg['max_children'];
|
||||
$fpm_start_servers = (int) $this->_fpm_cfg['start_servers'];
|
||||
$fpm_min_spare_servers = (int) $this->_fpm_cfg['min_spare_servers'];
|
||||
$fpm_max_spare_servers = (int) $this->_fpm_cfg['max_spare_servers'];
|
||||
$fpm_requests = (int) $this->_fpm_cfg['max_requests'];
|
||||
$fpm_process_idle_timeout = (int) $this->_fpm_cfg['idle_timeout'];
|
||||
|
||||
if ($fpm_children == 0) {
|
||||
$fpm_children = 1;
|
||||
}
|
||||
|
||||
$fpm_config = ';PHP-FPM configuration for "'.$this->_domain['domain'].'" created on ' . date("Y.m.d H:i:s") . "\n";
|
||||
$fpm_config.= '['.$this->_domain['domain'].']'."\n";
|
||||
$fpm_config.= 'listen = '.$this->getSocketFile()."\n";
|
||||
$fpm_config = ';PHP-FPM configuration for "' . $this->_domain['domain'] . '" created on ' . date("Y.m.d H:i:s") . "\n";
|
||||
$fpm_config .= '[' . $this->_domain['domain'] . ']' . "\n";
|
||||
$fpm_config .= 'listen = ' . $this->getSocketFile() . "\n";
|
||||
if ($this->_domain['loginname'] == 'froxlor.panel') {
|
||||
$fpm_config.= 'listen.owner = '.$this->_domain['guid']."\n";
|
||||
$fpm_config.= 'listen.group = '.$this->_domain['guid']."\n";
|
||||
$fpm_config .= 'listen.owner = ' . $this->_domain['guid'] . "\n";
|
||||
$fpm_config .= 'listen.group = ' . $this->_domain['guid'] . "\n";
|
||||
} else {
|
||||
$fpm_config.= 'listen.owner = '.$this->_domain['loginname']."\n";
|
||||
$fpm_config.= 'listen.group = '.$this->_domain['loginname']."\n";
|
||||
$fpm_config .= 'listen.owner = ' . $this->_domain['loginname'] . "\n";
|
||||
$fpm_config .= 'listen.group = ' . $this->_domain['loginname'] . "\n";
|
||||
}
|
||||
// see #1418 why this is 0660
|
||||
$fpm_config.= 'listen.mode = 0660'."\n";
|
||||
$fpm_config .= 'listen.mode = 0660' . "\n";
|
||||
|
||||
if ($this->_domain['loginname'] == 'froxlor.panel') {
|
||||
$fpm_config.= 'user = '.$this->_domain['guid']."\n";
|
||||
$fpm_config.= 'group = '.$this->_domain['guid']."\n";
|
||||
$fpm_config .= 'user = ' . $this->_domain['guid'] . "\n";
|
||||
$fpm_config .= 'group = ' . $this->_domain['guid'] . "\n";
|
||||
} else {
|
||||
$fpm_config.= 'user = '.$this->_domain['loginname']."\n";
|
||||
$fpm_config.= 'group = '.$this->_domain['loginname']."\n";
|
||||
$fpm_config .= 'user = ' . $this->_domain['loginname'] . "\n";
|
||||
$fpm_config .= 'group = ' . $this->_domain['loginname'] . "\n";
|
||||
}
|
||||
|
||||
$fpm_config.= 'pm = '.$fpm_pm."\n";
|
||||
$fpm_config.= 'pm.max_children = '.$fpm_children."\n";
|
||||
$fpm_config .= 'pm = ' . $fpm_pm . "\n";
|
||||
$fpm_config .= 'pm.max_children = ' . $fpm_children . "\n";
|
||||
|
||||
if ($fpm_pm == 'dynamic') {
|
||||
// honor max_children
|
||||
@@ -214,34 +233,34 @@ class phpinterface_fpm {
|
||||
if ($fpm_start_servers > $fpm_max_spare_servers) {
|
||||
$fpm_start_servers = $fpm_max_spare_servers;
|
||||
}
|
||||
$fpm_config.= 'pm.start_servers = '.$fpm_start_servers."\n";
|
||||
$fpm_config.= 'pm.min_spare_servers = '.$fpm_min_spare_servers."\n";
|
||||
$fpm_config.= 'pm.max_spare_servers = '.$fpm_max_spare_servers."\n";
|
||||
$fpm_config .= 'pm.start_servers = ' . $fpm_start_servers . "\n";
|
||||
$fpm_config .= 'pm.min_spare_servers = ' . $fpm_min_spare_servers . "\n";
|
||||
$fpm_config .= 'pm.max_spare_servers = ' . $fpm_max_spare_servers . "\n";
|
||||
} elseif ($fpm_pm == 'ondemand') {
|
||||
$fpm_config.= 'pm.process_idle_timeout = '.$fpm_process_idle_timeout."\n";
|
||||
$fpm_config .= 'pm.process_idle_timeout = ' . $fpm_process_idle_timeout . "\n";
|
||||
}
|
||||
|
||||
$fpm_config.= 'pm.max_requests = '.$fpm_requests."\n";
|
||||
$fpm_config .= 'pm.max_requests = ' . $fpm_requests . "\n";
|
||||
|
||||
// possible slowlog configs
|
||||
if ($phpconfig['fpm_slowlog'] == '1') {
|
||||
$fpm_config.= 'request_terminate_timeout = ' . $phpconfig['fpm_reqterm'] . "\n";
|
||||
$fpm_config.= 'request_slowlog_timeout = ' . $phpconfig['fpm_reqslow'] . "\n";
|
||||
$fpm_config .= 'request_terminate_timeout = ' . $phpconfig['fpm_reqterm'] . "\n";
|
||||
$fpm_config .= 'request_slowlog_timeout = ' . $phpconfig['fpm_reqslow'] . "\n";
|
||||
$slowlog = makeCorrectFile(Settings::Get('system.logfiles_directory') . '/' . $this->_domain['loginname'] . '-php-slow.log');
|
||||
$fpm_config.= 'slowlog = ' . $slowlog . "\n";
|
||||
$fpm_config.= 'catch_workers_output = yes' . "\n";
|
||||
$fpm_config .= 'slowlog = ' . $slowlog . "\n";
|
||||
$fpm_config .= 'catch_workers_output = yes' . "\n";
|
||||
}
|
||||
|
||||
$fpm_config.= ';chroot = '.makeCorrectDir($this->_domain['documentroot'])."\n";
|
||||
$fpm_config .= ';chroot = ' . makeCorrectDir($this->_domain['documentroot']) . "\n";
|
||||
|
||||
$tmpdir = makeCorrectDir(Settings::Get('phpfpm.tmpdir') . '/' . $this->_domain['loginname'] . '/');
|
||||
if (!is_dir($tmpdir)) {
|
||||
if (! is_dir($tmpdir)) {
|
||||
$this->getTempDir();
|
||||
}
|
||||
|
||||
$fpm_config.= 'env[TMP] = '.$tmpdir."\n";
|
||||
$fpm_config.= 'env[TMPDIR] = '.$tmpdir."\n";
|
||||
$fpm_config.= 'env[TEMP] = '.$tmpdir."\n";
|
||||
$fpm_config .= 'env[TMP] = ' . $tmpdir . "\n";
|
||||
$fpm_config .= 'env[TMPDIR] = ' . $tmpdir . "\n";
|
||||
$fpm_config .= 'env[TEMP] = ' . $tmpdir . "\n";
|
||||
|
||||
$openbasedir = '';
|
||||
if ($this->_domain['loginname'] != 'froxlor.panel') {
|
||||
@@ -257,9 +276,7 @@ class phpinterface_fpm {
|
||||
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
|
||||
}
|
||||
|
||||
if ($this->_domain['openbasedir_path'] == '0'
|
||||
&& strstr($this->_domain['documentroot'], ":") === false
|
||||
) {
|
||||
if ($this->_domain['openbasedir_path'] == '0' && strstr($this->_domain['documentroot'], ":") === false) {
|
||||
$openbasedir = appendOpenBasedirPath($this->_domain['documentroot'], true);
|
||||
} else {
|
||||
$openbasedir = appendOpenBasedirPath($this->_domain['customerroot'], true);
|
||||
@@ -269,8 +286,8 @@ class phpinterface_fpm {
|
||||
$openbasedir .= $_phpappendopenbasedir;
|
||||
}
|
||||
}
|
||||
$fpm_config.= 'php_admin_value[session.save_path] = ' . makeCorrectDir(Settings::Get('phpfpm.tmpdir') . '/' . $this->_domain['loginname'] . '/') . "\n";
|
||||
$fpm_config.= 'php_admin_value[upload_tmp_dir] = ' . makeCorrectDir(Settings::Get('phpfpm.tmpdir') . '/' . $this->_domain['loginname'] . '/') . "\n";
|
||||
$fpm_config .= 'php_admin_value[session.save_path] = ' . makeCorrectDir(Settings::Get('phpfpm.tmpdir') . '/' . $this->_domain['loginname'] . '/') . "\n";
|
||||
$fpm_config .= 'php_admin_value[upload_tmp_dir] = ' . makeCorrectDir(Settings::Get('phpfpm.tmpdir') . '/' . $this->_domain['loginname'] . '/') . "\n";
|
||||
|
||||
$admin = $this->_getAdminData($this->_domain['adminid']);
|
||||
$php_ini_variables = array(
|
||||
@@ -291,7 +308,7 @@ class phpinterface_fpm {
|
||||
$phpini = replace_variables($phpconfig['phpsettings'], $php_ini_variables);
|
||||
$phpini_array = explode("\n", $phpini);
|
||||
|
||||
$fpm_config.= "\n\n";
|
||||
$fpm_config .= "\n\n";
|
||||
foreach ($phpini_array as $inisection) {
|
||||
$is = explode("=", $inisection);
|
||||
foreach ($this->_ini as $sec => $possibles) {
|
||||
@@ -300,7 +317,7 @@ class phpinterface_fpm {
|
||||
if (trim($is[0]) == 'open_basedir' && $openbasedir == '') {
|
||||
continue;
|
||||
}
|
||||
$fpm_config.= $sec.'['.trim($is[0]).'] = ' . trim($is[1]) . "\n";
|
||||
$fpm_config .= $sec . '[' . trim($is[0]) . '] = ' . trim($is[1]) . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -308,7 +325,7 @@ class phpinterface_fpm {
|
||||
// now check if 'sendmail_path' has not beed set in the custom-php.ini
|
||||
// if not we use our fallback-default as usual
|
||||
if (strpos($fpm_config, 'php_admin_value[sendmail_path]') === false) {
|
||||
$fpm_config.= 'php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f '.$this->_domain['email']."\n";
|
||||
$fpm_config .= 'php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f ' . $this->_domain['email'] . "\n";
|
||||
}
|
||||
|
||||
fwrite($fh, $fpm_config, strlen($fpm_config));
|
||||
@@ -322,23 +339,25 @@ class phpinterface_fpm {
|
||||
*
|
||||
* @param string $phpconfig
|
||||
*/
|
||||
public function createIniFile($phpconfig) {
|
||||
public function createIniFile($phpconfig)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* fpm-config file
|
||||
*
|
||||
* @param boolean $createifnotexists create the directory if it does not exist
|
||||
* @param boolean $createifnotexists
|
||||
* create the directory if it does not exist
|
||||
*
|
||||
* @return string the full path to the file
|
||||
*/
|
||||
public function getConfigFile($createifnotexists = true) {
|
||||
public function getConfigFile($createifnotexists = true)
|
||||
{
|
||||
$configdir = $this->_fpm_cfg['config_path'];
|
||||
$config = makeCorrectFile($configdir . '/' . $this->_domain['domain'] . '.conf');
|
||||
|
||||
$configdir = makeCorrectDir(Settings::Get('phpfpm.configdir'));
|
||||
$config = makeCorrectFile($configdir.'/'.$this->_domain['domain'].'.conf');
|
||||
|
||||
if (!is_dir($configdir) && $createifnotexists) {
|
||||
if (! is_dir($configdir) && $createifnotexists) {
|
||||
safe_exec('mkdir -p ' . escapeshellarg($configdir));
|
||||
}
|
||||
|
||||
@@ -348,18 +367,20 @@ class phpinterface_fpm {
|
||||
/**
|
||||
* return path of fpm-socket file
|
||||
*
|
||||
* @param boolean $createifnotexists create the directory if it does not exist
|
||||
* @param boolean $createifnotexists
|
||||
* create the directory if it does not exist
|
||||
*
|
||||
* @return string the full path to the socket
|
||||
*/
|
||||
public function getSocketFile($createifnotexists = true) {
|
||||
|
||||
public function getSocketFile($createifnotexists = true)
|
||||
{
|
||||
$socketdir = makeCorrectDir(Settings::Get('phpfpm.fastcgi_ipcdir'));
|
||||
$socket = strtolower(makeCorrectFile($socketdir.'/'.$this->_domain['loginname'].'-'.$this->_domain['domain'].'-php-fpm.socket'));
|
||||
// add fpm-config-id to filename so it's unique for the fpm-daemon and doesn't interfere with running configs when reuilding
|
||||
$socket = strtolower(makeCorrectFile($socketdir . '/' . $this->_domain['fpm_config_id'] . '-' . $this->_domain['loginname'] . '-' . $this->_domain['domain'] . '-php-fpm.socket'));
|
||||
|
||||
if (!is_dir($socketdir) && $createifnotexists) {
|
||||
safe_exec('mkdir -p '.escapeshellarg($socketdir));
|
||||
safe_exec('chown -R '.Settings::Get('system.httpuser').':'.Settings::Get('system.httpgroup').' '.escapeshellarg($socketdir));
|
||||
if (! is_dir($socketdir) && $createifnotexists) {
|
||||
safe_exec('mkdir -p ' . escapeshellarg($socketdir));
|
||||
safe_exec('chown -R ' . Settings::Get('system.httpuser') . ':' . Settings::Get('system.httpgroup') . ' ' . escapeshellarg($socketdir));
|
||||
}
|
||||
|
||||
return $socket;
|
||||
@@ -368,15 +389,16 @@ class phpinterface_fpm {
|
||||
/**
|
||||
* fpm-temp directory
|
||||
*
|
||||
* @param boolean $createifnotexists create the directory if it does not exist
|
||||
* @param boolean $createifnotexists
|
||||
* create the directory if it does not exist
|
||||
*
|
||||
* @return string the directory
|
||||
*/
|
||||
public function getTempDir($createifnotexists = true) {
|
||||
|
||||
public function getTempDir($createifnotexists = true)
|
||||
{
|
||||
$tmpdir = makeCorrectDir(Settings::Get('phpfpm.tmpdir') . '/' . $this->_domain['loginname'] . '/');
|
||||
|
||||
if (!is_dir($tmpdir) && $createifnotexists) {
|
||||
if (! is_dir($tmpdir) && $createifnotexists) {
|
||||
safe_exec('mkdir -p ' . escapeshellarg($tmpdir));
|
||||
safe_exec('chown -R ' . $this->_domain['guid'] . ':' . $this->_domain['guid'] . ' ' . escapeshellarg($tmpdir));
|
||||
safe_exec('chmod 0750 ' . escapeshellarg($tmpdir));
|
||||
@@ -388,11 +410,13 @@ class phpinterface_fpm {
|
||||
/**
|
||||
* fastcgi-fakedirectory directory
|
||||
*
|
||||
* @param boolean $createifnotexists create the directory if it does not exist
|
||||
* @param boolean $createifnotexists
|
||||
* create the directory if it does not exist
|
||||
*
|
||||
* @return string the directory
|
||||
*/
|
||||
public function getAliasConfigDir($createifnotexists = true) {
|
||||
public function getAliasConfigDir($createifnotexists = true)
|
||||
{
|
||||
|
||||
// ensure default...
|
||||
if (Settings::Get('phpfpm.aliasconfigdir') == null) {
|
||||
@@ -400,7 +424,7 @@ class phpinterface_fpm {
|
||||
}
|
||||
|
||||
$configdir = makeCorrectDir(Settings::Get('phpfpm.aliasconfigdir') . '/' . $this->_domain['loginname'] . '/' . $this->_domain['domain'] . '/');
|
||||
if (!is_dir($configdir) && $createifnotexists) {
|
||||
if (! is_dir($configdir) && $createifnotexists) {
|
||||
safe_exec('mkdir -p ' . escapeshellarg($configdir));
|
||||
safe_exec('chown ' . $this->_domain['guid'] . ':' . $this->_domain['guid'] . ' ' . escapeshellarg($configdir));
|
||||
}
|
||||
@@ -411,19 +435,21 @@ class phpinterface_fpm {
|
||||
/**
|
||||
* return the admin-data of a specific admin
|
||||
*
|
||||
* @param int $adminid id of the admin-user
|
||||
* @param int $adminid
|
||||
* id of the admin-user
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function _getAdminData($adminid) {
|
||||
|
||||
private function _getAdminData($adminid)
|
||||
{
|
||||
$adminid = intval($adminid);
|
||||
|
||||
if (!isset($this->_admin_cache[$adminid])) {
|
||||
if (! isset($this->_admin_cache[$adminid])) {
|
||||
$stmt = Database::prepare("
|
||||
SELECT `email`, `loginname` FROM `" . TABLE_PANEL_ADMINS . "` WHERE `adminid` = :id"
|
||||
);
|
||||
$this->_admin_cache[$adminid] = Database::pexecute_first($stmt, array('id' => $adminid));
|
||||
SELECT `email`, `loginname` FROM `" . TABLE_PANEL_ADMINS . "` WHERE `adminid` = :id");
|
||||
$this->_admin_cache[$adminid] = Database::pexecute_first($stmt, array(
|
||||
'id' => $adminid
|
||||
));
|
||||
}
|
||||
return $this->_admin_cache[$adminid];
|
||||
}
|
||||
|
||||
@@ -17,13 +17,14 @@
|
||||
* @since 0.9.29
|
||||
*
|
||||
*/
|
||||
|
||||
class ConfigIO {
|
||||
class ConfigIO
|
||||
{
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*/
|
||||
public function __construct() {}
|
||||
public function __construct()
|
||||
{}
|
||||
|
||||
/**
|
||||
* clean up former created configs, including (if enabled)
|
||||
@@ -32,7 +33,8 @@ class ConfigIO {
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function cleanUp() {
|
||||
public function cleanUp()
|
||||
{
|
||||
|
||||
// old error logs
|
||||
$this->_cleanErrLogs();
|
||||
@@ -56,14 +58,14 @@ class ConfigIO {
|
||||
$this->_cleanCustomerSslCerts();
|
||||
}
|
||||
|
||||
private function _cleanErrLogs() {
|
||||
|
||||
$err_dir = makeCorrectDir(FROXLOR_INSTALL_DIR."/logs/");
|
||||
private function _cleanErrLogs()
|
||||
{
|
||||
$err_dir = makeCorrectDir(FROXLOR_INSTALL_DIR . "/logs/");
|
||||
if (@is_dir($err_dir)) {
|
||||
// now get rid of old stuff
|
||||
//(but append /*.log so we don't delete the directory)
|
||||
$err_dir.='/*.log';
|
||||
safe_exec('rm -rf '. makeCorrectFile($err_dir));
|
||||
// (but append /*.log so we don't delete the directory)
|
||||
$err_dir .= '/*.log';
|
||||
safe_exec('rm -rf ' . makeCorrectFile($err_dir));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +75,8 @@ class ConfigIO {
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
private function _cleanCustomerSslCerts() {
|
||||
private function _cleanCustomerSslCerts()
|
||||
{
|
||||
|
||||
/*
|
||||
* only clean up if we're actually using SSL
|
||||
@@ -87,9 +90,9 @@ class ConfigIO {
|
||||
|
||||
if (@is_dir($configdir)) {
|
||||
// now get rid of old stuff
|
||||
//(but append /* so we don't delete the directory)
|
||||
$configdir.='/*';
|
||||
safe_exec('rm -rf '. makeCorrectFile($configdir));
|
||||
// (but append /* so we don't delete the directory)
|
||||
$configdir .= '/*';
|
||||
safe_exec('rm -rf ' . makeCorrectFile($configdir));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -100,7 +103,8 @@ class ConfigIO {
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
private function _cleanWebserverConfigs() {
|
||||
private function _cleanWebserverConfigs()
|
||||
{
|
||||
|
||||
// get directories
|
||||
$configdirs = array();
|
||||
@@ -122,17 +126,15 @@ class ConfigIO {
|
||||
if (@is_dir($config_dir)) {
|
||||
|
||||
// create directory iterator
|
||||
$its = new RecursiveIteratorIterator(
|
||||
new RecursiveDirectoryIterator($config_dir)
|
||||
);
|
||||
$its = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($config_dir));
|
||||
|
||||
// iterate through all subdirs,
|
||||
// look for vhost/diroption files
|
||||
// and delete them
|
||||
foreach ($its as $fullFileName => $it ) {
|
||||
foreach ($its as $fullFileName => $it) {
|
||||
if ($it->isFile() && preg_match($pattern, $it->getFilename())) {
|
||||
// remove file
|
||||
safe_exec('rm -f '. escapeshellarg(makeCorrectFile($its->getPathname())));
|
||||
safe_exec('rm -f ' . escapeshellarg(makeCorrectFile($its->getPathname())));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -144,7 +146,8 @@ class ConfigIO {
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
private function _cleanHtpasswdFiles() {
|
||||
private function _cleanHtpasswdFiles()
|
||||
{
|
||||
|
||||
// get correct directory
|
||||
$configdir = $this->_getFile('system', 'apacheconf_htpasswddir');
|
||||
@@ -154,9 +157,9 @@ class ConfigIO {
|
||||
|
||||
if (@is_dir($configdir)) {
|
||||
// now get rid of old stuff
|
||||
//(but append /* so we don't delete the directory)
|
||||
$configdir.='/*';
|
||||
safe_exec('rm -rf '. makeCorrectFile($configdir));
|
||||
// (but append /* so we don't delete the directory)
|
||||
$configdir .= '/*';
|
||||
safe_exec('rm -rf ' . makeCorrectFile($configdir));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -166,37 +169,36 @@ class ConfigIO {
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
private function _cleanAwstatsFiles() {
|
||||
|
||||
private function _cleanAwstatsFiles()
|
||||
{
|
||||
if (Settings::Get('system.awstats_enabled') == '0') {
|
||||
return;
|
||||
}
|
||||
|
||||
//dhr: cleanout froxlor-generated awstats configs prior to re-creation
|
||||
// dhr: cleanout froxlor-generated awstats configs prior to re-creation
|
||||
$awstatsclean['header'] = "## GENERATED BY FROXLOR\n";
|
||||
$awstatsclean['headerold'] = "## GENERATED BY SYSCP\n";
|
||||
$awstatsclean['path'] = $this->_getFile('system', 'awstats_conf');
|
||||
|
||||
/**
|
||||
* don't do anything if the directory does not exist
|
||||
* (e.g. awstats not installed yet or whatever)
|
||||
* (e.g.
|
||||
* awstats not installed yet or whatever)
|
||||
* fixes #45
|
||||
*/
|
||||
if ($awstatsclean['path'] !== false && is_dir($awstatsclean['path'])) {
|
||||
$awstatsclean['dir'] = dir($awstatsclean['path']);
|
||||
while ($awstatsclean['entry'] = $awstatsclean['dir']->read()) {
|
||||
$awstatsclean['fullentry'] = makeCorrectFile($awstatsclean['path'].'/'.$awstatsclean['entry']);
|
||||
$awstatsclean['fullentry'] = makeCorrectFile($awstatsclean['path'] . '/' . $awstatsclean['entry']);
|
||||
/**
|
||||
* don't do anything if the file does not exist
|
||||
*/
|
||||
if (@file_exists($awstatsclean['fullentry'])) {
|
||||
$awstatsclean['fh'] = fopen($awstatsclean['fullentry'], 'r');
|
||||
$awstatsclean['headerRead'] = fgets($awstatsclean['fh'], strlen($awstatsclean['header'])+1);
|
||||
$awstatsclean['headerRead'] = fgets($awstatsclean['fh'], strlen($awstatsclean['header']) + 1);
|
||||
fclose($awstatsclean['fh']);
|
||||
|
||||
if ($awstatsclean['headerRead'] == $awstatsclean['header']
|
||||
|| $awstatsclean['headerRead'] == $awstatsclean['headerold']
|
||||
) {
|
||||
if ($awstatsclean['headerRead'] == $awstatsclean['header'] || $awstatsclean['headerRead'] == $awstatsclean['headerold']) {
|
||||
$awstats_conf_file = makeCorrectFile($awstatsclean['fullentry']);
|
||||
@unlink($awstats_conf_file);
|
||||
}
|
||||
@@ -204,7 +206,7 @@ class ConfigIO {
|
||||
}
|
||||
}
|
||||
unset($awstatsclean);
|
||||
//end dhr
|
||||
// end dhr
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -212,8 +214,8 @@ class ConfigIO {
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
private function _cleanFcgidFiles() {
|
||||
|
||||
private function _cleanFcgidFiles()
|
||||
{
|
||||
if (Settings::Get('system.mod_fcgid') == '0') {
|
||||
return;
|
||||
}
|
||||
@@ -226,15 +228,13 @@ class ConfigIO {
|
||||
|
||||
if (@is_dir($configdir)) {
|
||||
// create directory iterator
|
||||
$its = new RecursiveIteratorIterator(
|
||||
new RecursiveDirectoryIterator($configdir)
|
||||
);
|
||||
$its = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configdir));
|
||||
|
||||
// iterate through all subdirs,
|
||||
// look for php-fcgi-starter files
|
||||
// and take immutable-flag away from them
|
||||
// so we can delete them :)
|
||||
foreach ($its as $fullFileName => $it ) {
|
||||
foreach ($its as $fullFileName => $it) {
|
||||
if ($it->isFile() && $it->getFilename() == 'php-fcgi-starter') {
|
||||
// set chattr -i
|
||||
removeImmutable($its->getPathname());
|
||||
@@ -242,9 +242,9 @@ class ConfigIO {
|
||||
}
|
||||
|
||||
// now get rid of old stuff
|
||||
//(but append /* so we don't delete the directory)
|
||||
$configdir.='/*';
|
||||
safe_exec('rm -rf '. makeCorrectFile($configdir));
|
||||
// (but append /* so we don't delete the directory)
|
||||
$configdir .= '/*';
|
||||
safe_exec('rm -rf ' . makeCorrectFile($configdir));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -254,23 +254,26 @@ class ConfigIO {
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
private function _cleanFpmFiles() {
|
||||
|
||||
private function _cleanFpmFiles()
|
||||
{
|
||||
if (Settings::Get('phpfpm.enabled') == '0') {
|
||||
return;
|
||||
}
|
||||
|
||||
// get correct directory
|
||||
$configdir = $this->_getFile('phpfpm', 'configdir');
|
||||
if ($configdir !== false) {
|
||||
|
||||
$configdir = makeCorrectDir($configdir);
|
||||
|
||||
// get all fpm config paths
|
||||
$fpmconf_sel = Database::prepare("SELECT config_dir FROM `" . TABLE_PANEL_FPMDAEMONS . "`");
|
||||
Database::pexecute($fpmconf_sel);
|
||||
$fpmconf_paths = $fpmconf_sel->fetchAll(PDO::FETCH_ASSOC);
|
||||
// clean all php-fpm config-dirs
|
||||
foreach ($fpmconf_paths as $configdir) {
|
||||
$configdir = makeCorrectDir($configdir['config_dir']);
|
||||
if (@is_dir($configdir)) {
|
||||
// now get rid of old stuff
|
||||
//(but append /* so we don't delete the directory)
|
||||
$configdir.='/*';
|
||||
safe_exec('rm -rf '. makeCorrectFile($configdir));
|
||||
// (but append /* so we don't delete the directory)
|
||||
$configdir .= '/*';
|
||||
safe_exec('rm -rf ' . makeCorrectFile($configdir));
|
||||
} else {
|
||||
safe_exec('mkdir -p ' . $configdir);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,8 +282,8 @@ class ConfigIO {
|
||||
if ($aliasconfigdir !== false) {
|
||||
$aliasconfigdir = makeCorrectDir($aliasconfigdir);
|
||||
if (@is_dir($aliasconfigdir)) {
|
||||
$aliasconfigdir.='/*';
|
||||
safe_exec('rm -rf '. makeCorrectFile($aliasconfigdir));
|
||||
$aliasconfigdir .= '/*';
|
||||
safe_exec('rm -rf ' . makeCorrectFile($aliasconfigdir));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -288,16 +291,20 @@ class ConfigIO {
|
||||
/**
|
||||
* returns a file/direcotry from the settings and checks whether it exists
|
||||
*
|
||||
* @param string $group settings-group
|
||||
* @param string $varname var-name
|
||||
* @param boolean $check_exists check if the file exists
|
||||
* @param string $group
|
||||
* settings-group
|
||||
* @param string $varname
|
||||
* var-name
|
||||
* @param boolean $check_exists
|
||||
* check if the file exists
|
||||
*
|
||||
* @return string|boolean complete path including filename if any or false on error
|
||||
*/
|
||||
private function _getFile($group, $varname, $check_exists = true) {
|
||||
private function _getFile($group, $varname, $check_exists = true)
|
||||
{
|
||||
|
||||
// read from settings
|
||||
$file = Settings::Get($group.'.'.$varname);
|
||||
$file = Settings::Get($group . '.' . $varname);
|
||||
|
||||
// check whether it exists
|
||||
if ($check_exists && @file_exists($file) == false) {
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
* @since 0.9.31
|
||||
*
|
||||
*/
|
||||
|
||||
class WebserverBase {
|
||||
class WebserverBase
|
||||
{
|
||||
|
||||
/**
|
||||
* returns an array with all entries required for all
|
||||
@@ -26,8 +26,8 @@ class WebserverBase {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getVhostsToCreate() {
|
||||
|
||||
public static function getVhostsToCreate()
|
||||
{
|
||||
$query = "SELECT `d`.*, `pd`.`domain` AS `parentdomain`, `c`.`loginname`,
|
||||
`d`.`phpsettingid`, `c`.`adminid`, `c`.`guid`, `c`.`email`,
|
||||
`c`.`documentroot` AS `customerroot`, `c`.`deactivated`,
|
||||
@@ -35,10 +35,10 @@ class WebserverBase {
|
||||
`d`.`phpenabled` AS `phpenabled_vhost`,
|
||||
`d`.`mod_fcgid_starter`,`d`.`mod_fcgid_maxrequests`,
|
||||
`d`.`ocsp_stapling`
|
||||
FROM `".TABLE_PANEL_DOMAINS."` `d`
|
||||
FROM `" . TABLE_PANEL_DOMAINS . "` `d`
|
||||
|
||||
LEFT JOIN `".TABLE_PANEL_CUSTOMERS."` `c` USING(`customerid`)
|
||||
LEFT JOIN `".TABLE_PANEL_DOMAINS."` `pd` ON (`pd`.`id` = `d`.`parentdomainid`)
|
||||
LEFT JOIN `" . TABLE_PANEL_CUSTOMERS . "` `c` USING(`customerid`)
|
||||
LEFT JOIN `" . TABLE_PANEL_DOMAINS . "` `pd` ON (`pd`.`id` = `d`.`parentdomainid`)
|
||||
|
||||
WHERE `d`.`aliasdomain` IS NULL AND `d`.`email_only` <> '1'
|
||||
ORDER BY `d`.`parentdomainid` DESC, `d`.`iswildcarddomain`, `d`.`domain` ASC;
|
||||
@@ -64,12 +64,14 @@ class WebserverBase {
|
||||
|
||||
$ip_stmt = Database::prepare("
|
||||
SELECT `di`.`id_domain` , `p`.`ssl`, `p`.`ssl_cert_file`, `p`.`ssl_key_file`, `p`.`ssl_ca_file`, `p`.`ssl_cert_chainfile`
|
||||
FROM `".TABLE_DOMAINTOIP."` `di`, `".TABLE_PANEL_IPSANDPORTS."` `p`
|
||||
FROM `" . TABLE_DOMAINTOIP . "` `di`, `" . TABLE_PANEL_IPSANDPORTS . "` `p`
|
||||
WHERE `p`.`id` = `di`.`id_ipandports`
|
||||
AND `di`.`id_domain` = :domainid
|
||||
AND `p`.`ssl` = '1'
|
||||
");
|
||||
$ssl_ip = Database::pexecute_first($ip_stmt, array('domainid' => $domain['id']));
|
||||
$ssl_ip = Database::pexecute_first($ip_stmt, array(
|
||||
'domainid' => $domain['id']
|
||||
));
|
||||
|
||||
// set ssl info for domain
|
||||
$domains[$domain['domain']]['ssl'] = '1';
|
||||
@@ -77,11 +79,24 @@ class WebserverBase {
|
||||
$domains[$domain['domain']]['ssl_key_file'] = $ssl_ip['ssl_key_file'];
|
||||
$domains[$domain['domain']]['ssl_ca_file'] = $ssl_ip['ssl_ca_file'];
|
||||
$domains[$domain['domain']]['ssl_cert_chainfile'] = $ssl_ip['ssl_cert_chainfile'];
|
||||
}
|
||||
|
||||
// read fpm-config-id if using fpm
|
||||
if ((int) Settings::Get('phpfpm.enabled') == 1) {
|
||||
$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' => $domain['phpsettingid']
|
||||
));
|
||||
if ($fpm_config) {
|
||||
$domains[$domain['domain']]['fpm_config_id'] = $fpm_config['id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $domains;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
89
lib/formfields/admin/phpconfig/formfield.fpmconfig_add.php
Normal file
89
lib/formfields/admin/phpconfig/formfield.fpmconfig_add.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Formfields
|
||||
*
|
||||
*/
|
||||
|
||||
return array(
|
||||
'fpmconfig_add' => array(
|
||||
'title' => $lng['admin']['phpsettings']['addsettings'],
|
||||
'image' => 'icons/phpsettings_add.png',
|
||||
'sections' => array(
|
||||
'section_a' => array(
|
||||
'title' => $lng['admin']['phpsettings']['addsettings'],
|
||||
'image' => 'icons/phpsettings_add.png',
|
||||
'fields' => array(
|
||||
'description' => array(
|
||||
'label' => $lng['admin']['phpsettings']['description'],
|
||||
'type' => 'text',
|
||||
'maxlength' => 50
|
||||
),
|
||||
'reload_cmd' => array(
|
||||
'label' => $lng['serversettings']['phpfpm_settings']['reload'],
|
||||
'type' => 'text',
|
||||
'maxlength' => 255,
|
||||
'value' => 'service php7.0-fpm restart'
|
||||
),
|
||||
'config_dir' => array(
|
||||
'label' => $lng['serversettings']['phpfpm_settings']['configdir'],
|
||||
'type' => 'text',
|
||||
'maxlength' => 255,
|
||||
'value' => '/etc/php/7.0/fpm/pool.d/'
|
||||
),
|
||||
'pm' => array(
|
||||
'label' => $lng['serversettings']['phpfpm_settings']['pm'],
|
||||
'type' => 'select',
|
||||
'select_var' => $pm_select
|
||||
),
|
||||
'max_children' => array(
|
||||
'label' => $lng['serversettings']['phpfpm_settings']['max_children']['title'],
|
||||
'desc' => $lng['serversettings']['phpfpm_settings']['max_children']['description'],
|
||||
'type' => 'int',
|
||||
'value' => 1
|
||||
),
|
||||
'start_servers' => array(
|
||||
'label' => $lng['serversettings']['phpfpm_settings']['start_servers']['title'],
|
||||
'desc' => $lng['serversettings']['phpfpm_settings']['start_servers']['description'],
|
||||
'type' => 'int',
|
||||
'value' => 20
|
||||
),
|
||||
'min_spare_servers' => array(
|
||||
'label' => $lng['serversettings']['phpfpm_settings']['min_spare_servers']['title'],
|
||||
'desc' => $lng['serversettings']['phpfpm_settings']['min_spare_servers']['description'],
|
||||
'type' => 'int',
|
||||
'value' => 5
|
||||
),
|
||||
'max_spare_servers' => array(
|
||||
'label' => $lng['serversettings']['phpfpm_settings']['max_spare_servers']['title'],
|
||||
'desc' => $lng['serversettings']['phpfpm_settings']['max_spare_servers']['description'],
|
||||
'type' => 'int',
|
||||
'value' => 35
|
||||
),
|
||||
'max_requests' => array(
|
||||
'label' => $lng['serversettings']['phpfpm_settings']['max_requests']['title'],
|
||||
'desc' => $lng['serversettings']['phpfpm_settings']['max_requests']['description'],
|
||||
'type' => 'int',
|
||||
'value' => 0
|
||||
),
|
||||
'idle_timeout' => array(
|
||||
'label' => $lng['serversettings']['phpfpm_settings']['idle_timeout']['title'],
|
||||
'desc' => $lng['serversettings']['phpfpm_settings']['idle_timeout']['description'],
|
||||
'type' => 'int',
|
||||
'value' => 30
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
91
lib/formfields/admin/phpconfig/formfield.fpmconfig_edit.php
Normal file
91
lib/formfields/admin/phpconfig/formfield.fpmconfig_edit.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Formfields
|
||||
*
|
||||
*/
|
||||
|
||||
return array(
|
||||
'fpmconfig_edit' => array(
|
||||
'title' => $lng['admin']['phpsettings']['editsettings'],
|
||||
'image' => 'icons/phpsettings_edit.png',
|
||||
'sections' => array(
|
||||
'section_a' => array(
|
||||
'title' => $lng['admin']['phpsettings']['editsettings'],
|
||||
'image' => 'icons/phpsettings_edit.png',
|
||||
'fields' => array(
|
||||
'description' => array(
|
||||
'label' => $lng['admin']['phpsettings']['description'],
|
||||
'type' => 'text',
|
||||
'maxlength' => 50,
|
||||
'value' => $result['description']
|
||||
),
|
||||
'reload_cmd' => array(
|
||||
'label' => $lng['serversettings']['phpfpm_settings']['reload'],
|
||||
'type' => 'text',
|
||||
'maxlength' => 255,
|
||||
'value' => $result['reload_cmd']
|
||||
),
|
||||
'config_dir' => array(
|
||||
'label' => $lng['serversettings']['phpfpm_settings']['configdir'],
|
||||
'type' => 'text',
|
||||
'maxlength' => 255,
|
||||
'value' => $result['config_dir']
|
||||
),
|
||||
'pm' => array(
|
||||
'label' => $lng['serversettings']['phpfpm_settings']['pm'],
|
||||
'type' => 'select',
|
||||
'select_var' => array('static' => 'static', 'dynamic' => 'dynamic', 'ondemand' => 'ondemand'),
|
||||
'value' => $result['pm']
|
||||
),
|
||||
'max_children' => array(
|
||||
'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(
|
||||
'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(
|
||||
'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(
|
||||
'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(
|
||||
'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(
|
||||
'label' => $lng['serversettings']['phpfpm_settings']['idle_timeout']['title'],
|
||||
'desc' => $lng['serversettings']['phpfpm_settings']['idle_timeout']['description'],
|
||||
'type' => 'int',
|
||||
'value' => $result['idle_timeout']
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -36,6 +36,12 @@ return array(
|
||||
'maxlength' => 255,
|
||||
'value' => '/usr/bin/php-cgi'
|
||||
),
|
||||
'fpmconfig' => array(
|
||||
'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false),
|
||||
'label' => $lng['admin']['phpsettings']['fpmdesc'],
|
||||
'type' => 'select',
|
||||
'select_var' => $fpmconfigs
|
||||
),
|
||||
'file_extensions' => array(
|
||||
'visible' => (Settings::Get('system.mod_fcgid') == 1 ? true : false),
|
||||
'label' => $lng['admin']['phpsettings']['file_extensions'],
|
||||
|
||||
@@ -37,6 +37,12 @@ return array(
|
||||
'maxlength' => 255,
|
||||
'value' => $result['binary']
|
||||
),
|
||||
'fpmconfig' => array(
|
||||
'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false),
|
||||
'label' => $lng['admin']['phpsettings']['fpmdesc'],
|
||||
'type' => 'select',
|
||||
'select_var' => $fpmconfigs
|
||||
),
|
||||
'file_extensions' => array(
|
||||
'visible' => (Settings::Get('system.mod_fcgid') == 1 ? true : false),
|
||||
'label' => $lng['admin']['phpsettings']['file_extensions'],
|
||||
|
||||
@@ -279,6 +279,12 @@ return array(
|
||||
'label' => $lng['menue']['phpsettings']['maintitle'],
|
||||
'show_element' => (Settings::Get('system.mod_fcgid') == true || Settings::Get('phpfpm.enabled') == true)
|
||||
),
|
||||
array(
|
||||
'url' => 'admin_phpsettings.php?page=fpmdaemons',
|
||||
'label' => $lng['menue']['phpsettings']['fpmdaemons'],
|
||||
'required_resources' => 'change_serversettings',
|
||||
'show_element' => Settings::Get('phpfpm.enabled') == true
|
||||
),
|
||||
array(
|
||||
'url' => 'admin_settings.php?page=phpinfo',
|
||||
'label' => $lng['admin']['phpinfo'],
|
||||
|
||||
@@ -51,5 +51,6 @@ define('TABLE_PANEL_DOMAINREDIRECTS', 'domain_redirect_codes');
|
||||
define('TABLE_PANEL_DOMAIN_SSL_SETTINGS', 'domain_ssl_settings');
|
||||
define('TABLE_DOMAINTOIP', 'panel_domaintoip');
|
||||
define('TABLE_DOMAIN_DNS', 'domain_dns_entries');
|
||||
define('TABLE_PANEL_FPMDAEMONS', 'panel_fpmdaemons');
|
||||
|
||||
require dirname(__FILE__).'/version.inc.php';
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
$version = '0.9.38.8';
|
||||
|
||||
// Database version (YYYYMMDDC where C is a daily counter)
|
||||
$dbversion = '201712310';
|
||||
$dbversion = '201801070';
|
||||
|
||||
// Distribution branding-tag (used for Debian etc.)
|
||||
$branding = '';
|
||||
|
||||
@@ -940,6 +940,7 @@ $lng['admin']['phpsettings']['phpinisettings'] = 'php.ini settings';
|
||||
$lng['error']['nopermissionsorinvalidid'] = 'You don\'t have enough permissions to change these settings or an invalid id was given.';
|
||||
$lng['panel']['view'] = 'view';
|
||||
$lng['question']['phpsetting_reallydelete'] = 'Do you really want to delete these settings? All domains which use these settings currently will be changed to the default config.';
|
||||
$lng['question']['fpmsetting_reallydelete'] = 'Do you really want to delete these php-fpm settings? All php configurations which use these settings currently will be changed to the default config.';
|
||||
$lng['admin']['phpsettings']['addnew'] = 'Create new settings';
|
||||
$lng['error']['phpsettingidwrong'] = 'A PHP Configuration with this id doesn\'t exist';
|
||||
$lng['error']['descriptioninvalid'] = 'The description is too short, too long or contains illegal characters.';
|
||||
@@ -1001,6 +1002,7 @@ $lng['error']['ipportdoesntexist'] = 'The ip/port combination you have chosen do
|
||||
|
||||
$lng['admin']['phpserversettings'] = 'PHP Settings';
|
||||
$lng['admin']['phpsettings']['binary'] = 'PHP Binary';
|
||||
$lng['admin']['phpsettings']['fpmdesc'] = 'PHP-FPM config';
|
||||
$lng['admin']['phpsettings']['file_extensions'] = 'File extensions';
|
||||
$lng['admin']['phpsettings']['file_extensions_note'] = '(without dot, separated by spaces)';
|
||||
$lng['admin']['mod_fcgid_maxrequests']['title'] = 'Maximum php requests for this domain (empty for default value)';
|
||||
@@ -1656,7 +1658,7 @@ $lng['traffic']['mail'] = 'Mail (MiB)';
|
||||
$lng['serversettings']['mod_fcgid']['idle_timeout']['title'] = 'Idle Timeout';
|
||||
$lng['serversettings']['mod_fcgid']['idle_timeout']['description'] = 'Timeout setting for Mod FastCGI.';
|
||||
$lng['serversettings']['phpfpm_settings']['idle_timeout']['title'] = 'Idle Timeout';
|
||||
$lng['serversettings']['phpfpm_settings']['idle_timeout']['description'] = 'Timeout setting for PHP5 FPM FastCGI.';
|
||||
$lng['serversettings']['phpfpm_settings']['idle_timeout']['description'] = 'Timeout setting for PHP FPM FastCGI.';
|
||||
|
||||
// ADDED IN 0.9.27-svn2
|
||||
$lng['panel']['cancel'] = 'Cancel';
|
||||
@@ -2082,3 +2084,5 @@ $lng['admin']['testmail'] = 'SMTP test';
|
||||
$lng['success']['testmailsent'] = 'Test mail sent successfully';
|
||||
$lng['serversettings']['disable_le_selfcheck']['title'] = "Disable Let's Encrypt local self-check";
|
||||
$lng['serversettings']['disable_le_selfcheck']['description'] = "If activated, froxlor will <strong>not</strong> perform its self-check for token accessability. Needed for NATed IP's or similar.";
|
||||
$lng['menue']['phpsettings']['fpmdaemons'] = 'PHP-FPM versions';
|
||||
$lng['admin']['phpsettings']['activephpconfigs'] = 'In use for php-config(s)';
|
||||
|
||||
@@ -934,6 +934,7 @@ $lng['admin']['phpsettings']['phpinisettings'] = 'php.ini-Einstellungen';
|
||||
$lng['error']['nopermissionsorinvalidid'] = 'Entweder fehlen Ihnen die nötigen Rechte diese Einstellung zu ändern oder es wurde eine ungültige ID übergeben';
|
||||
$lng['panel']['view'] = 'ansehen';
|
||||
$lng['question']['phpsetting_reallydelete'] = 'Wollen Sie diese PHP-Einstellungen wirklich löschen? Alle Domains die diese Einstellungen bis jetzt verwendet haben, werden dann auf die Standardeinstellungen umgestellt.';
|
||||
$lng['question']['fpmsetting_reallydelete'] = 'Wollen Sie diese PHP-FPM Einstellungen wirklich löschen? Alle PHP Konfigurationen die diese Einstellungen bis jetzt verwendet haben, werden dann auf die Standardeinstellungen umgestellt.';
|
||||
$lng['admin']['phpsettings']['addnew'] = 'Neue Konfiguration erstellen';
|
||||
$lng['error']['phpsettingidwrong'] = 'Eine PHP-Konfiguration mit dieser ID existiert nicht';
|
||||
$lng['error']['descriptioninvalid'] = 'Der Beschreibungstext ist zu kurz, zu lang oder enthält ungültige Zeichen';
|
||||
@@ -997,6 +998,7 @@ $lng['error']['ipportdoesntexist'] = 'Die gewählte IP/Port-Kombination existier
|
||||
|
||||
$lng['admin']['phpserversettings'] = 'PHP-Einstellungen';
|
||||
$lng['admin']['phpsettings']['binary'] = 'PHP-Binary';
|
||||
$lng['admin']['phpsettings']['fpmdesc'] = 'PHP-FPM Config';
|
||||
$lng['admin']['phpsettings']['file_extensions'] = 'Dateiendungen';
|
||||
$lng['admin']['phpsettings']['file_extensions_note'] = '(ohne Punkt, durch Leerzeichen getrennt)';
|
||||
$lng['admin']['mod_fcgid_maxrequests']['title'] = 'Maximale PHP-Requests für diese Domain (leer für Standardwert)';
|
||||
@@ -1383,7 +1385,7 @@ $lng['traffic']['mail'] = 'Mail (MiB)';
|
||||
$lng['serversettings']['mod_fcgid']['idle_timeout']['title'] = 'Idle-Timeout';
|
||||
$lng['serversettings']['mod_fcgid']['idle_timeout']['description'] = 'Timeout-Einstellung für mod_FastCGI.';
|
||||
$lng['serversettings']['phpfpm_settings']['idle_timeout']['title'] = 'Idle-Timeout';
|
||||
$lng['serversettings']['phpfpm_settings']['idle_timeout']['description'] = 'Timeout-Einstellung für PHP5-FPM FastCGI.';
|
||||
$lng['serversettings']['phpfpm_settings']['idle_timeout']['description'] = 'Timeout-Einstellung für PHP-FPM FastCGI.';
|
||||
|
||||
// ADDED IN 0.9.27-svn2
|
||||
$lng['admin']['delete_statistics'] = 'Statistiken Löschen';
|
||||
@@ -1733,3 +1735,5 @@ $lng['admin']['testmail'] = 'SMTP Test';
|
||||
$lng['success']['testmailsent'] = 'Test E-Mail erfolgreich gesendet';
|
||||
$lng['serversettings']['disable_le_selfcheck']['title'] = "Deaktiviere Let's Encrypt lokale Selbstprüfung";
|
||||
$lng['serversettings']['disable_le_selfcheck']['description'] = "Wenn aktiviert wird Froxlor <strong>keine</strong> Erreichbarkeitsprüfung des Tokens vornehmen. Nötig bei ge-NAT-eten IP's oder Ähnlichem";
|
||||
$lng['menue']['phpsettings']['fpmdaemons'] = 'PHP-FPM Versionen';
|
||||
$lng['admin']['phpsettings']['activephpconfigs'] = 'In Verwendung für PHP-Konfiguration(en)';
|
||||
|
||||
@@ -58,8 +58,15 @@ class apache extends HttpConfigBase
|
||||
public function reload()
|
||||
{
|
||||
if ((int) Settings::Get('phpfpm.enabled') == 1) {
|
||||
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'apache::reload: reloading php-fpm');
|
||||
safe_exec(escapeshellcmd(Settings::Get('phpfpm.reload')));
|
||||
// get all start/stop commands
|
||||
$startstop_sel = Database::prepare("SELECT reload_cmd FROM `" . TABLE_PANEL_FPMDAEMONS . "`");
|
||||
Database::pexecute($startstop_sel);
|
||||
$restart_cmds = $startstop_sel->fetchAll(PDO::FETCH_ASSOC);
|
||||
// restart all php-fpm instances
|
||||
foreach ($restart_cmds as $restart_cmd) {
|
||||
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'apache::reload: running ' . $restart_cmd['reload_cmd']);
|
||||
safe_exec(escapeshellcmd($restart_cmd['reload_cmd']));
|
||||
}
|
||||
}
|
||||
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'apache::reload: reloading apache');
|
||||
safe_exec(escapeshellcmd(Settings::Get('system.apachereload_command')));
|
||||
@@ -102,8 +109,7 @@ class apache extends HttpConfigBase
|
||||
|
||||
$ocsp_cache_filename = makeCorrectFile($vhosts_folder . '/03_froxlor_ocsp_cache.conf');
|
||||
if (Settings::Get('system.use_ssl') == '1' && Settings::Get('system.apache24') == 1) {
|
||||
$this->virtualhosts_data[$ocsp_cache_filename] = 'SSLStaplingCache ' .
|
||||
Settings::Get('system.apache24_ocsp_cache_path') . "\n";
|
||||
$this->virtualhosts_data[$ocsp_cache_filename] = 'SSLStaplingCache ' . Settings::Get('system.apache24_ocsp_cache_path') . "\n";
|
||||
} else {
|
||||
if (file_exists($ocsp_cache_filename)) {
|
||||
$this->logger->logAction(CRON_ACTION, LOG_NOTICE, 'apache::_createStandardDirectoryEntry: unlinking ' . basename($ocsp_cache_filename));
|
||||
@@ -280,8 +286,7 @@ class apache extends HttpConfigBase
|
||||
}
|
||||
$this->virtualhosts_data[$vhosts_filename] .= ' </Directory>' . "\n";
|
||||
}
|
||||
}
|
||||
elseif (Settings::Get('phpfpm.enabled') == '1') {
|
||||
} elseif (Settings::Get('phpfpm.enabled') == '1') {
|
||||
// create php-fpm <Directory>-Part (config is created in apache_fcgid)
|
||||
$domain = array(
|
||||
'id' => 'none',
|
||||
@@ -347,8 +352,7 @@ class apache extends HttpConfigBase
|
||||
);
|
||||
}
|
||||
} // end of ssl-redirect check
|
||||
else
|
||||
{
|
||||
else {
|
||||
// fallback of froxlor domain-data for processSpecialConfigTemplate()
|
||||
$domain = array(
|
||||
'domain' => Settings::Get('system.hostname'),
|
||||
@@ -509,7 +513,7 @@ class apache extends HttpConfigBase
|
||||
if ($domain['phpenabled_customer'] == 1 && $domain['phpenabled_vhost'] == '1') {
|
||||
// This vHost has PHP enabled and we are using the regular mod_php
|
||||
$cmail = getCustomerDetail($domain['customerid'], 'email');
|
||||
$php_options_text .= ' php_admin_value sendmail_path "/usr/sbin/sendmail -t -f '.$cmail.'"' . PHP_EOL;
|
||||
$php_options_text .= ' php_admin_value sendmail_path "/usr/sbin/sendmail -t -f ' . $cmail . '"' . PHP_EOL;
|
||||
|
||||
if ($domain['openbasedir'] == '1') {
|
||||
if ($domain['openbasedir_path'] == '1' || strstr($domain['documentroot'], ":") !== false) {
|
||||
@@ -887,9 +891,7 @@ class apache extends HttpConfigBase
|
||||
$vhost_content .= ' SSLCertificateChainFile ' . makeCorrectFile($domain['ssl_cert_chainfile']) . "\n";
|
||||
}
|
||||
|
||||
if (Settings::Get('system.apache24') == '1' && isset($domain['ocsp_stapling']) &&
|
||||
$domain['ocsp_stapling'] == '1')
|
||||
{
|
||||
if (Settings::Get('system.apache24') == '1' && isset($domain['ocsp_stapling']) && $domain['ocsp_stapling'] == '1') {
|
||||
$vhost_content .= ' SSLUseStapling on' . PHP_EOL;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,8 +58,15 @@ class lighttpd extends HttpConfigBase
|
||||
public function reload()
|
||||
{
|
||||
if ((int) Settings::Get('phpfpm.enabled') == 1) {
|
||||
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'lighttpd::reload: reloading php-fpm');
|
||||
safe_exec(escapeshellcmd(Settings::Get('phpfpm.reload')));
|
||||
// get all start/stop commands
|
||||
$startstop_sel = Database::prepare("SELECT reload_cmd FROM `" . TABLE_PANEL_FPMDAEMONS . "`");
|
||||
Database::pexecute($startstop_sel);
|
||||
$restart_cmds = $startstop_sel->fetchAll(PDO::FETCH_ASSOC);
|
||||
// restart all php-fpm instances
|
||||
foreach ($restart_cmds as $restart_cmd) {
|
||||
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'lighttpd::reload: running ' . $restart_cmd['reload_cmd']);
|
||||
safe_exec(escapeshellcmd($restart_cmd['reload_cmd']));
|
||||
}
|
||||
}
|
||||
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'lighttpd::reload: reloading lighttpd');
|
||||
safe_exec(escapeshellcmd(Settings::Get('system.apachereload_command')));
|
||||
|
||||
@@ -73,8 +73,15 @@ class nginx extends HttpConfigBase
|
||||
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'nginx::reload: restarting php processes');
|
||||
safe_exec(Settings::Get('system.phpreload_command'));
|
||||
} elseif ((int) Settings::Get('phpfpm.enabled') == 1) {
|
||||
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'nginx::reload: reloading php-fpm');
|
||||
safe_exec(escapeshellcmd(Settings::Get('phpfpm.reload')));
|
||||
// get all start/stop commands
|
||||
$startstop_sel = Database::prepare("SELECT reload_cmd FROM `" . TABLE_PANEL_FPMDAEMONS . "`");
|
||||
Database::pexecute($startstop_sel);
|
||||
$restart_cmds = $startstop_sel->fetchAll(PDO::FETCH_ASSOC);
|
||||
// restart all php-fpm instances
|
||||
foreach ($restart_cmds as $restart_cmd) {
|
||||
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'nginx::reload: running ' . $restart_cmd['reload_cmd']);
|
||||
safe_exec(escapeshellcmd($restart_cmd['reload_cmd']));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
24
templates/Sparkle/admin/phpconfig/fpmconfig_add.tpl
vendored
Normal file
24
templates/Sparkle/admin/phpconfig/fpmconfig_add.tpl
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
$header
|
||||
<article>
|
||||
<header>
|
||||
<h2>
|
||||
<img src="templates/{$theme}/assets/img/icons/phpsettings_add_big.png" alt="{$title}" />
|
||||
{$title}
|
||||
</h2>
|
||||
</header>
|
||||
|
||||
<section>
|
||||
|
||||
<form action="{$linker->getLink(array('section' => 'phpsettings'))}" method="post" enctype="application/x-www-form-urlencoded">
|
||||
<input type="hidden" name="s" value="$s" />
|
||||
<input type="hidden" name="page" value="$page" />
|
||||
<input type="hidden" name="action" value="$action" />
|
||||
<input type="hidden" name="send" value="send" />
|
||||
|
||||
<table class="full">
|
||||
{$fpmconfig_add_form}
|
||||
</table>
|
||||
</form>
|
||||
</section>
|
||||
</article>
|
||||
$footer
|
||||
25
templates/Sparkle/admin/phpconfig/fpmconfig_edit.tpl
vendored
Normal file
25
templates/Sparkle/admin/phpconfig/fpmconfig_edit.tpl
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
$header
|
||||
<article>
|
||||
<header>
|
||||
<h2>
|
||||
<img src="templates/{$theme}/assets/img/icons/phpsettings_edit_big.png" alt="{$title}" />
|
||||
{$title}
|
||||
</h2>
|
||||
</header>
|
||||
|
||||
<section>
|
||||
|
||||
<form action="{$linker->getLink(array('section' => 'phpsettings'))}" method="post" enctype="application/x-www-form-urlencoded">
|
||||
<input type="hidden" name="s" value="$s"/>
|
||||
<input type="hidden" name="page" value="$page"/>
|
||||
<input type="hidden" name="action" value="edit"/>
|
||||
<input type="hidden" name="id" value="$id"/>
|
||||
<input type="hidden" name="send" value="send" />
|
||||
|
||||
<table class="full">
|
||||
{$fpmconfig_edit_form}
|
||||
</table>
|
||||
</form>
|
||||
</section>
|
||||
</article>
|
||||
$footer
|
||||
42
templates/Sparkle/admin/phpconfig/fpmdaemons.tpl
vendored
Normal file
42
templates/Sparkle/admin/phpconfig/fpmdaemons.tpl
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
$header
|
||||
<article>
|
||||
<header>
|
||||
<h2>
|
||||
<img src="templates/{$theme}/assets/img/icons/phpsettings_big.png" alt="" />
|
||||
{$lng['menue']['phpsettings']['maintitle']}
|
||||
</h2>
|
||||
</header>
|
||||
|
||||
<section>
|
||||
|
||||
<div class="overviewadd">
|
||||
<img src="templates/{$theme}/assets/img/icons/add.png" alt="" />
|
||||
<a href="{$linker->getLink(array('section' => 'phpsettings', 'page' => $page, 'action' => 'add'))}">{$lng['admin']['phpsettings']['addnew']}</a>
|
||||
</div>
|
||||
|
||||
<table class="full hl">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{$lng['admin']['phpsettings']['description']}</th>
|
||||
<th>{$lng['admin']['phpsettings']['activephpconfigs']}</th>
|
||||
<th>{$lng['serversettings']['phpfpm_settings']['reload']}</th>
|
||||
<th>{$lng['serversettings']['phpfpm_settings']['configdir']}</th>
|
||||
<th>{$lng['serversettings']['phpfpm_settings']['pm']}</th>
|
||||
<th>{$lng['panel']['options']}</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
$tablecontent
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<if 15 < $count>
|
||||
<div class="overviewadd">
|
||||
<img src="templates/{$theme}/assets/img/icons/add.png" alt="" />
|
||||
<a href="{$linker->getLink(array('section' => 'phpsettings', 'page' => $page, 'action' => 'add'))}">{$lng['admin']['phpsettings']['addnew']}</a>
|
||||
</div>
|
||||
</if>
|
||||
|
||||
</section>
|
||||
|
||||
</article>
|
||||
$footer
|
||||
17
templates/Sparkle/admin/phpconfig/fpmdaemons_overview.tpl
vendored
Normal file
17
templates/Sparkle/admin/phpconfig/fpmdaemons_overview.tpl
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<tr class="top">
|
||||
<td><strong>{$row['description']}</strong></td>
|
||||
<td>{$configs}</td>
|
||||
<td>{$row['reload_cmd']}</td>
|
||||
<td>{$row['config_dir']}</td>
|
||||
<td>{$row['pm']}</td>
|
||||
<td>
|
||||
<a href="{$linker->getLink(array('section' => 'phpsettings', 'page' => $page, 'action' => 'edit', 'id' => $row['id']))}">
|
||||
<img src="templates/{$theme}/assets/img/icons/edit.png" alt="{$lng['panel']['edit']}" title="{$lng['panel']['edit']}" />
|
||||
</a>
|
||||
<if $row['id'] != 1>
|
||||
<a href="{$linker->getLink(array('section' => 'phpsettings', 'page' => $page, 'action' => 'delete', 'id' => $row['id']))}">
|
||||
<img src="templates/{$theme}/assets/img/icons/delete.png" alt="{$lng['panel']['delete']}" title="{$lng['panel']['delete']}" />
|
||||
</a>
|
||||
</if>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -19,7 +19,11 @@ $header
|
||||
<tr>
|
||||
<th>{$lng['admin']['phpsettings']['description']}</th>
|
||||
<th>{$lng['admin']['phpsettings']['activedomains']}</th>
|
||||
<if Settings::Get('phpfpm.enabled') == '1'>
|
||||
<th>{$lng['admin']['phpsettings']['fpmdesc']}</th>
|
||||
<else>
|
||||
<th>{$lng['admin']['phpsettings']['binary']}</th>
|
||||
</if>
|
||||
<th>{$lng['admin']['phpsettings']['file_extensions']}</th>
|
||||
<th>{$lng['panel']['options']}</th>
|
||||
</thead>
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
<tr class="top">
|
||||
<td><strong>{$row['description']}</strong></td>
|
||||
<td>{$domains}</td>
|
||||
<if Settings::Get('phpfpm.enabled') == '1'>
|
||||
<td>{$row['fpmdesc']}</td>
|
||||
<else>
|
||||
<td>{$row['binary']}</td>
|
||||
</if>
|
||||
<td>{$row['file_extensions']}</td>
|
||||
<td>
|
||||
<a href="{$linker->getLink(array('section' => 'phpsettings', 'page' => $page, 'action' => 'edit', 'id' => $row['id']))}">
|
||||
|
||||
Reference in New Issue
Block a user