[Pkg-owncloud-commits] [owncloud] 66/107: Remove all locks after ttl from the db

David Prévot taffit at moszumanska.debian.org
Thu Dec 17 19:40:37 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch stable8
in repository owncloud.

commit b2eecfb946e5697e3d3b4f660278519b892094ba
Author: Robin Appelman <icewind at owncloud.com>
Date:   Wed Dec 9 14:13:05 2015 +0100

    Remove all locks after ttl from the db
---
 lib/private/lock/dblockingprovider.php | 6 +++---
 tests/lib/lock/dblockingprovider.php   | 8 +-------
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/lib/private/lock/dblockingprovider.php b/lib/private/lock/dblockingprovider.php
index a167687..f00f112 100644
--- a/lib/private/lock/dblockingprovider.php
+++ b/lib/private/lock/dblockingprovider.php
@@ -233,10 +233,10 @@ class DBLockingProvider extends AbstractLockingProvider {
 	/**
 	 * cleanup empty locks
 	 */
-	public function cleanEmptyLocks() {
+	public function cleanExpiredLocks() {
 		$expire = $this->timeFactory->getTime();
 		$this->connection->executeUpdate(
-			'DELETE FROM `*PREFIX*file_locks` WHERE `lock` = 0 AND `ttl` < ?',
+			'DELETE FROM `*PREFIX*file_locks` WHERE `ttl` < ?',
 			[$expire]
 		);
 	}
@@ -260,7 +260,7 @@ class DBLockingProvider extends AbstractLockingProvider {
 
 	public function __destruct() {
 		try {
-			$this->cleanEmptyLocks();
+			$this->cleanExpiredLocks();
 		} catch (\Exception $e) {
 			// If the table is missing, the clean up was successful
 			if ($this->connection->tableExists('file_locks')) {
diff --git a/tests/lib/lock/dblockingprovider.php b/tests/lib/lock/dblockingprovider.php
index 2360052..0b35a9f 100644
--- a/tests/lib/lock/dblockingprovider.php
+++ b/tests/lib/lock/dblockingprovider.php
@@ -78,13 +78,7 @@ class DBLockingProvider extends LockingProvider {
 
 		$this->assertEquals(3, $this->getLockEntryCount());
 
-		$this->instance->cleanEmptyLocks();
-
-		$this->assertEquals(3, $this->getLockEntryCount());
-
-		$this->instance->releaseAll();
-
-		$this->instance->cleanEmptyLocks();
+		$this->instance->cleanExpiredLocks();
 
 		$this->assertEquals(2, $this->getLockEntryCount());
 	}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list