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

View file

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

View file

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