-
Notifications
You must be signed in to change notification settings - Fork 0
/
delete.cgi
executable file
·78 lines (71 loc) · 2.44 KB
/
delete.cgi
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
#!/usr/local/bin/perl
# Delete one repository
use strict;
use warnings;
our (%text, %in);
require './virtualmin-svn-lib.pl';
&ReadParse();
# Get the domain and repository
my ($repdom) = grep { $_ ne "confirm" && $_ ne "show" } (keys %in);
my ($repname, $id) = split(/\@/, $repdom);
my $dom = &virtual_server::get_domain($id);
&can_edit_domain($dom) || &error($text{'add_edom'});
my @reps = &list_reps($dom);
my ($rep) = grep { $_->{'rep'} eq $repname } @reps;
$rep || &error($text{'delete_erep'});
my $button = $in{$repdom};
if ($button eq &entities_to_ascii($text{'delete'})) {
# Deleting repositories
if ($in{'confirm'}) {
# Do it!
&delete_rep($dom, $rep);
&webmin_log("delete", "repo", $repname,
{ 'dom' => $dom->{'dom'} });
&redirect("index.cgi?show=$in{'show'}");
}
else {
# Ask first
&ui_print_header(&virtual_server::domain_in($dom),
$text{'delete_title'}, "");
print "<center>\n";
my $size = &disk_usage_kb("$dom->{'home'}/svn/$rep->{'rep'}");
print &ui_form_start("delete.cgi");
print &ui_hidden($repdom, $in{$repdom});
print &ui_hidden("show", $in{'show'});
print &text('delete_rusure', "<tt>$repname</tt>",
&nice_size($size*1024)),"<p>\n";
print &ui_form_end([ [ "confirm", $text{'delete_ok'} ] ]);
print "</center>\n";
&ui_print_footer("index.cgi?show=$in{'show'}",
$text{'index_return'});
}
}
elsif ($button eq &entities_to_ascii($text{'index_email'})) {
# Configuring email
&redirect("edit_email.cgi?dom=$id&rep=$repname&show=$in{'show'}");
}
elsif ($button eq &entities_to_ascii($text{'index_dump'})) {
# Dumping repository
&redirect("edit_dump.cgi?dom=$id&rep=$repname&show=$in{'show'}");
}
elsif ($button eq &entities_to_ascii($text{'index_load'})) {
# Loading repository
&redirect("edit_load.cgi?dom=$id&rep=$repname&show=$in{'show'}");
}
elsif ($button eq &entities_to_ascii($text{'index_perms'})) {
# Set permissions back to Apache user
&ui_print_header(&virtual_server::domain_in($dom),
$text{'perms_title'}, "");
print &text('perms_doing', "<tt>$rep->{'dir'}</tt>"),"<br>\n";
&set_rep_permissions($dom, $rep);
print $text{'perms_done'},"<p>\n";
&webmin_log("fix", "repo", $repname, { 'dom' => $dom->{'dom'} });
&ui_print_footer("index.cgi?show=$in{'show'}", $text{'index_return'});
}
elsif ($button eq &entities_to_ascii($text{'index_anon'})) {
# Anonymous access form
&redirect("edit_anon.cgi?dom=$id&rep=$repname&show=$in{'show'}");
}
else {
&error($text{'delete_emode'});
}