*.cgi: replace site-specific constansts
[girocco/ztw.git] / cgi / delproj.cgi
blob60f865f4f00aac2abe616468e5056680fbb52431
1 #!/usr/bin/perl
2 # (c) Petr Baudis <pasky@suse.cz>
3 # GPLv2
5 use strict;
6 use warnings;
8 use lib qw(/home/repo/repomgr/cgi);
9 use Git::RepoCGI;
11 my $repo = Git::RepoCGI->new('Project Removal');
12 my $name = $repo->sparam('name');
14 my $proj = $repo->load_project($name);
15 $proj->{cpwd} = $repo->sparam('cpwd');
17 $repo->bye("Sorry but you can remove only mirrored projects. "
18 . "Pushed projects cannot be removed. "
19 . "If you feel this action is necessary, please contact "
20 . "the site administrator.")
21 unless $proj->{mirror};
23 $repo->bye("Sorry but this project has forks associated. "
24 . "Such projects cannot be removed. "
25 . "If you feel this action is necessary, please contact "
26 . "the site administrator.")
27 if $proj->has_forks;
29 if ($repo->sparam('y0')) {
30 # submitted
31 $repo->bye("Authentication failed. Your money is no good here.")
32 unless $proj->authenticate($repo);
33 $proj->delete;
34 $repo->bye("Project successfuly deleted. Have a nice day.");
37 my $url = $proj->{url};
39 print <<EOT;
40 <p>Please confirm that you intend to remove the mirrored project
41 '$name' ($url) from this site.</p>
42 <form method="post">
43 <input type="hidden" name="name" value="$name" />
44 <p>Admin password: <input type="password" name="cpwd" />
45 <sup><a href="pwproj.cgi?name=$name">(forgot password?)</a></sup></p>
46 <p><input type="submit" name="y0" value="Remove" /></p>
47 </form>
48 EOT