From 547f28fe3d2626e31c8d75b83c549a907708b766 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 25 May 2021 17:47:25 +0200 Subject: [PATCH] report and log enabling push (and other IMAP errors) don't switch regular reload handling off in that case --- api/src/Mail/Imap.php | 12 +++++++++++- api/src/loader/exception.php | 3 ++- mail/inc/class.mail_ui.inc.php | 6 +++--- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/api/src/Mail/Imap.php b/api/src/Mail/Imap.php index 494b039e92..292e88e536 100644 --- a/api/src/Mail/Imap.php +++ b/api/src/Mail/Imap.php @@ -1518,7 +1518,17 @@ class Imap extends Horde_Imap_Client_Socket implements Imap\PushIface self::METADATA_NAME => self::METADATA_PREFIX.implode(self::METADATA_SEPARATOR, $metadata), ]); } - catch (Horde_Imap_Client_Exception $e) { + catch (\Horde_Imap_Client_Exception $e) { + if (Api\Json\Response::isJSONResponse()) + { + // report error to user once per session + Api\Cache::getSession(__CLASS__, __FUNCTION__, static function() use ($e) + { + Api\Json\Response::get()->message(lang("Error enabling push")."\n". + $e->getMessage().(!empty($e->details) ? "\n".$e->details : ''), 'error'); + return false; + }); + } _egw_log_exception($e); return false; } diff --git a/api/src/loader/exception.php b/api/src/loader/exception.php index b685a87201..21fb53b8b5 100755 --- a/api/src/loader/exception.php +++ b/api/src/loader/exception.php @@ -69,7 +69,8 @@ function _egw_log_exception($e,&$headline=null) // which outputs the error_log to stderr and therefore output it twice to the user if(isset($_SERVER['HTTP_HOST']) || $GLOBALS['egw_info']['flags']['no_exception_handler'] !== 'cli') { - error_log($headline.($e instanceof egw_exception_warning ? ': ' : ' ('.get_class($e).'): ').$e->getMessage()); + error_log($headline.($e instanceof egw_exception_warning ? ': ' : ' ('.get_class($e).'): '). + $e->getMessage().(!empty($e->details) ? ': '.$e->details : '')); foreach($trace as $line) { error_log($line); diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index b34eccdb16..a3fcba05bf 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -1558,12 +1558,12 @@ class mail_ui } if (empty($query['selectedFolder'])) $query['selectedFolder'] = $mail_ui->mail_bo->profileID.self::$delimiter.'INBOX'; } - // enable push notifications, if supported (and konfigured) by the server + // enable push notifications, if supported (and configured) by the server if ($mail_ui->mail_bo->icServer instanceof Api\Mail\Imap\PushIface && $mail_ui->mail_bo->icServer->pushAvailable()) { - $mail_ui->mail_bo->icServer->enablePush(); - Api\Json\Response::get()->call('app.mail.disable_autorefresh', true); + Api\Json\Response::get()->call('app.mail.disable_autorefresh', + $mail_ui->mail_bo->icServer->enablePush()); } else {