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

AJ aj at mindcrash.com
Fri Sep 19 10:25:38 PDT 2003


Well, in playing with this, I made this change.. keeping in mind I have no idea
what I am doing w/ PHP.  :)

This is to lib/Quota/command.php

    function quotaHTML()
    {
        global $imp;

        $imap_user = strtolower($imp['user']);
        $passwd_array = posix_getpwnam($imap_user);
        $homedir = "/dev/hda2";
        $cmdline = $this->_params['quota_path'] . " -u $imap_user | " .
                   $this->_params['grep_path'] . " $homedir";
        $junk = exec($cmdline, $quota_data, $return_code);
        if (($return_code == 0) && (count($quota_data) == 1)) {
           $quota = split("[[:blank:]]+", trim($quota_data[0]));
           return $this->_quotaHTML($quota[1] * 1024, $quota[2] * 1024);
        }
        return $this->_quotaError(_("Unable to retrieve quota"));
    }

}


Basically, I just hard coded in the filesystem where my /home folder is.
This seems to now work, except that people who do not have quotas get the:
"Unable to retrieve quota" messeage, where they should get the "NO LIMIT"
message..  What would be the best way to fix this, but at the same time keep
the quota error message enabled in case something goes wrong?

Thanks.
AJ





> >   Where should I insert this code snippet?
>
> The following (all one line) goes just before the "sudo quota" line:
>
> $junk = exec("(grep -w $homedir[1] /etc/fstab || grep -w \"/\" /etc/fstab) |
> cut -f1 -d\  | cut -f1", $my_device); // this is a new line
>
> The next line reads:
>
> if ($return_code === 0 && $my_device === 1) // this is a new line
>
> and the very next line reads (all one line):
>
> $junk = exec("/usr/local/phpbin/sudo /usr/bin/quota -u $imap_admin | grep
> $my_device",$quota_data,$return_code); // replace your existing "quota" line
> with this one.
>
> If you can't make this out, I'll email the entire quota function fragment.
> It works well on three different systems which use radically different disk
> and filesystem layouts.
>
> =Apollyon=
>
> --
> IMP mailing list
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: imp-unsubscribe at lists.horde.org
>



More information about the imp mailing list