Skip to content

Commit 36e7be7

Browse files
author
Till Brehm
committed
Merge branch '5464-use-unique-id-for-additional-php-selection-in-website' into 'stable-3.1'
Resolve "Use unique id for additional php selection in website" See merge request ispconfig/ispconfig3!1068
2 parents c00edf2 + 5f7507f commit 36e7be7

File tree

137 files changed

+403
-398
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+403
-398
lines changed

install/sql/incremental/upd_dev_collection.sql

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ ALTER TABLE `web_domain` DROP COLUMN `enable_spdy`;
4545
-- was missing in incremental, inserted for fixing older installations
4646
ALTER TABLE `web_domain` ADD `folder_directive_snippets` TEXT NULL AFTER `https_port`;
4747

48+
ALTER TABLE `web_domain` ADD `server_php_id` INT(11) UNSIGNED NOT NULL DEFAULT 0;
49+
50+
UPDATE `web_domain` as w LEFT JOIN sys_group as g ON (g.groupid = w.sys_groupid) INNER JOIN `server_php` as p ON (w.fastcgi_php_version = CONCAT(p.name, ':', p.php_fastcgi_binary, ':', p.php_fastcgi_ini_dir) AND p.server_id IN (0, w.server_id) AND p.client_id IN (0, g.client_id)) SET w.server_php_id = p.server_php_id, w.fastcgi_php_version = '' WHERE 1;
51+
52+
UPDATE `web_domain` as w LEFT JOIN sys_group as g ON (g.groupid = w.sys_groupid) INNER JOIN `server_php` as p ON (w.fastcgi_php_version = CONCAT(p.name, ':', p.php_fpm_init_script, ':', p.php_fpm_ini_dir, ':', p.php_fpm_pool_dir) AND p.server_id IN (0, w.server_id) AND p.client_id IN (0, g.client_id)) SET w.server_php_id = p.server_php_id, w.fastcgi_php_version = '' WHERE 1;
53+
54+
-- we have to decide whether to delete the column or leave it there for investigating not-converted entries
55+
-- ALTER TABLE `web_domain` DROP COLUMN `fastcgi_php_version`;
56+
4857
ALTER TABLE `web_domain` CHANGE `apache_directives` `apache_directives` mediumtext NULL DEFAULT NULL;
4958
ALTER TABLE `web_domain` CHANGE `nginx_directives` `nginx_directives` mediumtext NULL DEFAULT NULL;
5059

interface/web/admin/server_php_del.php

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -52,33 +52,18 @@
5252
class page_action extends tform_actions {
5353

5454
function onBeforeDelete() {
55-
global $app; $conf;
55+
global $app;
5656

57-
$check = array();
58-
59-
// fastcgi
60-
if(!empty(trim($this->dataRecord['php_fastcgi_binary']))) $check[] = trim($this->dataRecord['php_fastcgi_binary']);
61-
if(!empty(trim($this->dataRecord['php_fastcgi_ini_dir']))) $check[] = trim($this->dataRecord['php_fastcgi_ini_dir']);
62-
if(!empty($check)) $fastcgi_check = implode(':', $check);
63-
unset($check);
64-
65-
// fpm
66-
if(!empty(trim($this->dataRecord['php_fpm_init_script']))) $check[] = trim($this->dataRecord['php_fpm_init_script']);
67-
if(!empty(trim($this->dataRecord['php_fpm_ini_dir']))) $check[] = trim($this->dataRecord['php_fpm_ini_dir']);
68-
if(!empty(trim($this->dataRecord['php_fpm_pool_dir']))) $check[] = trim($this->dataRecord['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'));
57+
$sql = 'SELECT domain_id FROM web_domain WHERE server_id = ? AND server_php_id = ?';
58+
$web_domains = $app->db->queryAllRecords($sql, $this->dataRecord['server_id'], $this->id);
7659

60+
if(!empty($web_domains)) {
61+
$app->error($app->tform->lng('php_in_use_error'));
62+
}
7763
}
7864

7965
}
8066

8167
$page = new page_action;
8268
$page->onDelete();
8369

84-
?>

interface/web/admin/server_php_edit.php

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -51,36 +51,10 @@
5151

5252
class page_action extends tform_actions {
5353
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-
}
78-
7954
parent::onSubmit();
80-
8155
}
8256
function onBeforeUpdate() {
83-
global $app, $conf;
57+
global $app;
8458

8559
//* Check if the server has been changed
8660
// We do this only for the admin or reseller users, as normal clients can not change the server ID anyway
@@ -99,5 +73,3 @@ function onBeforeUpdate() {
9973

10074
$page = new page_action;
10175
$page->onLoad();
102-
103-
?>

interface/web/admin/server_php_list.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
$app->listform_actions->SQLExtSelect = "(SELECT
5252
COUNT(w.server_id)
5353
FROM
54-
server_php s LEFT JOIN web_domain w ON (w.fastcgi_php_version LIKE CONCAT(s.name, '%') AND s.server_id=w.server_id)
54+
server_php s LEFT JOIN web_domain w ON (w.server_php_id = s.server_php_id AND s.server_id=w.server_id)
5555
WHERE
5656
server_php.server_php_id=s.server_php_id
5757
GROUP BY
@@ -60,5 +60,3 @@
6060

6161
$app->listform_actions->onLoad();
6262

63-
64-
?>

interface/web/sites/form/web_vhost_domain.tform.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,10 @@
254254
'value' => array('no' => 'disabled_txt', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM', 'hhvm' => 'HHVM'),
255255
'searchable' => 2
256256
),
257-
'fastcgi_php_version' => array (
258-
'datatype' => 'VARCHAR',
257+
'server_php_id' => array (
258+
'datatype' => 'INTEGER',
259259
'formtype' => 'SELECT',
260-
'default' => '',
260+
'default' => '0',
261261
/*'datasource' => array ( 'type' => 'SQL',
262262
'querystring' => "SELECT ip_address,ip_address FROM server_ip WHERE ip_type = 'IPv4' AND {AUTHSQL} ORDER BY ip_address",
263263
'keyfield'=> 'ip_address',

interface/web/sites/lib/lang/ar_web_aliasdomain.lng

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ $wb['pm_min_spare_servers_error_regex'] = 'PHP-FPM pm.min_spare_servers must be
9595
$wb['pm_max_spare_servers_error_regex'] = 'PHP-FPM pm.max_spare_servers must be a positive integer value.';
9696
$wb['hd_quota_error_regex'] = 'Harddisk quota is invalid.';
9797
$wb['traffic_quota_error_regex'] = 'Traffic quota is invalid.';
98-
$wb['fastcgi_php_version_txt'] = 'PHP Version';
98+
$wb['server_php_id_txt'] = 'PHP Version';
9999
$wb['pm_txt'] = 'PHP-FPM Process Manager';
100100
$wb['pm_process_idle_timeout_txt'] = 'PHP-FPM pm.process_idle_timeout';
101101
$wb['pm_max_requests_txt'] = 'PHP-FPM pm.max_requests';

interface/web/sites/lib/lang/ar_web_childdomain.lng

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ $wb['pm_min_spare_servers_error_regex'] = 'PHP-FPM pm.min_spare_servers must be
101101
$wb['pm_max_spare_servers_error_regex'] = 'PHP-FPM pm.max_spare_servers must be a positive integer value.';
102102
$wb['hd_quota_error_regex'] = 'Harddisk quota is invalid.';
103103
$wb['traffic_quota_error_regex'] = 'Traffic quota is invalid.';
104-
$wb['fastcgi_php_version_txt'] = 'PHP Version';
104+
$wb['server_php_id_txt'] = 'PHP Version';
105105
$wb['pm_txt'] = 'PHP-FPM Process Manager';
106106
$wb['pm_process_idle_timeout_txt'] = 'PHP-FPM pm.process_idle_timeout';
107107
$wb['pm_max_requests_txt'] = 'PHP-FPM pm.max_requests';

interface/web/sites/lib/lang/ar_web_domain.lng

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ $wb['hd_quota_error_regex'] = 'Harddisk quota is invalid.';
9393
$wb['traffic_quota_error_regex'] = 'Traffic quota is invalid.';
9494
$wb['ssl_key_txt'] = 'SSL Key';
9595
$wb['perl_txt'] = 'Perl';
96-
$wb['fastcgi_php_version_txt'] = 'PHP Version';
96+
$wb['server_php_id_txt'] = 'PHP Version';
9797
$wb['pm_txt'] = 'PHP-FPM Process Manager';
9898
$wb['pm_process_idle_timeout_txt'] = 'PHP-FPM pm.process_idle_timeout';
9999
$wb['pm_max_requests_txt'] = 'PHP-FPM pm.max_requests';

interface/web/sites/lib/lang/ar_web_vhost_domain.lng

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ $wb['hd_quota_error_regex'] = 'Harddisk quota is invalid.';
9696
$wb['traffic_quota_error_regex'] = 'Traffic quota is invalid.';
9797
$wb['ssl_key_txt'] = 'SSL Key';
9898
$wb['perl_txt'] = 'Perl';
99-
$wb['fastcgi_php_version_txt'] = 'PHP Version';
100-
$wb['fastcgi_php_version_invalid_txt'] = 'PHP Version is invalid.';
101-
$wb['fastcgi_php_version_default_hidden_warning_txt'] = 'PHP Version was set to "default" but that can no longer be selected. Choose your desired PHP Version and save your settings.';
99+
$wb['server_php_id_txt'] = 'PHP Version';
100+
$wb['server_php_id_invalid_txt'] = 'PHP Version is invalid.';
101+
$wb['server_php_id_default_hidden_warning_txt'] = 'PHP Version was set to "default" but that can no longer be selected. Choose your desired PHP Version and save your settings.';
102102
$wb['pm_txt'] = 'PHP-FPM Process Manager';
103103
$wb['pm_process_idle_timeout_txt'] = 'PHP-FPM pm.process_idle_timeout';
104104
$wb['pm_max_requests_txt'] = 'PHP-FPM pm.max_requests';

interface/web/sites/lib/lang/ar_web_vhost_subdomain.lng

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ $wb['pm_min_spare_servers_error_regex'] = 'PHP-FPM pm.min_spare_servers must be
9999
$wb['pm_max_spare_servers_error_regex'] = 'PHP-FPM pm.max_spare_servers must be a positive integer value.';
100100
$wb['hd_quota_error_regex'] = 'Harddisk quota is invalid.';
101101
$wb['traffic_quota_error_regex'] = 'Traffic quota is invalid.';
102-
$wb['fastcgi_php_version_txt'] = 'PHP Version';
102+
$wb['server_php_id_txt'] = 'PHP Version';
103103
$wb['pm_txt'] = 'PHP-FPM Process Manager';
104104
$wb['pm_process_idle_timeout_txt'] = 'PHP-FPM pm.process_idle_timeout';
105105
$wb['pm_max_requests_txt'] = 'PHP-FPM pm.max_requests';

0 commit comments

Comments
 (0)