use OCP\AppFramework\Db\TTransactional;
use OCP\AppFramework\Http;
use OCP\Http\Client\IClientService;
+use OCP\IConfig;
use OCP\IDBConnection;
use OCP\IUser;
use OCP\IUserManager;
private Converter $converter;
protected string $certPath;
private IClientService $clientService;
+ private IConfig $config;
public function __construct(CardDavBackend $backend,
IUserManager $userManager,
IDBConnection $dbConnection,
LoggerInterface $logger,
Converter $converter,
- IClientService $clientService) {
+ IClientService $clientService,
+ IConfig $config) {
$this->backend = $backend;
$this->userManager = $userManager;
$this->logger = $logger;
$this->certPath = '';
$this->dbConnection = $dbConnection;
$this->clientService = $clientService;
+ $this->config = $config;
}
/**
$options = [
'auth' => [$userName, $sharedSecret],
'body' => $this->buildSyncCollectionRequestBody($syncToken),
- 'headers' => ['Content-Type' => 'application/xml']
+ 'headers' => ['Content-Type' => 'application/xml'],
+ 'timeout' => $this->config->getSystemValueInt('carddav_sync_request_timeout', 30)
];
$response = $client->request(
use OCA\DAV\CardDAV\SyncService;
use OCP\Http\Client\IClient;
use OCP\Http\Client\IClientService;
+use OCP\IConfig;
use OCP\IDBConnection;
use OCP\IUser;
use OCP\IUserManager;
protected LoggerInterface $logger;
protected Converter $converter;
protected IClient $client;
+ protected IConfig $config;
protected SyncService $service;
public function setUp(): void {
$addressBook = [
$this->logger = new NullLogger();
$this->converter = $this->createMock(Converter::class);
$this->client = $this->createMock(IClient::class);
+ $this->config = $this->createMock(IConfig::class);
$clientService = $this->createMock(IClientService::class);
$clientService->method('newClient')
$this->dbConnection,
$this->logger,
$this->converter,
- $clientService
+ $clientService,
+ $this->config
);
}
$logger = $this->getMockBuilder(LoggerInterface::class)->disableOriginalConstructor()->getMock();
$converter = $this->createMock(Converter::class);
$clientService = $this->createMock(IClientService::class);
+ $config = $this->createMock(IConfig::class);
- $ss = new SyncService($backend, $userManager, $dbConnection, $logger, $converter, $clientService);
+ $ss = new SyncService($backend, $userManager, $dbConnection, $logger, $converter, $clientService, $config);
$ss->ensureSystemAddressBookExists('principals/users/adam', 'contacts', []);
}
->willReturn($this->createMock(VCard::class));
$clientService = $this->createMock(IClientService::class);
+ $config = $this->createMock(IConfig::class);
- $ss = new SyncService($backend, $userManager, $dbConnection, $logger, $converter, $clientService);
+ $ss = new SyncService($backend, $userManager, $dbConnection, $logger, $converter, $clientService, $config);
$ss->updateUser($user);
$ss->updateUser($user);
*/
'davstorage.request_timeout' => 30,
+/**
+ * The timeout in seconds for synchronizing address books, e.g. federated system address books (as run by `occ federation:sync-addressbooks`).
+ *
+ * Defaults to ``30`` seconds
+ */
+'carddav_sync_request_timeout' => 30,
+
/**
* `true` enabled a relaxed session timeout, where the session timeout would no longer be
* handled by Nextcloud but by either the PHP garbage collection or the expiration of