#!/usr/local/bin/perl # delete_domain.cgi # Delete a domain, after asking first require './virtual-server-lib.pl'; &require_bind() if ($config{'dns'}); &require_useradmin(); &require_mail() if ($config{'mail'}); &ReadParse(); $d = &get_domain($in{'dom'}); $d && $d->{'uid'} && ($d->{'gid'} || $d->{'ugid'}) || &error("Domain $in{'dom'} does not exist!"); &can_delete_domain($d) || &error($text{'delete_ecannot'}); if ($in{'confirm'}) { &ui_print_unbuffered_header(&domain_in($d), $text{'delete_title'}, ""); } else { &ui_print_header(&domain_in($d), $text{'delete_title'}, ""); } @users = &list_domain_users($d, 1); @aliases = &list_domain_aliases($d, 1); @subs = &get_domain_by("parent", $d->{'id'}); @aliasdoms = &get_domain_by("alias", $d->{'id'}); @aliasdoms = grep { $_->{'parent'} != $d->{'id'} } @aliasdoms; if (!$in{'confirm'}) { # Ask the user if he is sure print &check_clicks_function(); if ($d->{'unix'}) { $sz = &disk_usage_kb($d->{'home'}); print "

",&text('delete_rusure2', "$d->{'dom'}", &nice_size($sz*1024)),"

\n"; } else { print "

",&text('delete_rusure3', "$d->{'dom'}"),"

\n"; } $pfx = $d->{'parent'} ? "sublosing_" : "losing_"; print "

\n"; if (@subs) { print "

",&text('delete_subs', join(", ", map { "$_->{'dom'}" } @subs)), "

\n"; } if (@aliasdoms) { print "

",&text('delete_aliasdoms', join(", ", map { "$_->{'dom'}" } @aliasdoms)), "

\n"; } print "

\n"; print "\n"; print "\n"; if (&can_import_servers() && !$virtualmin_pro) { print "

", "$text{'delete_only'}
\n"; } print "

\n"; &ui_print_footer(&domain_footer_link($d), "", $text{'index_return'}); } else { # Go ahead and delete this domain and all sub-domains .. $in{'only'} = 0 if (!&can_import_servers()); $err = &delete_virtual_server($d, $in{'only'}); &error($err) if ($err); # Call any theme post command if (defined(&theme_post_save_domain)) { &theme_post_save_domain(\%dom, 'delete'); } &webmin_log("delete", "domain", $d->{'dom'}, $d); &ui_print_footer("", $text{'index_return'}); }