diff options
author | Glandos <bugs-github@antipoul.fr> | 2014-03-26 18:34:15 +0400 |
---|---|---|
committer | Glandos <bugs-github@antipoul.fr> | 2014-03-26 18:34:15 +0400 |
commit | c7aea2676b8060a9e2ef814066610672cf460886 (patch) | |
tree | c57426f1a7a3dbb21acb89b6b97b8fce115f1224 /user_external | |
parent | bf446e015fdbd2ef59b05479a8327960adb8dfd1 (diff) |
Small performance improvement on imap_open
Use the OP_HALFOPEN flag to reduce server load. We don't need to open a mailbox, so just don't try
I've also make the check clearer for the opened connection (I know, 2 PR in one, it's bad…)
Diffstat (limited to 'user_external')
-rw-r--r-- | user_external/lib/imap.php | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/user_external/lib/imap.php b/user_external/lib/imap.php index 19e792ddf..c39593ce4 100644 --- a/user_external/lib/imap.php +++ b/user_external/lib/imap.php @@ -42,10 +42,10 @@ class OC_User_IMAP extends \OCA\user_external\Base { OCP\Util::writeLog('user_external', 'ERROR: PHP imap extension is not installed', OCP\Util::ERROR); return false; } - $mbox = @imap_open($this->mailbox, $uid, $password); + $mbox = @imap_open($this->mailbox, $uid, $password, OP_HALFOPEN); imap_errors(); imap_alerts(); - if($mbox) { + if($mbox !== FALSE) { imap_close($mbox); $this->storeUser($uid); return $uid; |