[imp] wu-imap quotas on Redhat 8 or 9 with imp 3.2.2

Lord Apollyon implist at paypc.com
Fri Sep 12 00:32:43 PDT 2003


I have a probably better solution, Eric.

>>>>>>>>>>>>>>>>>>>>

$junk = exec("(grep -w $homedir[1] /etc/fstab || grep -w \"/\" /etc/fstab) |
cut -f1 -d\  | cut -f1", $my_device, $return_code); // All one line

if ($return_code === 0 && $my_device === 1) //newline
$junk = exec("/usr/local/phpbin/sudo /usr/bin/quota -u $imap_admin | grep
$my_device[0]", $quota_data,$return_code);   // All one line

<<<<<<<<<<<<<<<<<<<<

This will map the homedir fragment to a device entry - which is what
Slackware quota -u's report.  The logic's simple - if the first /frag isn't
matched in the fstab, then / is assumed as the filesystem.  The device entry
of the best-matched fs is returned, and pumped into the subsequent grep
command.  Oh happy shelliness.

You could just gobble the /etc/fstab and parse it in PHP (which might be
faster because shell forking is more costly than simple execution), however,
you'd run afoul of things if you used Safe Mode, whereas doing it via shell
has an easy Safe Mode accomodation.

=Apollyon=


More information about the imp mailing list