|
@@ 2035-2050 (lines=16) @@
|
| 2032 |
|
* |
| 2033 |
|
* @return bool False if the path is excluded from locking, true otherwise |
| 2034 |
|
*/ |
| 2035 |
|
public function lockFile($path, $type, $lockMountPoint = false) { |
| 2036 |
|
$absolutePath = $this->getAbsolutePath($path); |
| 2037 |
|
$absolutePath = Filesystem::normalizePath($absolutePath); |
| 2038 |
|
if (!$this->shouldLockFile($absolutePath)) { |
| 2039 |
|
return false; |
| 2040 |
|
} |
| 2041 |
|
|
| 2042 |
|
$this->lockPath($path, $type, $lockMountPoint); |
| 2043 |
|
|
| 2044 |
|
$parents = $this->getParents($path); |
| 2045 |
|
foreach ($parents as $parent) { |
| 2046 |
|
$this->lockPath($parent, ILockingProvider::LOCK_SHARED); |
| 2047 |
|
} |
| 2048 |
|
|
| 2049 |
|
return true; |
| 2050 |
|
} |
| 2051 |
|
|
| 2052 |
|
/** |
| 2053 |
|
* Unlock a path and all its parents up to the root of the view |
|
@@ 2061-2076 (lines=16) @@
|
| 2058 |
|
* |
| 2059 |
|
* @return bool False if the path is excluded from locking, true otherwise |
| 2060 |
|
*/ |
| 2061 |
|
public function unlockFile($path, $type, $lockMountPoint = false) { |
| 2062 |
|
$absolutePath = $this->getAbsolutePath($path); |
| 2063 |
|
$absolutePath = Filesystem::normalizePath($absolutePath); |
| 2064 |
|
if (!$this->shouldLockFile($absolutePath)) { |
| 2065 |
|
return false; |
| 2066 |
|
} |
| 2067 |
|
|
| 2068 |
|
$this->unlockPath($path, $type, $lockMountPoint); |
| 2069 |
|
|
| 2070 |
|
$parents = $this->getParents($path); |
| 2071 |
|
foreach ($parents as $parent) { |
| 2072 |
|
$this->unlockPath($parent, ILockingProvider::LOCK_SHARED); |
| 2073 |
|
} |
| 2074 |
|
|
| 2075 |
|
return true; |
| 2076 |
|
} |
| 2077 |
|
|
| 2078 |
|
/** |
| 2079 |
|
* Only lock files in data/user/files/ |