forked from virtualmin/virtualmin-gpl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackup_config.pl
executable file
·97 lines (78 loc) · 1.79 KB
/
backup_config.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
do 'virtual-server-lib.pl';
# backup_config_files()
# Returns files and directories that can be backed up
sub backup_config_files
{
local @rv;
# Add all domain files
foreach my $d (&list_domains()) {
push(@rv, $d->{'file'});
}
# Add all bandwidth files
foreach my $d (&list_domains()) {
push(@rv, "$bandwidth_dir/$d->{'id'}")
if (-r "$bandwidth_dir/$d->{'id'}");
}
# Add all templates
foreach my $t (&list_templates()) {
if ($t->{'id'} > 0) {
push(@rv, "$templates_dir/$t->{'id'}");
}
}
# Add records of installed scripts
foreach my $d (&list_domains()) {
push(@rv, "$script_log_directory/$d->{'id'}")
if (-r "$script_log_directory/$d->{'id'}");
}
# Add mail templates
foreach my $tf (@all_template_files) {
push(@rv, "$module_config_directory/$tf");
}
# Add other files
push(@rv, $custom_fields_file);
push(@rv, $scripts_unavail_file);
# Add spam and procmail config files
foreach my $d (&list_domains()) {
push(@rv, "$procmail_spam_dir/$d->{'id'}")
if (-r "$procmail_spam_dir/$d->{'id'}");
push(@rv, "$spam_config_dir/$d->{'id'}")
if (-r "$spam_config_dir/$d->{'id'}");
}
# Add initial users
foreach my $d (&list_domains()) {
push(@rv, "$initial_users_dir/$d->{'id'}")
if (-r "$initial_users_dir/$d->{'id'}");
}
# IDs files
push(@rv, $old_uids_file, $old_gids_file);
return @rv;
}
# pre_backup(&files)
# Called before the files are actually read
sub pre_backup
{
return undef;
}
# post_backup(&files)
# Called after the files are actually read
sub post_backup
{
return undef;
}
# pre_restore(&files)
# Called before the files are restored from a backup
sub pre_restore
{
# Delete other domains
foreach my $d (&list_domains()) {
&delete_domain($d);
}
return undef;
}
# post_restore(&files)
# Called after the files are restored from a backup
sub post_restore
{
return undef;
}
1;