[fix] The legacy du.pl script should be replaced by /usr/bin/du in spoolsize.php
Turns out quotas were broken due to a header in du.pl printf "FIXME: do not work with Debian Compliance"; exit(1); The script is therefore unusable and useless now.
This commit is contained in:
parent
a2e6349998
commit
e6377f0b98
43
src/du.pl
43
src/du.pl
|
@ -1,43 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
$ENV{PATH} = "/usr/bin:/bin";
|
||||
$ENV{CDPATH} = "";
|
||||
|
||||
printf "FIXME: do not work with Debian Compliance";
|
||||
exit(1);
|
||||
|
||||
|
||||
$A=$ARGV[0];
|
||||
sub untaint {
|
||||
my @list = @_;
|
||||
for (@list) {
|
||||
/(.*)/;
|
||||
$_ = $1;
|
||||
} wantarray ? @list : $list[0];
|
||||
}
|
||||
|
||||
$A=untaint($A);
|
||||
if ($A=~/^\/var\/alternc\/html\/[a-z0-9]\//) {
|
||||
open(SI,"/usr/bin/du -s '$A'|");
|
||||
$B=<SI>;
|
||||
$B=~/^([0-9]+).*/;
|
||||
printf "$1\n";
|
||||
}
|
||||
if ($A=~/^\/var\/alternc\/mail\/[a-z0-9_]\//) {
|
||||
open(SI,"/usr/bin/du -s '$A'|");
|
||||
$B=<SI>;
|
||||
$B=~/^([0-9]+).*/;
|
||||
printf "$1\n";
|
||||
}
|
||||
if ($A=~/^\/var\/alternc\/db\//) {
|
||||
open(SI,"/usr/bin/du -s '$A'|");
|
||||
$B=<SI>;
|
||||
$B=~/^([0-9]+).*/;
|
||||
printf "$1\n";
|
||||
}
|
||||
if ($A=~/^\/var\/lib\/mailman\//) {
|
||||
open(SI,"/usr/bin/du -s '$A'|");
|
||||
$B=<SI>;
|
||||
$B=~/^([0-9]+).*/;
|
||||
printf "$1\n";
|
||||
}
|
|
@ -22,7 +22,7 @@ if ($db->query("SELECT uid,login FROM membres;")) {
|
|||
} else {
|
||||
// The QUOTA system being disabled, we need to use 'du' on each folder.
|
||||
$login = $db->f('login');
|
||||
$size=exec("/usr/lib/alternc/du.pl /var/www/alternc/".substr($login,0,1)."/".$login);
|
||||
$size=exec("/usr/bin/du /var/www/alternc/".substr($login,0,1)."/".$login);
|
||||
}
|
||||
$db2->query("REPLACE INTO size_web SET uid=?, size=?;",array(intval($db->f('uid')),intval($size)));
|
||||
echo $db->f('login')." (".(round($size/1024, 1))." MB)\n";
|
||||
|
|
Loading…
Reference in New Issue