Handle hostnames with upper-case letters
[webmin.git] / bind8 / backup_config.pl
1
2 do 'bind8-lib.pl';
3
4 # backup_config_files()
5 # Returns files and directories that can be backed up
6 sub backup_config_files
7 {
8 local @rv;
9
10 # Add main .conf files
11 local $conf = &get_config();
12 push(@rv, map { $_->{'file'} } @$conf);
13
14 # Add all master and hint zone files
15 local @views = &find("view", $conf);
16 local ($v, @zones);
17 foreach $v (@views) {
18         local @vz = &find("zone", $v->{'members'});
19         push(@zones, @vz);
20         }
21 push(@zones, &find("zone", $conf));
22 local $z;
23 foreach $z (@zones) {
24         local $tv = &find_value("type", $z->{'members'});
25         next if ($tv ne "master" && $tv ne "hint");
26         local $file = &find_value("file", $z->{'members'});
27         next if (!$file);
28         local @recs = &read_zone_file($file, $z->{'value'});
29         push(@rv, map { $_->{'file'} } @recs);
30         }
31
32 return map { &make_chroot($_) } &unique(@rv);
33 }
34
35 # pre_backup(&files)
36 # Called before the files are actually read
37 sub pre_backup
38 {
39 return undef;
40 }
41
42 # post_backup(&files)
43 # Called after the files are actually read
44 sub post_backup
45 {
46 return undef;
47 }
48
49 # pre_restore(&files)
50 # Called before the files are restored from a backup
51 sub pre_restore
52 {
53 return undef;
54 }
55
56 # post_restore(&files)
57 # Called after the files are restored from a backup
58 sub post_restore
59 {
60 &flush_zone_names();
61 local $pidfile = &get_pid_file();
62 if (&check_pid_file(&make_chroot($pidfile, 1))) {
63         return &restart_bind();
64         }
65 return undef;
66 }
67
68 1;
69