|
@@ 1902-1919 (lines=18) @@
|
| 1899 |
|
* |
| 1900 |
|
* @return bool False if the path is excluded from locking, true otherwise |
| 1901 |
|
*/ |
| 1902 |
|
private function unlockPath($path, $type, $lockMountPoint = false) { |
| 1903 |
|
$absolutePath = $this->getAbsolutePath($path); |
| 1904 |
|
$absolutePath = Filesystem::normalizePath($absolutePath); |
| 1905 |
|
if (!$this->shouldLockFile($absolutePath)) { |
| 1906 |
|
return false; |
| 1907 |
|
} |
| 1908 |
|
|
| 1909 |
|
$mount = $this->getMountForLock($absolutePath, $lockMountPoint); |
| 1910 |
|
if ($mount) { |
| 1911 |
|
$mount->getStorage()->releaseLock( |
| 1912 |
|
$mount->getInternalPath($absolutePath), |
| 1913 |
|
$type, |
| 1914 |
|
$this->lockingProvider |
| 1915 |
|
); |
| 1916 |
|
} |
| 1917 |
|
|
| 1918 |
|
return true; |
| 1919 |
|
} |
| 1920 |
|
|
| 1921 |
|
/** |
| 1922 |
|
* Lock a path and all its parents up to the root of the view |
|
@@ 1930-1945 (lines=16) @@
|
| 1927 |
|
* |
| 1928 |
|
* @return bool False if the path is excluded from locking, true otherwise |
| 1929 |
|
*/ |
| 1930 |
|
public function lockFile($path, $type, $lockMountPoint = false) { |
| 1931 |
|
$absolutePath = $this->getAbsolutePath($path); |
| 1932 |
|
$absolutePath = Filesystem::normalizePath($absolutePath); |
| 1933 |
|
if (!$this->shouldLockFile($absolutePath)) { |
| 1934 |
|
return false; |
| 1935 |
|
} |
| 1936 |
|
|
| 1937 |
|
$this->lockPath($path, $type, $lockMountPoint); |
| 1938 |
|
|
| 1939 |
|
$parents = $this->getParents($path); |
| 1940 |
|
foreach ($parents as $parent) { |
| 1941 |
|
$this->lockPath($parent, ILockingProvider::LOCK_SHARED); |
| 1942 |
|
} |
| 1943 |
|
|
| 1944 |
|
return true; |
| 1945 |
|
} |
| 1946 |
|
|
| 1947 |
|
/** |
| 1948 |
|
* Unlock a path and all its parents up to the root of the view |
|
@@ 1956-1971 (lines=16) @@
|
| 1953 |
|
* |
| 1954 |
|
* @return bool False if the path is excluded from locking, true otherwise |
| 1955 |
|
*/ |
| 1956 |
|
public function unlockFile($path, $type, $lockMountPoint = false) { |
| 1957 |
|
$absolutePath = $this->getAbsolutePath($path); |
| 1958 |
|
$absolutePath = Filesystem::normalizePath($absolutePath); |
| 1959 |
|
if (!$this->shouldLockFile($absolutePath)) { |
| 1960 |
|
return false; |
| 1961 |
|
} |
| 1962 |
|
|
| 1963 |
|
$this->unlockPath($path, $type, $lockMountPoint); |
| 1964 |
|
|
| 1965 |
|
$parents = $this->getParents($path); |
| 1966 |
|
foreach ($parents as $parent) { |
| 1967 |
|
$this->unlockPath($parent, ILockingProvider::LOCK_SHARED); |
| 1968 |
|
} |
| 1969 |
|
|
| 1970 |
|
return true; |
| 1971 |
|
} |
| 1972 |
|
|
| 1973 |
|
/** |
| 1974 |
|
* Only lock files in data/user/files/ |