upgrade.php
- create quota and quota2 table (upgrade_729)
- create the triggers required by dovecot (upgrade_730_pgsql)
list-virtual.php
- updated to work with both quota tables
Patch by Varren Volz, https://sourceforge.net/tracker/?func=detail&aid=2867629&group_id=191583&atid=937966
- changed query for 1.1 quota table to
WHERE [...] AND ( $table_quota.path='quota/storage' OR $table_quota.path IS NULL )
This fixes https://sourceforge.net/tracker/?func=detail&aid=2794247&group_id=191583&atid=937964
(users not shown when initial email is not sent)
config.inc.php, functions.php
- new config option $CONF['new_quota_table'] (YES means dovecot 1.2 format)
- set variables for new quota2 table
DOCUMENTS/DOVECOT.txt
- added note that quota table is automatically created
- added note about different quota tables for dovecot 1.0/1.1 and >= 1.2
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@730 a1433add-5e2c-0410-b055-b7f2511e0802
# TODO: reduce number of different queries by not depending on too much config options
# (it probably won't hurt to include a field in the resultset that is not displayed later)
if ($CONF['vacation_control_admin'] == 'YES')
{
if (boolconf('used_quotas'))
$query = "SELECT $table_mailbox.*, $table_vacation.active AS v_active, $table_quota.current FROM $table_mailbox
LEFT JOIN $table_vacation ON $table_mailbox.username=$table_vacation.email
LEFT JOIN $table_quota ON $table_mailbox.username=$table_quota.username
WHERE $table_mailbox.domain='$fDomain'
ORDER BY $table_mailbox.username LIMIT $page_size OFFSET $fDisplay";
// AND $table_quota.path='quota/storage'
else
{
if (boolconf('new_quota_table'))
{
$query = "SELECT $table_mailbox.*, $table_vacation.active AS v_active, $table_quota2.bytes FROM $table_mailbox
LEFT JOIN $table_vacation ON $table_mailbox.username=$table_vacation.email
LEFT JOIN $table_quota2 ON $table_mailbox.username=$table_quota2.username
WHERE $table_mailbox.domain='$fDomain'
ORDER BY $table_mailbox.username LIMIT $page_size OFFSET $fDisplay";
}
else
{
$query = "SELECT $table_mailbox.*, $table_vacation.active AS v_active, $table_quota.current FROM $table_mailbox
LEFT JOIN $table_vacation ON $table_mailbox.username=$table_vacation.email
LEFT JOIN $table_quota ON $table_mailbox.username=$table_quota.username
WHERE $table_mailbox.domain='$fDomain' AND
( $table_quota.path='quota/storage' OR $table_quota.path IS NULL )
ORDER BY $table_mailbox.username LIMIT $page_size OFFSET $fDisplay";
}
}
else # $CONF[used_quotas] = NO
{
$query = "SELECT $table_mailbox.*, $table_vacation.active AS v_active FROM $table_mailbox
LEFT JOIN $table_vacation ON $table_mailbox.username=$table_vacation.email
WHERE $table_mailbox.domain='$fDomain' ORDER BY $table_mailbox.username LIMIT $page_size OFFSET $fDisplay";
}
}
else
else # $CONF['vacation_control_admin'] == 'NO'
{
$query = "SELECT * FROM $table_mailbox WHERE domain='$fDomain' ORDER BY username LIMIT $fDisplay, $page_size";
if ('pgsql'==$CONF['database_type'])
if (boolconf('used_quotas'))
{
$query = "SELECT *,extract(epoch from created) as uts_created,extract(epoch from modified) as uts_modified FROM $table_mailbox WHERE domain='$fDomain' ORDER BY username LIMIT $page_size OFFSET $fDisplay";
if (boolconf('new_quota_table'))
{
$query = "SELECT $table_mailbox.*, $table_quota2.bytes as current FROM $table_mailbox
LEFT JOIN $table_quota2 ON $table_mailbox.username=$table_quota2.username
WHERE $table_mailbox.domain='$fDomain' ORDER BY $table_mailbox.username LIMIT $page_size OFFSET $fDisplay";
}
else
{
$query = "SELECT $table_mailbox.*, $table_quota.current FROM $table_mailbox
LEFT JOIN $table_quota ON $table_mailbox.username=$table_quota.username
WHERE $table_mailbox.domain='$fDomain' AND
( $table_quota.path='quota/storage' OR $table_quota.path IS NULL )
ORDER BY $table_mailbox.username LIMIT $page_size OFFSET $fDisplay";
}
}
else # $CONF[used_quotas] = NO
{
$query = "SELECT * FROM $table_mailbox WHERE domain='$fDomain' ORDER BY username LIMIT $page_size OFFSET $fDisplay";