improves replication error reporting
authorPhilipp Schüle <p.schuele@metaways.de>
Thu, 3 Aug 2017 11:50:51 +0000 (13:50 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 3 Aug 2017 12:49:10 +0000 (14:49 +0200)
* catch problems when sending mails to
 invalid recipients
* add modlog record to error message

Change-Id: I9e8a2e881ba48dc50558353276bd66a754978634
Reviewed-on: http://gerrit.tine20.com/customers/5385
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/Timemachine/ModificationLog.php

index 6aaac62..c8e5f22 100644 (file)
@@ -1346,14 +1346,19 @@ class Tinebase_Timemachine_ModificationLog implements Tinebase_Controller_Interf
                 if (is_array($config->{Tinebase_Config::ERROR_NOTIFICATION_LIST}) &&
                         count($config->{Tinebase_Config::ERROR_NOTIFICATION_LIST}) > 0) {
 
-                    $recipients = array();
-                    foreach($config->{Tinebase_Config::ERROR_NOTIFICATION_LIST} as $recipient) {
-                        $recipients[] = new Addressbook_Model_Contact(array('email' => $recipient), true);
+                    $plain = "Error applying modlog: \n" . print_r($modification->toArray(), true);
+                    $plain .= "\n\n" . $e->getMessage() . PHP_EOL . PHP_EOL . $e->getTraceAsString();
+
+                    foreach ($config->{Tinebase_Config::ERROR_NOTIFICATION_LIST} as $recipient) {
+                        $recipients = array(new Addressbook_Model_Contact(array('email' => $recipient), true));
+                        try {
+                            Tinebase_Notification::getInstance()->send(Tinebase_Core::getUser(), $recipients,
+                                'replication client error', $plain);
+                        } catch (Exception $e) {
+                            // skipping recipient
+                            Tinebase_Exception::log($e);
+                        }
                     }
-
-                    $plain = $e->getMessage() . PHP_EOL . PHP_EOL . $e->getTraceAsString();
-
-                    Tinebase_Notification::getInstance()->send(Tinebase_Core::getUser(), $recipients, 'replication client error', $plain);
                 }
 
                 // must not happen, continuing pointless!