Display storage errors on refresh/check-recent action (#6474)

pull/6485/head
Aleksander Machniak 6 years ago
parent 0fa9ad11d6
commit bec67c29b4

@ -1930,6 +1930,22 @@ class rcmail extends rcube
} }
} }
/**
* Displays an error message on storage fatal errors
*/
public function storage_fatal_error()
{
$err_code = $this->storage->get_error_code();
switch ($err_code) {
// Not all are really fatal, but these should catch
// connection/authentication errors the best we can
case rcube_imap_generic::ERROR_NO:
case rcube_imap_generic::ERROR_BAD:
case rcube_imap_generic::ERROR_BYE:
$this->display_server_error();
}
}
/** /**
* Output HTML editor scripts * Output HTML editor scripts
* *

@ -54,6 +54,8 @@ else {
$plugin = $RCMAIL->plugins->exec_hook('check_recent', array('folders' => $a_mailboxes, 'all' => $check_all)); $plugin = $RCMAIL->plugins->exec_hook('check_recent', array('folders' => $a_mailboxes, 'all' => $check_all));
$a_mailboxes = $plugin['folders']; $a_mailboxes = $plugin['folders'];
$RCMAIL->storage_fatal_error();
// check recent/unseen counts // check recent/unseen counts
foreach ($a_mailboxes as $mbox_name) { foreach ($a_mailboxes as $mbox_name) {
$is_current = $mbox_name == $current || ($search_request && is_object($_SESSION['search'][1]) && in_array($mbox_name, (array)$_SESSION['search'][1]->get_parameters('MAILBOX'))); $is_current = $mbox_name == $current || ($search_request && is_object($_SESSION['search'][1]) && in_array($mbox_name, (array)$_SESSION['search'][1]->get_parameters('MAILBOX')));
@ -65,6 +67,10 @@ foreach ($a_mailboxes as $mbox_name) {
// Get mailbox status // Get mailbox status
$status = $RCMAIL->storage->folder_status($mbox_name, $diff); $status = $RCMAIL->storage->folder_status($mbox_name, $diff);
if ($is_current) {
$RCMAIL->storage_fatal_error();
}
if ($status & 1) { if ($status & 1) {
// trigger plugin hook // trigger plugin hook
$RCMAIL->plugins->exec_hook('new_messages', $RCMAIL->plugins->exec_hook('new_messages',

Loading…
Cancel
Save