2 # (c) Petr Baudis <pasky@suse.cz>
8 use lib
qw(/home/repo/repomgr/cgi);
11 my $repo = Git
::RepoCGI
->new('Project Removal');
14 my $name = $cgi->param('name');
16 unless (defined $name) {
17 print "<p>I need the project name as an argument now.</p>\n";
21 if (!valid_proj_name
($name)) {
22 print "<p>Invalid project name. Go away, sorcerer.</p>\n";
26 if (!Git
::RepoCGI
::Project
::does_exist
($name)) {
27 print "<p>Sorry but this project does not exist. Now, how did you <em>get</em> here?!</p>\n";
31 if (!Git
::RepoCGI
::Project
::available
($name)) {
32 print "<p>Sorry but your project has not finished mirroring yet. If it takes inordinate amount of time, please tell the administrator.</p>\n";
36 my $proj = Git
::RepoCGI
::Project
->load($name);
37 $proj or die "not found project $name, that's really weird!";
39 if (!$proj->{mirror
}) {
40 print "<p>Sorry but you can remove only mirrored projects. Pushed projects cannot be removed. Please tell the administrator if you really want to.</p>\n";
44 if (glob('/srv/git/'.$name.'/*')) {
45 print "<p>Sorry but this project has forks associated. Such projects cannot be removed. Please tell the administrator if you really want to.</p>\n";
49 if ($cgi->param('y0')) {
51 if (not $proj->authenticate($repo)) {
55 print "<p>Project successfuly deleted. Have a nice day.</p>\n";
59 my $url = $proj->{url
};
62 <p>Please confirm that you are going to remove mirrored project
63 $name ($url) from the site.</p>
65 <input type="hidden" name="name" value="$h{name}" />
66 <p>Admin password: <input type="password" name="cpwd" /></p>
67 <p><input type="submit" name="y0" value="Remove" /></p>