From bd28fcb19481f0fc520b821f14c660235922ec2b Mon Sep 17 00:00:00 2001 From: Christian Boltz Date: Mon, 31 Oct 2016 20:15:31 +0000 Subject: [PATCH] AliasHandler: restrict __is_mailbox subquery to allowed domains This improves performance on setups with lots of mailboxes. Well, except for superadmins because restricting to "all domains" doesn't really help ;-) Thanks to gygy for reporting this on IRC, and for testing the patch. git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1877 a1433add-5e2c-0410-b055-b7f2511e0802 --- CHANGELOG.TXT | 2 ++ model/AliasHandler.php | 1 + 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index 1c7820ab..b5e10cba 100644 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -12,6 +12,8 @@ Changes since the 3.0.1 release ------------------------------------------------- + - AliasHandler: restrict mailbox subquery to allowed domains to improve + performance (except for superadmins ;-) on setups with lots of mailboxes - allow switching between dovecot:* password schemes while still accepting passwords hashed using the previous dovecot:* scheme - FetchmailHandler: use a valid date as default for 'date' diff --git a/model/AliasHandler.php b/model/AliasHandler.php index 23e08234..b6b0e4c8 100644 --- a/model/AliasHandler.php +++ b/model/AliasHandler.php @@ -48,6 +48,7 @@ class AliasHandler extends PFAHandler { ' SELECT 1 as __is_mailbox, username as __mailbox_username ' . ' FROM ' . table_by_key('mailbox') . ' WHERE username IS NOT NULL ' . + ' AND ' . db_in_clause($this->domain_field, $this->allowed_domains) . ' ) AS __mailbox ON __mailbox_username = address' ), 'goto_mailbox' => pacol( $mbgoto, $mbgoto,$mbgoto,'bool', 'pEdit_alias_forward_and_store' , '' , 0, /*options*/ '',