summaryrefslogtreecommitdiffstats
path: root/lib/private/lock
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-08-10 14:39:34 +0200
committerRobin Appelman <icewind@owncloud.com>2015-08-10 14:39:34 +0200
commitd979e54030b0069572affe173c06680597cc831d (patch)
tree63d72d28ae9aaaffe841aaa0274cd47263a67232 /lib/private/lock
parent58e96e53b039365751eb8c4a2d511fcfcf507891 (diff)
downloadnextcloud-server-d979e54030b0069572affe173c06680597cc831d.tar.gz
nextcloud-server-d979e54030b0069572affe173c06680597cc831d.zip
log a warning while trying to acquire a db lock from within a transaction
Diffstat (limited to 'lib/private/lock')
-rw-r--r--lib/private/lock/dblockingprovider.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/private/lock/dblockingprovider.php b/lib/private/lock/dblockingprovider.php
index 5480a6e53af..5241a0440b3 100644
--- a/lib/private/lock/dblockingprovider.php
+++ b/lib/private/lock/dblockingprovider.php
@@ -22,6 +22,7 @@
namespace OC\Lock;
use OCP\IDBConnection;
+use OCP\ILogger;
use OCP\Lock\LockedException;
/**
@@ -34,10 +35,17 @@ class DBLockingProvider extends AbstractLockingProvider {
private $connection;
/**
+ * @var \OCP\ILogger
+ */
+ private $logger;
+
+ /**
* @param \OCP\IDBConnection $connection
+ * @param \OCP\ILogger $logger
*/
- public function __construct(IDBConnection $connection) {
+ public function __construct(IDBConnection $connection, ILogger $logger) {
$this->connection = $connection;
+ $this->logger = $logger;
}
protected function initLockField($path) {
@@ -68,6 +76,10 @@ class DBLockingProvider extends AbstractLockingProvider {
* @throws \OCP\Lock\LockedException
*/
public function acquireLock($path, $type) {
+ if ($this->connection->inTransaction()){
+ $this->logger->warning('Trying to acquire a lock while inside a transition');
+ }
+
$this->connection->beginTransaction();
$this->initLockField($path);
if ($type === self::LOCK_SHARED) {