|
|
|
|
@ -79,6 +79,7 @@ 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();
|
|
|
|
|
@ -100,7 +101,7 @@ sub generic_enum_sync {
|
|
|
|
|
|
|
|
|
|
foreach my $row (keys %{$db_hash}) {
|
|
|
|
|
$row = $db_hash->{$row};
|
|
|
|
|
next if($row->{label} eq 'default');
|
|
|
|
|
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});
|
|
|
|
|
@ -116,12 +117,14 @@ sub generic_enum_sync {
|
|
|
|
|
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 #################################################################
|
|
|
|
|
|