report and log enabling push (and other IMAP errors)

don't switch regular reload handling off in that case
This commit is contained in:
Ralf Becker 2021-05-25 17:47:25 +02:00
parent 2dc83c410c
commit 547f28fe3d
3 changed files with 16 additions and 5 deletions

View File

@ -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), 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); _egw_log_exception($e);
return false; return false;
} }

View File

@ -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 // 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') 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) foreach($trace as $line)
{ {
error_log($line); error_log($line);

View File

@ -1558,12 +1558,12 @@ class mail_ui
} }
if (empty($query['selectedFolder'])) $query['selectedFolder'] = $mail_ui->mail_bo->profileID.self::$delimiter.'INBOX'; 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 && if ($mail_ui->mail_bo->icServer instanceof Api\Mail\Imap\PushIface &&
$mail_ui->mail_bo->icServer->pushAvailable()) $mail_ui->mail_bo->icServer->pushAvailable())
{ {
$mail_ui->mail_bo->icServer->enablePush(); Api\Json\Response::get()->call('app.mail.disable_autorefresh',
Api\Json\Response::get()->call('app.mail.disable_autorefresh', true); $mail_ui->mail_bo->icServer->enablePush());
} }
else else
{ {