Skip to content

Commit

Permalink
tweak(Tinebase/Modlog): don't send replication login problems to sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
pschuele committed Mar 26, 2024
1 parent 1897586 commit 3e651ff
Showing 1 changed file with 33 additions and 24 deletions.
57 changes: 33 additions & 24 deletions tine20/Tinebase/Timemachine/ModificationLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,30 +211,32 @@ protected function _deleteModlogsByModel(array $models): int

if (!$appNotFound) {

if ($app instanceof Tinebase_Container) {
$backend = $app;
} else if ($app instanceof Tinebase_User_Sql || $app instanceof Tinebase_Tree_FileObject) {
// TODO make those backends work / refactor them
continue;
} else {
if (!$app instanceof Tinebase_Controller_Record_Abstract) {
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG))
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__
. ' model: ' . $model . ' controller: ' . get_class($app)
. ' not an instance of Tinebase_Controller_Record_Abstract');
continue;
if ($app instanceof Tinebase_Container) {
$backend = $app;
} elseif ($app instanceof Tinebase_User_Sql || $app instanceof Tinebase_Tree_FileObject) {
// TODO make those backends work / refactor them
continue;
} else {
if (!$app instanceof Tinebase_Controller_Record_Abstract) {
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__
. ' model: ' . $model . ' controller: ' . get_class($app)
. ' not an instance of Tinebase_Controller_Record_Abstract');
}
continue;
}

$backend = $app->getBackend();
}

if (!$backend instanceof Tinebase_Backend_Interface) {
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG))
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__
. ' model: ' . $model . ' backend: ' . get_class($backend)
. ' not an instance of Tinebase_Backend_Interface');
continue;
if (!$backend instanceof Tinebase_Backend_Interface) {
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__
. ' model: ' . $model . ' backend: ' . get_class($backend)
. ' not an instance of Tinebase_Backend_Interface');
}
continue;
}

/** @var Tinebase_Record_Interface $record */
$record = new $model(null, true);
Expand Down Expand Up @@ -1529,18 +1531,25 @@ public function readModificationLogFromMaster()
try {
$authResponse = $tine20Service->login($tine20LoginName, $tine20Password);
} catch (Exception $e) {
Tinebase_Exception::log($e);
if (! $e instanceof Zend_Service_Exception && ! $e instanceof Zend_Json_Exception) {
Tinebase_Exception::log($e);
}
}
if (!is_array($authResponse) || !isset($authResponse['success']) || $authResponse['success'] !== true) {
if (Tinebase_Core::isLogLevel(Zend_Log::ERR)) Tinebase_Core::getLogger()->err(__METHOD__ . '::' . __LINE__ .
' Could not login: ' . print_r($authResponse, true));
if (Tinebase_Core::isLogLevel(Zend_Log::ERR)) {
Tinebase_Core::getLogger()->err(
__METHOD__ . '::' . __LINE__ .
' Could not login: ' . print_r($authResponse, true)
);
}
throw new Tinebase_Exception_AccessDenied('login failed');
}
unset($authResponse);

//get replication state:
$masterReplicationId = intval(Tinebase_Application::getInstance()->getApplicationState('Tinebase',
Tinebase_Application::STATE_REPLICATION_MASTER_ID));
$masterReplicationId = intval(Tinebase_Application::getInstance()->getApplicationState(
'Tinebase',
Tinebase_Application::STATE_REPLICATION_MASTER_ID
));

if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ .
Expand Down

0 comments on commit 3e651ff

Please sign in to comment.