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

@ -336,7 +336,7 @@
<?php } ?>
<?php if ($v_mysql == 'yes') {
$i = 0;
foreach ($v_mysql_hosts as $key => $value) {
foreach ($v_mysql_hosts as $value) {
$i++;
?>
<tr>
@ -346,7 +346,7 @@
</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>
@ -416,7 +416,7 @@
<?php } ?>
<?php if ($v_pgsql == 'yes') {
$i = 0;
foreach ($v_pgsql_hosts as $key => $value) {
foreach ($v_pgsql_hosts as $value) {
$i++;
?>
<tr>
@ -426,7 +426,7 @@
</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>