@@ 2072-2087 (lines=16) @@ | ||
2069 | * |
|
2070 | * @return bool False if the path is excluded from locking, true otherwise |
|
2071 | */ |
|
2072 | public function lockFile($path, $type, $lockMountPoint = false) { |
|
2073 | $absolutePath = $this->getAbsolutePath($path); |
|
2074 | $absolutePath = Filesystem::normalizePath($absolutePath); |
|
2075 | if (!$this->shouldLockFile($absolutePath)) { |
|
2076 | return false; |
|
2077 | } |
|
2078 | ||
2079 | $this->lockPath($path, $type, $lockMountPoint); |
|
2080 | ||
2081 | $parents = $this->getParents($path); |
|
2082 | foreach ($parents as $parent) { |
|
2083 | $this->lockPath($parent, ILockingProvider::LOCK_SHARED); |
|
2084 | } |
|
2085 | ||
2086 | return true; |
|
2087 | } |
|
2088 | ||
2089 | /** |
|
2090 | * Unlock a path and all its parents up to the root of the view |
|
@@ 2098-2113 (lines=16) @@ | ||
2095 | * |
|
2096 | * @return bool False if the path is excluded from locking, true otherwise |
|
2097 | */ |
|
2098 | public function unlockFile($path, $type, $lockMountPoint = false) { |
|
2099 | $absolutePath = $this->getAbsolutePath($path); |
|
2100 | $absolutePath = Filesystem::normalizePath($absolutePath); |
|
2101 | if (!$this->shouldLockFile($absolutePath)) { |
|
2102 | return false; |
|
2103 | } |
|
2104 | ||
2105 | $this->unlockPath($path, $type, $lockMountPoint); |
|
2106 | ||
2107 | $parents = $this->getParents($path); |
|
2108 | foreach ($parents as $parent) { |
|
2109 | $this->unlockPath($parent, ILockingProvider::LOCK_SHARED); |
|
2110 | } |
|
2111 | ||
2112 | return true; |
|
2113 | } |
|
2114 | ||
2115 | /** |
|
2116 | * Only lock files in data/user/files/ |