Strict conversion and code cleanup for exports module

This commit is contained in:
Jamie Cameron
2014-05-30 17:17:27 -07:00
parent 2f45062a98
commit c8702bcda8
2 changed files with 12 additions and 5 deletions

View File

@@ -1,25 +1,29 @@
#!/usr/local/bin/perl
# Delete, disable or enable all exports for some directories
use strict;
use warnings;
require './exports-lib.pl';
our (%text, %in, %config);
# Validate inputs
&error_setup($text{'delete_err'});
&ReadParse();
@d = split(/\0/, $in{'d'});
my @d = split(/\0/, $in{'d'});
@d || &error($text{'delete_enone'});
# Find the actual clients
&lock_file($config{'exports_file'});
@exps = &list_exports();
foreach $e (@exps) {
my @exps = &list_exports();
my @dels;
foreach my $e (@exps) {
if (&indexof($e->{'dir'}, @d) >= 0) {
push(@dels, $e);
}
}
# Take them out, one by one
foreach $d (reverse(@dels)) {
foreach my $d (reverse(@dels)) {
if ($in{'delete'}) {
&delete_export($d);
}

View File

@@ -2,9 +2,12 @@
# restart_mountd.cgi
# Do whatever is needed to apply changes to the exports file
use strict;
use warnings;
require './exports-lib.pl';
our (%text);
&error_setup($text{'restart_err'});
$err = &restart_mountd();
my $err = &restart_mountd();
&error($err) if ($err);
&webmin_log('apply');
&redirect("");