Skip to content

Commit b450032

Browse files
committed
disable change the name of an additional-version which is still in use
1 parent 1e3cfdd commit b450032

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

interface/web/admin/lib/lang/de_server_php.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ $wb['php_fpm_ini_dir_txt'] = 'Pfad zum php.ini Verzeichnis';
1515
$wb['php_fpm_pool_dir_txt'] = 'Pfad zum PHP-FPM Pool Verzeichnis';
1616
$wb['active_txt'] = 'Aktiv';
1717
$wb['php_in_use_error'] = 'Diese PHP-Version wird noch benutzt.';
18+
$wb['php_name_in_use_error'] = 'Der Name kann nicht geändert werden.';
1819
?>

interface/web/admin/lib/lang/en_server_php.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ $wb['php_fpm_ini_dir_txt'] = 'Path to the php.ini directory';
1515
$wb['php_fpm_pool_dir_txt'] = 'Path to the PHP-FPM pool directory';
1616
$wb['active_txt'] = 'Active';
1717
$wb['php_in_use_error'] = 'This PHP-Version is in use.';
18+
$wb['php_name_in_use_error'] = 'The name can not be changed.';
1819
?>

interface/web/admin/server_php_edit.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,35 @@
5050
$app->load('tform_actions');
5151

5252
class page_action extends tform_actions {
53+
function onSubmit() {
54+
global $app;
55+
56+
if(isset($this->id) && $this->id > 0 && $app->tform->getCurrentTab() == 'php_name') {
57+
$rec = $app->db->queryOneRecord('SELECT * FROM server_php WHERE server_php_id = ?', $this->id);
58+
if($rec['name'] != $this->dataRecord['name']) {
59+
$check = array();
60+
// fastcgi
61+
if($rec['php_fastcgi_binary'] != '') $check[] = $rec['php_fastcgi_binary'];
62+
if($rec['php_fastcgi_ini_dir'] != '') $check[] = $rec['php_fastcgi_ini_dir'];
63+
if(!empty($check)) $fastcgi_check = implode(':', $check);
64+
unset($check);
65+
// fpm
66+
if($rec['php_fpm_init_script'] != '') $check[] = $rec['php_fpm_init_script'];
67+
if($rec['php_fpm_ini_dir'] != '') $check[] = $rec['php_fpm_ini_dir'];
68+
if($rec['php_fpm_pool_dir'] != '') $check[] = $rec['php_fpm_pool_dir'];
69+
if(!empty($check)) $fpm_check = implode(':', $check);
70+
71+
$sql = 'SELECT domain_id FROM web_domain WHERE server_id = ? AND fastcgi_php_version LIKE ?';
72+
if(isset($fastcgi_check)) $web_domains_fastcgi = $app->db->queryAllRecords($sql, $this->dataRecord['server_id'], '%:'.$fastcgi_check);
73+
if(isset($fpm_check)) $web_domains_fpm = $app->db->queryAllRecords($sql, $this->dataRecord['server_id'], '%:'.$fpm_check);
74+
75+
if(!empty($webdomains_fastcgi) || !empty($web_domains_fpm)) $app->error($app->tform->lng('php_in_use_error').' '.$app->tform->lng('php_name_in_use_error'));
76+
}
77+
}
5378

79+
parent::onSubmit();
80+
81+
}
5482
function onBeforeUpdate() {
5583
global $app, $conf;
5684

0 commit comments

Comments
 (0)