|
@@ 2000-2015 (lines=16) @@
|
| 1997 |
|
* |
| 1998 |
|
* @return bool False if the path is excluded from locking, true otherwise |
| 1999 |
|
*/ |
| 2000 |
|
public function lockFile($path, $type, $lockMountPoint = false) { |
| 2001 |
|
$absolutePath = $this->getAbsolutePath($path); |
| 2002 |
|
$absolutePath = Filesystem::normalizePath($absolutePath); |
| 2003 |
|
if (!$this->shouldLockFile($absolutePath)) { |
| 2004 |
|
return false; |
| 2005 |
|
} |
| 2006 |
|
|
| 2007 |
|
$this->lockPath($path, $type, $lockMountPoint); |
| 2008 |
|
|
| 2009 |
|
$parents = $this->getParents($path); |
| 2010 |
|
foreach ($parents as $parent) { |
| 2011 |
|
$this->lockPath($parent, ILockingProvider::LOCK_SHARED); |
| 2012 |
|
} |
| 2013 |
|
|
| 2014 |
|
return true; |
| 2015 |
|
} |
| 2016 |
|
|
| 2017 |
|
/** |
| 2018 |
|
* Unlock a path and all its parents up to the root of the view |
|
@@ 2026-2041 (lines=16) @@
|
| 2023 |
|
* |
| 2024 |
|
* @return bool False if the path is excluded from locking, true otherwise |
| 2025 |
|
*/ |
| 2026 |
|
public function unlockFile($path, $type, $lockMountPoint = false) { |
| 2027 |
|
$absolutePath = $this->getAbsolutePath($path); |
| 2028 |
|
$absolutePath = Filesystem::normalizePath($absolutePath); |
| 2029 |
|
if (!$this->shouldLockFile($absolutePath)) { |
| 2030 |
|
return false; |
| 2031 |
|
} |
| 2032 |
|
|
| 2033 |
|
$this->unlockPath($path, $type, $lockMountPoint); |
| 2034 |
|
|
| 2035 |
|
$parents = $this->getParents($path); |
| 2036 |
|
foreach ($parents as $parent) { |
| 2037 |
|
$this->unlockPath($parent, ILockingProvider::LOCK_SHARED); |
| 2038 |
|
} |
| 2039 |
|
|
| 2040 |
|
return true; |
| 2041 |
|
} |
| 2042 |
|
|
| 2043 |
|
/** |
| 2044 |
|
* Only lock files in data/user/files/ |