forked from cited/JRI-Publisher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete_war.cgi
39 lines (29 loc) · 821 Bytes
/
delete_war.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
#!/usr/bin/perl
require './tomcat-lib.pl';
use File::Path 'rmtree';
&ReadParse();
&error_setup($text{'delete_err'});
&ui_print_header(undef, $text{'delete_title'}, "");
@mods = split(/\0/, $in{'mod'});
@mods || &error($text{'delete_enone'});
tomcat_service_ctl('stop');
#delete each of the specified directories
my $catalina_home = get_catalina_home();
foreach $d (@mods) {
print "Removing $catalina_home/$d<br>";
if(rmtree("$catalina_home/webapps/$d") == 0){
&error("Failed to remove application");
&ui_print_footer("", $text{'index_return'});
exit;
}
if($in{'rmwar'}){
$war = "$catalina_home/webapps/$d.war";
if( -f $war){
unlink($war);
print "<tt>Removed $war</tt><br>";
}
}
}
print "Uninstall successful<br>";
tomcat_service_ctl('start');
&ui_print_footer("", $text{'index_return'});