use Sabre\DAV\Client;
use Sabre\DAV\Xml\Response\MultiStatus;
use Sabre\DAV\Xml\Service;
+use Sabre\HTTP\ClientException;
class SyncService {
'Content-Type' => 'application/xml'
]);
-// if ((int)$response->getStatus() >= 400) {
-// throw new Exception('HTTP error: ' . $response->getStatus());
-// }
-
$result = $this->parseMultiStatus($response['body']);
return $result;
$targetBookProperties = [
'{DAV:}displayname' => $url
];
- $newToken = $this->syncService->syncRemoteAddressBook($url, 'system', $sharedSecret, $syncToken, $targetPrincipal, $targetBookId, $targetBookProperties);
- if ($newToken !== $syncToken) {
- $this->dbHandler->setServerStatus($url, TrustedServers::STATUS_OK, $newToken);
+ try {
+ $newToken = $this->syncService->syncRemoteAddressBook($url, 'system', $sharedSecret, $syncToken, $targetPrincipal, $targetBookId, $targetBookProperties);
+ if ($newToken !== $syncToken) {
+ $this->dbHandler->setServerStatus($url, TrustedServers::STATUS_OK, $newToken);
+ }
+ } catch (\Exception $ex) {
+ $output->writeln("Error while syncing $url : " . $ex->getMessage());
}
}
$progress->finish();