1 |
unnilennium |
1.1 |
diff -up smeserver-ddclient-1.0.0/root/etc/e-smith/db/domains/migrate/80ddclient.extrasmigrate smeserver-ddclient-1.0.0/root/etc/e-smith/db/domains/migrate/80ddclient |
2 |
|
|
--- smeserver-ddclient-1.0.0/root/etc/e-smith/db/domains/migrate/80ddclient.extrasmigrate 2013-12-30 14:17:00.000000000 -0500 |
3 |
|
|
+++ smeserver-ddclient-1.0.0/root/etc/e-smith/db/domains/migrate/80ddclient 2013-12-30 14:18:10.000000000 -0500 |
4 |
|
|
@@ -0,0 +1,60 @@ |
5 |
|
|
+{ |
6 |
|
|
+my $filename = '/home/e-smith/db/extras'; |
7 |
|
|
+return 0 |
8 |
|
|
+unless (-e $filename); |
9 |
|
|
+ |
10 |
|
|
+ |
11 |
|
|
+use esmith::ConfigDB; |
12 |
|
|
+ |
13 |
|
|
+##use db domain or die if doesn't exist |
14 |
|
|
+my $domaindb = esmith::ConfigDB->open('/home/e-smith/db/domains'); |
15 |
|
|
+ |
16 |
|
|
+##use db extras or die if doesn't exist |
17 |
|
|
+my $edb = esmith::ConfigDB->open($filename); |
18 |
|
|
+ |
19 |
|
|
+ if (defined $edb) |
20 |
|
|
+ { |
21 |
|
|
+ foreach my $extradomain ($edb->get_all_by_prop(type=>'ddhost')) |
22 |
|
|
+ { |
23 |
|
|
+ my $currentdom = $extradomain->key; |
24 |
|
|
+ my $descddhost = $edb->get_prop("$currentdom", "desc") || "ddhost migrated domain"; |
25 |
|
|
+ my $dnsddhost = $edb->get_prop("$currentdom", "dns"); |
26 |
|
|
+ my $mxddhost = $edb->get_prop("$currentdom", "mx"); |
27 |
|
|
+ my $passwordddhost = $edb->get_prop("$currentdom", "password"); |
28 |
|
|
+ |
29 |
|
|
+ $domaindb->new_record( "$currentdom" ); |
30 |
|
|
+ $domaindb->set_value( "$currentdom" , "domain" ); |
31 |
|
|
+ $domaindb->set_prop( "$currentdom" , "Description" , "$descddhost" ); |
32 |
|
|
+ $domaindb->set_prop( "$currentdom" , "dns" , "$dnsddhost" ) if defined $dnsddhost; |
33 |
|
|
+ $domaindb->set_prop( "$currentdom" , "mx" , "$mxddhost") if defined $mxddhost; |
34 |
|
|
+ $domaindb->set_prop( "$currentdom" , "password" , "$passwordddhost" ) if defined $passwordddhost; |
35 |
|
|
+ # followings set defaults values as a domain pointing to Primary ibay |
36 |
|
|
+ # as even if they are not configured they will point there ! |
37 |
|
|
+ # Nameservers are defined as internet, as they are dynamic domains, |
38 |
|
|
+ # if admin wants to point as a localhost, he just has to do it in the manager |
39 |
|
|
+ $domaindb->set_prop( "$currentdom" , "SystemPrimaryDomain" , "no" ); |
40 |
|
|
+ $domaindb->set_prop( "$currentdom" , "Removable" , "yes" ); |
41 |
|
|
+ $domaindb->set_prop( "$currentdom" , "Nameservers" , "internet" ); |
42 |
|
|
+ $domaindb->set_prop( "$currentdom" , "Content" , "Primary" ); |
43 |
|
|
+ } |
44 |
|
|
+ |
45 |
|
|
+ foreach my $extradomain ($edb->get_all_by_prop(type=>'domain')) |
46 |
|
|
+ |
47 |
|
|
+ { |
48 |
|
|
+ my $currentdom = $extradomain->key; |
49 |
|
|
+ # commented as we rather keep description already in domain |
50 |
|
|
+ #my $descdomain = $edb->get_prop("$currentdom", "desc"); |
51 |
|
|
+ my $dnsdomain = $edb->get_prop("$currentdom", "dns"); |
52 |
|
|
+ my $mxdomain = $edb->get_prop("$currentdom", "mx"); |
53 |
|
|
+ my $passworddomain = $edb->get_prop("$currentdom", "password"); |
54 |
|
|
+ |
55 |
|
|
+ #$domaindb->set_prop( "$currentdom" , "desc", "$descdomain" ); |
56 |
|
|
+ $domaindb->set_prop( "$currentdom" , "dns" , "$dnsdomain" ) if defined $dnsdomain; |
57 |
|
|
+ $domaindb->set_prop( "$currentdom" , "mx" , "$mxdomain" ) if defined $mxdomain; |
58 |
|
|
+ $domaindb->set_prop( "$currentdom" , "password" , "$passworddomain" ) if defined $passworddomain; |
59 |
|
|
+ } |
60 |
|
|
+ |
61 |
|
|
+system ("/bin/mv $filename /home/e-smith/db/extras-migrated"); |
62 |
|
|
+ |
63 |
|
|
+ } |
64 |
|
|
+} |