summaryrefslogtreecommitdiffstats
path: root/lib/private/Lock/DBLockingProvider.php
diff options
context:
space:
mode:
authorOle Ostergaard <ole.ostergaard@knime.com>2019-01-21 17:54:16 +0100
committerOle Ostergaard <ole.c.ostergaard@gmail.com>2019-03-21 11:42:00 +0100
commita48ea8cffa68540b704bead86456008d6978a91b (patch)
treeae136c49e1a8c24744a1d21c65b777a0ea9b53c7 /lib/private/Lock/DBLockingProvider.php
parent0155edc195ed278a2a4d06c15295433ae0ae8445 (diff)
downloadnextcloud-server-a48ea8cffa68540b704bead86456008d6978a91b.tar.gz
nextcloud-server-a48ea8cffa68540b704bead86456008d6978a91b.zip
Add insertIgnoreConflict to Adapter and use it for for executing the file locking.
Signed-off-by: Ole Ostergaard <ole.c.ostergaard@gmail.com>
Diffstat (limited to 'lib/private/Lock/DBLockingProvider.php')
-rw-r--r--lib/private/Lock/DBLockingProvider.php12
1 files changed, 1 insertions, 11 deletions
diff --git a/lib/private/Lock/DBLockingProvider.php b/lib/private/Lock/DBLockingProvider.php
index 6d9c8f1b3d1..a1859047fe6 100644
--- a/lib/private/Lock/DBLockingProvider.php
+++ b/lib/private/Lock/DBLockingProvider.php
@@ -134,17 +134,7 @@ class DBLockingProvider extends AbstractLockingProvider {
protected function initLockField(string $path, int $lock = 0): int {
$expire = $this->getExpireTime();
-
- try {
- $builder = $this->connection->getQueryBuilder();
- return $builder->insert('file_locks')
- ->setValue('key', $builder->createNamedParameter($path))
- ->setValue('lock', $builder->createNamedParameter($lock))
- ->setValue('ttl', $builder->createNamedParameter($expire))
- ->execute();
- } catch(UniqueConstraintViolationException $e) {
- return 0;
- }
+ return $this->connection->insertIgnoreConflict('file_locks', ['key' => $path, 'lock' => $lock, 'ttl' => $expire]);
}
/**