[Pkg-owncloud-commits] [owncloud] 48/131: only lock the parent folders

David Prévot taffit at moszumanska.debian.org
Tue Aug 11 15:58:30 UTC 2015


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

taffit pushed a commit to annotated tag v8.1.1
in repository owncloud.

commit db21b0964c669425331b5c6faec8aef0d47c3584
Author: Robin Appelman <icewind at owncloud.com>
Date:   Tue Jun 30 13:49:54 2015 +0200

    only lock the parent folders
---
 apps/files_sharing/lib/sharedstorage.php |  4 ++--
 apps/files_sharing/tests/locking.php     | 11 +++++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php
index e54f747..ff01489 100644
--- a/apps/files_sharing/lib/sharedstorage.php
+++ b/apps/files_sharing/lib/sharedstorage.php
@@ -632,7 +632,7 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage {
 		// lock the parent folders of the owner when locking the share as recipient
 		if ($path === '') {
 			$sourcePath = $this->ownerView->getPath($this->share['file_source']);
-			$this->ownerView->lockFile($sourcePath, ILockingProvider::LOCK_SHARED, true);
+			$this->ownerView->lockFile(dirname($sourcePath), ILockingProvider::LOCK_SHARED, true);
 		}
 	}
 
@@ -648,7 +648,7 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage {
 		// unlock the parent folders of the owner when unlocking the share as recipient
 		if ($path === '') {
 			$sourcePath = $this->ownerView->getPath($this->share['file_source']);
-			$this->ownerView->unlockFile($sourcePath, ILockingProvider::LOCK_SHARED, true);
+			$this->ownerView->unlockFile(dirname($sourcePath), ILockingProvider::LOCK_SHARED, true);
 		}
 	}
 
diff --git a/apps/files_sharing/tests/locking.php b/apps/files_sharing/tests/locking.php
index 46afbf2..6d13fc1 100644
--- a/apps/files_sharing/tests/locking.php
+++ b/apps/files_sharing/tests/locking.php
@@ -87,4 +87,15 @@ class Locking extends TestCase {
 
 		$this->assertTrue(Filesystem::rename('/foo', '/asd'));
 	}
+
+	public function testChangeLock() {
+
+		Filesystem::initMountPoints($this->recipientUid);
+		$recipientView = new View('/' . $this->recipientUid . '/files');
+		$recipientView->lockFile('bar.txt', ILockingProvider::LOCK_SHARED);
+		$recipientView->changeLock('bar.txt', ILockingProvider::LOCK_EXCLUSIVE);
+		$recipientView->unlockFile('bar.txt', ILockingProvider::LOCK_EXCLUSIVE);
+
+		$this->assertTrue(true);
+	}
 }

-- 
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