Skip to content

Commit e22ff4f

Browse files
author
Till Brehm
committed
Merge branch 'server_php_id' into 'stable-3.1'
set server_php_id in ajax_get_json.php See merge request ispconfig/ispconfig3!1082
2 parents ca4248c + 8e4dfea commit e22ff4f

File tree

2 files changed

+31
-21
lines changed

2 files changed

+31
-21
lines changed

interface/web/sites/ajax_get_json.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
$json .= '"}';
6464
}
6565

66-
if($type == 'getphpfastcgi'){
66+
if($type == 'getserverphp'){
6767
$json = '{';
6868

6969
$server_type = 'apache';
@@ -105,14 +105,14 @@
105105
if(is_array($php_records) && !empty($php_records)) {
106106
foreach( $php_records as $php_record) {
107107
if($php_type == 'php-fpm' || ($php_type == 'hhvm' && $server_type == 'nginx')){
108-
$php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir'];
108+
$php_version = $php_record['server_php_id'];
109109
} else {
110-
$php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir'];
110+
$php_version = $php_record['server_php_id'];
111111
}
112112
if($php_record['name'] != $web_config['php_default_name']) {
113113
$json .= '"'.$php_version.'": "'.$php_record['name'].'",';
114114
} else {
115-
$json .= '"": "'.$php_record['name'].'",';
115+
$json .= '"0": "'.$php_record['name'].'",';
116116
}
117117
}
118118
}

interface/web/sites/templates/web_vhost_domain_edit.htm

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -280,26 +280,31 @@
280280
serverId = $(this).val();
281281
adjustForm();
282282
reloadWebIP();
283-
reloadFastcgiPHPVersions();
283+
reloadServerPHPVersions();
284284
reloadDirectiveSnippets();
285285
});
286286
}
287287
adjustForm(true);
288-
reloadFastcgiPHPVersions(true);
288+
reloadServerPHPVersions(true);
289289

290290
jQuery('#client_group_id').change(function(){
291291
clientGroupId = $(this).val();
292292
reloadWebIP();
293-
reloadFastcgiPHPVersions();
293+
reloadServerPHPVersions();
294294
});
295295

296296
if(jQuery('#php').val() == 'fast-cgi' || jQuery('#php').val() == 'php-fpm' || (jQuery('#php').val() == 'hhvm' && serverType == 'nginx')){
297297
jQuery('.server_php_id:hidden').show();
298+
// This block can be removed?
298299
if(jQuery('#php').val() == 'hhvm'){
300+
// There is no element with id="server_php_id_txt"
299301
jQuery('#server_php_id_txt').hide();
302+
// There is no element with id="#fastcgi_php_fallback_version_txt"
300303
jQuery('#fastcgi_php_fallback_version_txt').show();
301304
} else {
305+
// There is no element with id="server_php_id_txt"
302306
jQuery('#server_php_id_txt').show();
307+
// There is no element with id="#fastcgi_php_fallback_version_txt"
303308
jQuery('#fastcgi_php_fallback_version_txt').hide();
304309
}
305310
} else {
@@ -308,14 +313,19 @@
308313
//ISPConfig.resetFormChanged();
309314

310315
jQuery('#php').change(function(){
311-
reloadFastcgiPHPVersions();
316+
reloadServerPHPVersions();
312317
if(jQuery(this).val() == 'fast-cgi' || jQuery(this).val() == 'php-fpm' || (jQuery(this).val() == 'hhvm' && serverType == 'nginx')){
313318
jQuery('.server_php_id:hidden').show();
319+
// This block can be removed?
314320
if(jQuery(this).val() == 'hhvm'){
321+
// There is no element with id="server_php_id_txt"
315322
jQuery('#server_php_id_txt').hide();
323+
// There is no element with id="#fastcgi_php_fallback_version_txt"
316324
jQuery('#fastcgi_php_fallback_version_txt').show();
317325
} else {
326+
// There is no element with id="server_php_id_txt"
318327
jQuery('#server_php_id_txt').show();
328+
// There is no element with id="#fastcgi_php_fallback_version_txt"
319329
jQuery('#fastcgi_php_fallback_version_txt').hide();
320330
}
321331
} else {
@@ -348,7 +358,7 @@
348358
jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {web_id : parentWebId, type : "getserverid"}, function(data) {
349359
if(data.serverid) serverId = data.serverid;
350360
adjustForm(noFormChange);
351-
if(noFormChange) reloadFastcgiPHPVersions(noFormChange);
361+
if(noFormChange) reloadServerPHPVersions(noFormChange);
352362
});
353363
}
354364

@@ -438,33 +448,33 @@
438448
$('#'+elem).select2();
439449
}
440450

441-
function reloadFastcgiPHPVersions(noFormChange) {
442-
jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {server_id : serverId, php_type : jQuery('#php').val(), type : "getphpfastcgi", client_group_id : clientGroupId}, function(data) {
451+
function reloadServerPHPVersions(noFormChange) {
452+
jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {server_id : serverId, php_type : jQuery('#php').val(), type : "getserverphp", client_group_id : clientGroupId}, function(data) {
443453
//var options = '<option value="">Default</option>';
444454
var options = '';
445-
var phpfastcgiselected = '';
455+
var serverphpidselected = '';
446456
$.each(data, function(key, val) {
447457
<tmpl_if name="id">
448458
if($('#server_php_id').val() == key){
449-
phpfastcgiselected = ' selected="selected"';
459+
serverphpidselected = ' selected="selected"';
450460
} else {
451-
phpfastcgiselected = '';
461+
serverphpidselected = '';
452462
}
453463
</tmpl_else>
454-
phpfastcgiselected = '';
464+
serverphpidselected = '';
455465
</tmpl_if>
456-
options += '<option value="'+key+'"'+phpfastcgiselected+'>'+val+'</option>';
466+
options += '<option value="'+key+'"'+serverphpidselected+'>'+val+'</option>';
457467
});
458468
<tmpl_if name="id">
459-
if($('#server_php_id').val() == ''){
460-
phpfastcgiselected = ' selected="selected"';
469+
if($('#server_php_id').val() == '0'){
470+
serverphpidselected = ' selected="selected"';
461471
} else {
462-
phpfastcgiselected = '';
472+
serverphpidselected = '';
463473
}
464474
</tmpl_else>
465-
phpfastcgiselected = '';
475+
serverphpidselected = '';
466476
</tmpl_if>
467-
//options += '<option value=""'+phpfastcgiselected+'>{tmpl_var name="default_php_txt"}</option>';
477+
//options += '<option value=""'+serverphpidselected+'>{tmpl_var name="default_php_txt"}</option>';
468478
$('#server_php_id').html(options).change();
469479
if(noFormChange) ISPConfig.resetFormChanged();
470480
});

0 commit comments

Comments
 (0)