minor fixes to fpm/php resources-forms and language-strings

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-10-13 16:53:36 +02:00
parent 52857c208a
commit 6953d0f883
7 changed files with 36 additions and 14 deletions

View File

@@ -203,6 +203,11 @@ class FpmDaemons extends ApiCommand implements ResourceEntity
// validation // validation
$description = Validate::validate($description, 'description', Validate::REGEX_DESC_TEXT, '', [], true); $description = Validate::validate($description, 'description', Validate::REGEX_DESC_TEXT, '', [], true);
$reload_cmd = Validate::validate($reload_cmd, 'reload_cmd', '', '', [], true); $reload_cmd = Validate::validate($reload_cmd, 'reload_cmd', '', '', [], true);
$sel_stmt = Database::prepare("SELECT `id` FROM `".TABLE_PANEL_FPMDAEMONS."` WHERE `reload_cmd` = :rc");
$dupcheck = Database::pexecute_first($sel_stmt, ['rc' => $reload_cmd]);
if ($dupcheck && $dupcheck['id']) {
throw new Exception("PHP-FPM version with the given restart command already exists", 406);
}
$config_dir = Validate::validate($config_dir, 'config_dir', Validate::REGEX_DIR, '', [], true); $config_dir = Validate::validate($config_dir, 'config_dir', Validate::REGEX_DIR, '', [], true);
if (!in_array($pmanager, [ if (!in_array($pmanager, [
'static', 'static',
@@ -323,6 +328,11 @@ class FpmDaemons extends ApiCommand implements ResourceEntity
// validation // validation
$description = Validate::validate($description, 'description', Validate::REGEX_DESC_TEXT, '', [], true); $description = Validate::validate($description, 'description', Validate::REGEX_DESC_TEXT, '', [], true);
$reload_cmd = Validate::validate($reload_cmd, 'reload_cmd', '', '', [], true); $reload_cmd = Validate::validate($reload_cmd, 'reload_cmd', '', '', [], true);
$sel_stmt = Database::prepare("SELECT `id` FROM `".TABLE_PANEL_FPMDAEMONS."` WHERE `reload_cmd` = :rc");
$dupcheck = Database::pexecute_first($sel_stmt, ['rc' => $reload_cmd]);
if ($dupcheck && $dupcheck['id'] != $id) {
throw new Exception("PHP-FPM version with the given restart command already exists", 406);
}
$config_dir = Validate::validate($config_dir, 'config_dir', Validate::REGEX_DIR, '', [], true); $config_dir = Validate::validate($config_dir, 'config_dir', Validate::REGEX_DIR, '', [], true);
if (!in_array($pmanager, [ if (!in_array($pmanager, [
'static', 'static',

View File

@@ -25,30 +25,33 @@
return [ return [
'fpmconfig_add' => [ 'fpmconfig_add' => [
'title' => lng('admin.phpsettings.addsettings'), 'title' => lng('admin.fpmsettings.addnew'),
'image' => 'fa-solid fa-plus', 'image' => 'fa-solid fa-plus',
'self_overview' => ['section' => 'phpsettings', 'page' => 'fpmdaemons'], 'self_overview' => ['section' => 'phpsettings', 'page' => 'fpmdaemons'],
'sections' => [ 'sections' => [
'section_a' => [ 'section_a' => [
'title' => lng('admin.phpsettings.addsettings'), 'title' => lng('admin.fpmsettings.addnew'),
'image' => 'icons/phpsettings_add.png', 'image' => 'icons/phpsettings_add.png',
'fields' => [ 'fields' => [
'description' => [ 'description' => [
'label' => lng('admin.phpsettings.description'), 'label' => lng('admin.phpsettings.description'),
'type' => 'text', 'type' => 'text',
'maxlength' => 50 'maxlength' => 50,
'mandatory' => true
], ],
'reload_cmd' => [ 'reload_cmd' => [
'label' => lng('serversettings.phpfpm_settings.reload'), 'label' => lng('serversettings.phpfpm_settings.reload'),
'type' => 'text', 'type' => 'text',
'maxlength' => 255, 'maxlength' => 255,
'value' => 'service php7.4-fpm restart' 'value' => 'service php7.4-fpm restart',
'mandatory' => true
], ],
'config_dir' => [ 'config_dir' => [
'label' => lng('serversettings.phpfpm_settings.configdir'), 'label' => lng('serversettings.phpfpm_settings.configdir'),
'type' => 'text', 'type' => 'text',
'maxlength' => 255, 'maxlength' => 255,
'value' => '/etc/php/7.4/fpm/pool.d/' 'value' => '/etc/php/7.4/fpm/pool.d/',
'mandatory' => true
], ],
'pm' => [ 'pm' => [
'label' => lng('serversettings.phpfpm_settings.pm'), 'label' => lng('serversettings.phpfpm_settings.pm'),

View File

@@ -25,31 +25,34 @@
return [ return [
'fpmconfig_edit' => [ 'fpmconfig_edit' => [
'title' => lng('admin.phpsettings.editsettings'), 'title' => lng('admin.fpmsettings.edit'),
'image' => 'fa-solid fa-pen', 'image' => 'fa-solid fa-pen',
'self_overview' => ['section' => 'phpsettings', 'page' => 'fpmdaemons'], 'self_overview' => ['section' => 'phpsettings', 'page' => 'fpmdaemons'],
'sections' => [ 'sections' => [
'section_a' => [ 'section_a' => [
'title' => lng('admin.phpsettings.editsettings'), 'title' => lng('admin.fpmsettings.edit'),
'image' => 'icons/phpsettings_edit.png', 'image' => 'icons/phpsettings_edit.png',
'fields' => [ 'fields' => [
'description' => [ 'description' => [
'label' => lng('admin.phpsettings.description'), 'label' => lng('admin.phpsettings.description'),
'type' => 'text', 'type' => 'text',
'maxlength' => 50, 'maxlength' => 50,
'value' => $result['description'] 'value' => $result['description'],
'mandatory' => true
], ],
'reload_cmd' => [ 'reload_cmd' => [
'label' => lng('serversettings.phpfpm_settings.reload'), 'label' => lng('serversettings.phpfpm_settings.reload'),
'type' => 'text', 'type' => 'text',
'maxlength' => 255, 'maxlength' => 255,
'value' => $result['reload_cmd'] 'value' => $result['reload_cmd'],
'mandatory' => true
], ],
'config_dir' => [ 'config_dir' => [
'label' => lng('serversettings.phpfpm_settings.configdir'), 'label' => lng('serversettings.phpfpm_settings.configdir'),
'type' => 'text', 'type' => 'text',
'maxlength' => 255, 'maxlength' => 255,
'value' => $result['config_dir'] 'value' => $result['config_dir'],
'mandatory' => true
], ],
'pm' => [ 'pm' => [
'label' => lng('serversettings.phpfpm_settings.pm'), 'label' => lng('serversettings.phpfpm_settings.pm'),

View File

@@ -38,7 +38,8 @@ return [
'description' => [ 'description' => [
'label' => lng('admin.phpsettings.description'), 'label' => lng('admin.phpsettings.description'),
'type' => 'text', 'type' => 'text',
'maxlength' => 50 'maxlength' => 50,
'mandatory' => true
], ],
'binary' => [ 'binary' => [
'visible' => Settings::Get('system.mod_fcgid') == 1, 'visible' => Settings::Get('system.mod_fcgid') == 1,
@@ -179,7 +180,8 @@ return [
'type' => 'textarea', 'type' => 'textarea',
'cols' => 80, 'cols' => 80,
'rows' => 20, 'rows' => 20,
'value' => $result['phpsettings'] 'value' => $result['phpsettings'],
'mandatory' => true
], ],
'allow_all_customers' => [ 'allow_all_customers' => [
'label' => lng('serversettings.phpfpm_settings.allow_all_customers.title'), 'label' => lng('serversettings.phpfpm_settings.allow_all_customers.title'),

View File

@@ -39,7 +39,8 @@ return [
'label' => lng('admin.phpsettings.description'), 'label' => lng('admin.phpsettings.description'),
'type' => 'text', 'type' => 'text',
'maxlength' => 50, 'maxlength' => 50,
'value' => $result['description'] 'value' => $result['description'],
'mandatory' => true
], ],
'binary' => [ 'binary' => [
'visible' => Settings::Get('system.mod_fcgid') == 1, 'visible' => Settings::Get('system.mod_fcgid') == 1,
@@ -182,7 +183,8 @@ return [
'type' => 'textarea', 'type' => 'textarea',
'cols' => 80, 'cols' => 80,
'rows' => 20, 'rows' => 20,
'value' => $result['phpsettings'] 'value' => $result['phpsettings'],
'mandatory' => true
], ],
'allow_all_customers' => [ 'allow_all_customers' => [
'label' => lng('serversettings.phpfpm_settings.allow_all_customers.title'), 'label' => lng('serversettings.phpfpm_settings.allow_all_customers.title'),

View File

@@ -301,6 +301,7 @@ return [
'misc' => 'Sonstiges', 'misc' => 'Sonstiges',
'fpmsettings' => [ 'fpmsettings' => [
'addnew' => 'Neue PHP Version erstellen', 'addnew' => 'Neue PHP Version erstellen',
'edit' => 'PHP version bearbeiten',
], ],
'phpconfig' => [ 'phpconfig' => [
'template_replace_vars' => 'Variablen, die in den Konfigurationen ersetzt werden', 'template_replace_vars' => 'Variablen, die in den Konfigurationen ersetzt werden',

View File

@@ -306,6 +306,7 @@ return [
'misc' => 'Miscellaneous', 'misc' => 'Miscellaneous',
'fpmsettings' => [ 'fpmsettings' => [
'addnew' => 'Create new PHP version', 'addnew' => 'Create new PHP version',
'edit' => 'Change PHP version'
], ],
'phpconfig' => [ 'phpconfig' => [
'template_replace_vars' => 'Variables that will be replaced in the configs', 'template_replace_vars' => 'Variables that will be replaced in the configs',