aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/dav/lib/CardDAV/SyncService.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/apps/dav/lib/CardDAV/SyncService.php b/apps/dav/lib/CardDAV/SyncService.php
index cc3d324faf1..8f3ddd83df4 100644
--- a/apps/dav/lib/CardDAV/SyncService.php
+++ b/apps/dav/lib/CardDAV/SyncService.php
@@ -276,9 +276,21 @@ class SyncService {
public function getLocalSystemAddressBook() {
if (is_null($this->localSystemAddressBook)) {
$systemPrincipal = 'principals/system/system';
- $this->localSystemAddressBook = $this->ensureSystemAddressBookExists($systemPrincipal, 'system', [
+ $localSystemAddressBook = $this->ensureSystemAddressBookExists($systemPrincipal, 'system', [
'{' . Plugin::NS_CARDDAV . '}addressbook-description' => 'System addressbook which holds all users of this instance'
]);
+
+ /*
+ * Do not keep a potentially volatile state
+ *
+ * If we are in a transaction, a newly created SAB would be
+ * rolled back if the transaction is rolled back.
+ */
+ if (!$this->dbConnection->inTransaction()) {
+ $this->localSystemAddressBook = $localSystemAddressBook;
+ } else {
+ return $localSystemAddressBook;
+ }
}
return $this->localSystemAddressBook;