Fix /edit/server/ always says database unsupported

This commit is contained in:
Flat 2016-07-03 15:09:32 +09:00
commit 6faead081b
3 changed files with 65 additions and 71 deletions

View file

@ -28,12 +28,12 @@ json_list() {
fi
done
echo "{"
echo "["
for type in $(echo $DB_SYSTEM |sed -e 's/,/\n/'); do
if [ -e "$VESTA/conf/$type.conf" ]; then
for str in $(cat $VESTA/conf/$type.conf); do
eval $str
echo -n ' "'$HOST'": {
echo -n ' {
"HOST": "'$HOST'",
"TYPE": "'$type'",
"CHARSETS": "'$CHARSETS'",
@ -54,7 +54,7 @@ json_list() {
done
fi
done
echo '}'
echo ']'
}
# SHELL list function

View file

@ -46,21 +46,15 @@ foreach ($dns_cluster as $key => $value) {
$v_dns_cluster = 'yes';
}
// List MySQL hosts
exec (VESTA_CMD."v-list-database-hosts mysql json", $output, $return_var);
$v_mysql_hosts = json_decode(implode('', $output), true);
// List Database hosts
exec (VESTA_CMD."v-list-database-hosts json", $output, $return_var);
$db_hosts = json_decode(implode('', $output), true);
unset($output);
foreach ($v_mysql_hosts as $key => $value) {
$v_mysql = 'yes';
}
// List PostgreSQL hosts
exec (VESTA_CMD."v-list-database-hosts pgsql json", $output, $return_var);
$v_pgsql_hosts = json_decode(implode('', $output), true);
unset($output);
foreach ($v_pgsql_hosts as $key => $value) {
$v_pgsql = 'yes';
}
$v_mysql_hosts = array_values(array_filter($db_hosts, function($host){return $host['TYPE'] === 'mysql';}));
$v_mysql = count($v_mysql_hosts) ? 'yes' : 'no';
$v_pgsql_hosts = array_values(array_filter($db_hosts, function($host){return $host['TYPE'] === 'pgsql';}));
$v_pgsql = count($v_pgsql_hosts) ? 'yes' : 'no';
unset($db_hosts);
// List backup settings
$v_backup_dir = "/backup";

View file

@ -54,7 +54,7 @@
<table class="data-col2" width="600px">
<tr>
<td class="vst-text step-top">
<?php print __('Hostname') ?>
<?php print __('Hostname') ?>
</td>
</tr>
<tr>
@ -82,7 +82,7 @@
}
echo ">".$value."</option>\n";
}
?>
?>
</select>
<br><br>
</td>
@ -106,7 +106,7 @@
}
echo ">".$value."</option>\n";
}
?>
?>
</select>
<br><br>
</td>
@ -121,10 +121,10 @@
<tr>
<td class="vst-text input-label step-left">
<table style="display:<?php if (empty($v_adv)) echo 'none';?> ;" id="web">
<?php if (!empty($_SESSION['PROXY_SYSTEM'])) { ?>
<?php if (!empty($_SESSION['PROXY_SYSTEM'])) { ?>
<tr>
<td class="vst-text">
<?php print __('Proxy Server') ?>
<?php print __('Proxy Server') ?>
</td>
</tr>
<tr>
@ -133,10 +133,10 @@
<br><br>
</td>
</tr>
<?php } ?>
<?php } ?>
<tr>
<td class="vst-text">
<?php print __('Web Server') ?>
<?php print __('Web Server') ?>
</td>
</tr>
<tr>
@ -145,10 +145,10 @@
<br><br>
</td>
</tr>
<?php if (!empty($_SESSION['WEB_BACKEND'])) { ?>
<?php if (!empty($_SESSION['WEB_BACKEND'])) { ?>
<tr>
<td class="vst-text">
<?php print __('Backend Server') ?>
<?php print __('Backend Server') ?>
</td>
</tr>
<tr>
@ -159,7 +159,7 @@
</tr>
<tr>
<td class="vst-text">
<?php print __('Backend Pool Mode') ?>
<?php print __('Backend Pool Mode') ?>
</td>
</tr>
<tr>
@ -169,7 +169,7 @@
</td>
</tr>
<?php } ?>
<?php } ?>
</table>
</td>
</tr>
@ -187,7 +187,7 @@
<table style="display:<?php if (empty($v_adv)) echo 'none';?> ;" id="dns">
<tr>
<td class="vst-text">
<?php print __('DNS Server') ?>
<?php print __('DNS Server') ?>
</td>
</tr>
<tr>
@ -215,10 +215,10 @@
$i = 0;
foreach ($dns_cluster as $key => $value) {
$i++;
?>
?>
<tr>
<td class="vst-text step-left">
<?php print __('Host'). ' #'.$i ?>
<?php print __('Host'). ' #'.$i ?>
</td>
</tr>
<tr>
@ -227,7 +227,7 @@
<br><br>
</td>
</tr>
<?php }} ?>
<?php }} ?>
</table>
</td>
</tr>
@ -245,7 +245,7 @@
<table style="display:<?php if (empty($v_mail_adv)) echo 'none';?> ;" id="mail">
<tr>
<td class="vst-text">
<?php print __('MAIL Server') ?>
<?php print __('MAIL Server') ?>
</td>
</tr>
<tr>
@ -254,10 +254,10 @@
<br><br>
</td>
</tr>
<?php if (!empty($_SESSION['ANTIVIRUS_SYSTEM'])) { ?>
<?php if (!empty($_SESSION['ANTIVIRUS_SYSTEM'])) { ?>
<tr>
<td class="vst-text">
<?php print __('Antivirus') ?>
<?php print __('Antivirus') ?>
</td>
</tr>
<tr>
@ -266,11 +266,11 @@
<br><br>
</td>
</tr>
<?php } ?>
<?php if (!empty($_SESSION['ANTISPAM_SYSTEM'])) { ?>
<?php } ?>
<?php if (!empty($_SESSION['ANTISPAM_SYSTEM'])) { ?>
<tr>
<td class="vst-text">
<?php print __('AntiSpam') ?>
<?php print __('AntiSpam') ?>
</td>
</tr>
<tr>
@ -279,10 +279,10 @@
<br><br>
</td>
</tr>
<?php } ?>
<?php } ?>
<tr>
<td class="vst-text">
<?php print __('Webmail URL') ?>
<?php print __('Webmail URL') ?>
</td>
</tr>
<tr>
@ -324,7 +324,7 @@
<?php if ($v_mysql == 'yes') { ?>
<tr>
<td class="vst-text">
<?php print __('phpMyAdmin URL') ?>
<?php print __('phpMyAdmin URL') ?>
</td>
</tr>
<tr>
@ -336,23 +336,23 @@
<?php } ?>
<?php if ($v_mysql == 'yes') {
$i = 0;
foreach ($v_mysql_hosts as $key => $value) {
foreach ($v_mysql_hosts as $value) {
$i++;
?>
?>
<tr>
<td class="vst-text step-left">
<?php print __('Host'). ' #'.$i ?>
<?php print __('Host'). ' #'.$i ?>
</td>
</tr>
<tr>
<td class="step-left">
<input type="text" size="20" class="vst-input" name="v_mysql_host" value="<?php echo $key; ?>" disabled>
<input type="text" size="20" class="vst-input" name="v_mysql_host" value="<?=$value['HOST']?>" disabled>
<br><br>
</td>
</tr>
<tr>
<td class="vst-text step-left">
<?php print __('Password') ?>
<?php print __('Password') ?>
</td>
</tr>
<tr>
@ -364,7 +364,7 @@
<tr>
<td class="vst-text step-left">
<?php print __('Maximum Number Of Databases') ?>
<?php print __('Maximum Number Of Databases') ?>
</td>
</tr>
<tr>
@ -375,7 +375,7 @@
</tr>
<tr>
<td class="vst-text step-left">
<?php print __('Current Number Of Databases') ?>
<?php print __('Current Number Of Databases') ?>
</td>
</tr>
<tr>
@ -384,7 +384,7 @@
<br><br><br><br>
</td>
</tr>
<?php }} ?>
<?php }} ?>
<tr>
@ -404,7 +404,7 @@
<?php if ($v_pgsql == 'yes') { ?>
<tr>
<td class="vst-text">
<?php print __('phpPgAdmin URL') ?>
<?php print __('phpPgAdmin URL') ?>
</td>
</tr>
<tr>
@ -416,23 +416,23 @@
<?php } ?>
<?php if ($v_pgsql == 'yes') {
$i = 0;
foreach ($v_pgsql_hosts as $key => $value) {
foreach ($v_pgsql_hosts as $value) {
$i++;
?>
?>
<tr>
<td class="vst-text step-left">
<?php print __('Host'). ' #'.$i ?>
<?php print __('Host'). ' #'.$i ?>
</td>
</tr>
<tr>
<td class="step-left">
<input type="text" size="20" class="vst-input" name="v_pgsql_host" value="<?php echo $key; ?>" disabled>
<input type="text" size="20" class="vst-input" name="v_pgsql_host" value="<?=$value['HOST']?>" disabled>
<br><br>
</td>
</tr>
<tr>
<td class="vst-text step-left">
<?php print __('Maximum Number Of Databases') ?>
<?php print __('Maximum Number Of Databases') ?>
</td>
</tr>
<tr>
@ -443,7 +443,7 @@
</tr>
<tr>
<td class="vst-text step-left">
<?php print __('Current Number Of Databases') ?>
<?php print __('Current Number Of Databases') ?>
</td>
</tr>
<tr>
@ -452,7 +452,7 @@
<br><br><br><br>
</td>
</tr>
<?php }} ?>
<?php }} ?>
</table>
</td>
</tr>
@ -470,7 +470,7 @@
<table style="display:<?php if (empty($v_backup_adv)) echo 'none';?> ;" id="backup">
<tr>
<td class="vst-text">
<?php print __('Local backup') ?>
<?php print __('Local backup') ?>
</td>
</tr>
<tr>
@ -484,7 +484,7 @@
</tr>
<tr>
<td class="vst-text">
<?php print __('Compression level') ?>
<?php print __('Compression level') ?>
</td>
</tr>
<tr>
@ -505,7 +505,7 @@
</tr>
<tr>
<td class="vst-text">
<?php print __('Directory') ?>
<?php print __('Directory') ?>
</td>
</tr>
<tr>
@ -524,7 +524,7 @@
<td class="vst-text input-label step-left">
<table style="display:<?php if (empty($v_backup_remote_adv)) echo 'none';?> ;" id="remote_backup">
<td class="vst-text">
<?php print __('Protocol') ?>
<?php print __('Protocol') ?>
</td>
</tr>
<tr>
@ -538,7 +538,7 @@
</tr>
<tr>
<td class="vst-text">
<?php print __('Host') ?>
<?php print __('Host') ?>
</td>
</tr>
<tr>
@ -549,7 +549,7 @@
</tr>
<tr>
<td class="vst-text">
<?php print __('Username') ?>
<?php print __('Username') ?>
</td>
</tr>
<tr>
@ -560,7 +560,7 @@
</tr>
<tr>
<td class="vst-text">
<?php print __('Password') ?>
<?php print __('Password') ?>
</td>
</tr>
<tr>
@ -571,7 +571,7 @@
</tr>
<tr>
<td class="vst-text">
<?php print __('Directory') ?>
<?php print __('Directory') ?>
</td>
</tr>
<tr>
@ -599,7 +599,7 @@
<table style="display:<?php if (empty($v_adv) && $_GET['lead'] != 'filemanager' && $_GET['lead'] != 'sftp') echo 'none';?> ;" id="vesta">
<tr>
<td class="vst-text">
<?php print __('Version') ?>
<?php print __('Version') ?>
</td>
</tr>
<tr>
@ -638,7 +638,7 @@
</tr>
<tr>
<td class="vst-text">
<?php print __('Reseller Role') ?>
<?php print __('Reseller Role') ?>
</td>
</tr>
<tr>
@ -651,7 +651,7 @@
</tr>
<tr>
<td class="vst-text">
<?php print __('Backup Migration Manager') ?>
<?php print __('Backup Migration Manager') ?>
</td>
</tr>
<tr>
@ -690,7 +690,7 @@
'.__('Licence Key').': <input type="text" class="vst-input" name="v_sftp_licence" value="'.$licence_key.'" /><br>
</div>';
} else {
echo
echo
__('Restrict users so that they cannot use SSH and access only their home directory.').' '.__('This is a commercial module, you would need to purchace license key to enable it.').
'<div class="licence">
'.__('Enter License Key').': <input type="text" class="vst-input" name="v_sftp_licence" /><br>
@ -712,7 +712,7 @@
<tr>
<td class="vst-text" id="module-filemanager">
<?php print __('File Manager') ?>
<?php print __('File Manager') ?>
</td>
</tr>
<tr>
@ -797,4 +797,4 @@
}
});
});
</script>
</script>