TT#15857 Fix indentation

Change-Id: I53d0185a1d38556edb143bd7ab67a66740cb9d3b
changes/19/34619/1
Guillem Jover 7 years ago
parent 2665215e64
commit 1054cb4d74

@ -65,7 +65,7 @@ sub db_connect
my $dbh = DBI->connect("DBI:mysql:database=${dbname};host=${dbhost};port=${dbport};"
. "mysql_read_default_file=${dbcredentials}",
"", "", { PrintError => 1 });
unless(defined $dbh) {
unless (defined $dbh) {
print "Error: Could not connect to database '$dbname' at '$dbhost:$dbport' using '${dbcredentials}': $DBI::errstr\n";
exit 1;
}
@ -79,10 +79,11 @@ sub generic_enum_sync {
my $dom_pref = shift;
my $peer_pref = shift;
my $pref_name = shift;
my $sth = $dbh->prepare("select id from voip_preferences where attribute=?");
$sth->execute($pref_name);
my $res = $sth->fetchrow_hashref();
unless(defined $res) {
unless (defined $res) {
print "Error: Could not find preference '$pref_name' in db\n";
return;
}
@ -100,11 +101,11 @@ sub generic_enum_sync {
foreach my $row (keys %{$db_hash}) {
$row = $db_hash->{$row};
next if($row->{label} eq 'default');
if(!exists $config_hash->{$row->{label}}) {
next if $row->{label} eq 'default';
if (!exists $config_hash->{$row->{label}}) {
print "$pref_name $row->{label} does not exist anymore in config, delete from db\n";
$enum_delete_sth->execute($row->{id});
} elsif($config_hash->{$row->{label}} ne $row->{value}) {
} elsif ($config_hash->{$row->{label}} ne $row->{value}) {
print "update $pref_name $row->{label}=$row->{value} to $row->{label}=$config_hash->{$row->{label}} in db\n";
$enum_update_sth->execute($config_hash->{$row->{label}}, $row->{id});
delete $config_hash->{$row->{label}};
@ -113,15 +114,17 @@ sub generic_enum_sync {
delete $config_hash->{$row->{label}};
}
}
foreach my $label(keys %{$config_hash}) {
foreach my $label (keys %{$config_hash}) {
print "insert new $pref_name $label=$config_hash->{$label} from config into db\n";
$enum_insert_sth->execute($pref_id, $label, $config_hash->{$label},
$usr_pref ? 1 : 0, $dom_pref ? 1 : 0, $peer_pref ? 1: 0);
$usr_pref ? 1 : 0, $dom_pref ? 1 : 0,
$peer_pref ? 1: 0);
}
$enum_insert_sth->finish;
$enum_update_sth->finish;
$enum_delete_sth->finish;
return 1;
}
@ -248,5 +251,4 @@ SQL
return 1;
}
## END OF FILE #################################################################

Loading…
Cancel
Save