|
@@ 2046-2061 (lines=16) @@
|
| 2043 |
|
* |
| 2044 |
|
* @return bool False if the path is excluded from locking, true otherwise |
| 2045 |
|
*/ |
| 2046 |
|
public function lockFile($path, $type, $lockMountPoint = false) { |
| 2047 |
|
$absolutePath = $this->getAbsolutePath($path); |
| 2048 |
|
$absolutePath = Filesystem::normalizePath($absolutePath); |
| 2049 |
|
if (!$this->shouldLockFile($absolutePath)) { |
| 2050 |
|
return false; |
| 2051 |
|
} |
| 2052 |
|
|
| 2053 |
|
$this->lockPath($path, $type, $lockMountPoint); |
| 2054 |
|
|
| 2055 |
|
$parents = $this->getParents($path); |
| 2056 |
|
foreach ($parents as $parent) { |
| 2057 |
|
$this->lockPath($parent, ILockingProvider::LOCK_SHARED); |
| 2058 |
|
} |
| 2059 |
|
|
| 2060 |
|
return true; |
| 2061 |
|
} |
| 2062 |
|
|
| 2063 |
|
/** |
| 2064 |
|
* Unlock a path and all its parents up to the root of the view |
|
@@ 2072-2087 (lines=16) @@
|
| 2069 |
|
* |
| 2070 |
|
* @return bool False if the path is excluded from locking, true otherwise |
| 2071 |
|
*/ |
| 2072 |
|
public function unlockFile($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->unlockPath($path, $type, $lockMountPoint); |
| 2080 |
|
|
| 2081 |
|
$parents = $this->getParents($path); |
| 2082 |
|
foreach ($parents as $parent) { |
| 2083 |
|
$this->unlockPath($parent, ILockingProvider::LOCK_SHARED); |
| 2084 |
|
} |
| 2085 |
|
|
| 2086 |
|
return true; |
| 2087 |
|
} |
| 2088 |
|
|
| 2089 |
|
/** |
| 2090 |
|
* Only lock files in data/user/files/ |