diff options
Diffstat (limited to 'apps/federation/lib/SyncFederationAddressBooks.php')
-rw-r--r-- | apps/federation/lib/SyncFederationAddressBooks.php | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/apps/federation/lib/SyncFederationAddressBooks.php b/apps/federation/lib/SyncFederationAddressBooks.php index c17cb7618bf..401fd19bd75 100644 --- a/apps/federation/lib/SyncFederationAddressBooks.php +++ b/apps/federation/lib/SyncFederationAddressBooks.php @@ -29,19 +29,23 @@ use OC\OCS\DiscoveryService; use OCA\DAV\CardDAV\SyncService; use OCP\AppFramework\Http; use OCP\OCS\IDiscoveryService; +use Psr\Log\LoggerInterface; class SyncFederationAddressBooks { protected DbHandler $dbHandler; private SyncService $syncService; private DiscoveryService $ocsDiscoveryService; + private LoggerInterface $logger; public function __construct(DbHandler $dbHandler, SyncService $syncService, - IDiscoveryService $ocsDiscoveryService + IDiscoveryService $ocsDiscoveryService, + LoggerInterface $logger ) { $this->syncService = $syncService; $this->dbHandler = $dbHandler; $this->ocsDiscoveryService = $ocsDiscoveryService; + $this->logger = $logger; } /** @@ -60,6 +64,7 @@ class SyncFederationAddressBooks { $addressBookUrl = isset($endPoints['system-address-book']) ? trim($endPoints['system-address-book'], '/') : 'remote.php/dav/addressbooks/system/system/system'; if (is_null($sharedSecret)) { + $this->logger->debug("Shared secret for $url is null"); continue; } $targetBookId = $trustedServer['url_hash']; @@ -71,10 +76,16 @@ class SyncFederationAddressBooks { $newToken = $this->syncService->syncRemoteAddressBook($url, $cardDavUser, $addressBookUrl, $sharedSecret, $syncToken, $targetBookId, $targetPrincipal, $targetBookProperties); if ($newToken !== $syncToken) { $this->dbHandler->setServerStatus($url, TrustedServers::STATUS_OK, $newToken); + } else { + $this->logger->debug("Sync Token for $url unchanged from previous sync"); } } catch (\Exception $ex) { if ($ex->getCode() === Http::STATUS_UNAUTHORIZED) { $this->dbHandler->setServerStatus($url, TrustedServers::STATUS_ACCESS_REVOKED); + $this->logger->error("Server sync for $url failed because of revoked access."); + } else { + $this->dbHandler->setServerStatus($url, TrustedServers::STATUS_FAILURE); + $this->logger->error("Server sync for $url failed."); } $callback($url, $ex); } |