2 # Delete multiple .htaccess files
4 require './htaccess-lib.pl';
5 &foreign_require($apachemod, "apache-lib.pl");
7 &error_setup($text{'delete_err'});
8 $can_create || &error($text{'dir_ecannotcreate'});
9 @d = split(/\0/, $in{'d'});
10 @d || &error($text{'delete_enone'});
12 # Do the deletion of the .htaccess file and any user and group files
13 @dirs = &list_directories();
15 ($dir) = grep { $_->[0] eq $d } @dirs;
17 $htaccess = "$dir->[0]/$config{'htaccess'}";
18 &can_access_dir($htaccess) || &error($text{'dir_ecannot'});
20 # Block away the whole file
21 &unlink_logged($htaccess);
22 &unlink_logged($dir->[1])
24 &unlink_logged($dir->[4])
25 if ($dir->[4] && !-d $dir->[4]);
28 # Take the authentication directives out of .htaccess
29 $conf = &foreign_call($apachemod,
30 "get_htaccess_config", $htaccess);
31 &foreign_call($apachemod, "save_directive",
32 "require", [ ], $conf, $conf);
34 @dirs = grep { $_ ne $dir } @dirs;
40 &save_directories(\@dirs);
41 &webmin_log("delete", "dirs", scalar(@d));