Code Duplication    Length = 16-18 lines in 3 locations

lib/private/files/view.php 3 locations

@@ 1863-1880 (lines=18) @@
1860
	 *
1861
	 * @return bool False if the path is excluded from locking, true otherwise
1862
	 */
1863
	private function unlockPath($path, $type, $lockMountPoint = false) {
1864
		$absolutePath = $this->getAbsolutePath($path);
1865
		$absolutePath = Filesystem::normalizePath($absolutePath);
1866
		if (!$this->shouldLockFile($absolutePath)) {
1867
			return false;
1868
		}
1869
1870
		$mount = $this->getMountForLock($absolutePath, $lockMountPoint);
1871
		if ($mount) {
1872
			$mount->getStorage()->releaseLock(
1873
				$mount->getInternalPath($absolutePath),
1874
				$type,
1875
				$this->lockingProvider
1876
			);
1877
		}
1878
1879
		return true;
1880
	}
1881
1882
	/**
1883
	 * Lock a path and all its parents up to the root of the view
@@ 1891-1906 (lines=16) @@
1888
	 *
1889
	 * @return bool False if the path is excluded from locking, true otherwise
1890
	 */
1891
	public function lockFile($path, $type, $lockMountPoint = false) {
1892
		$absolutePath = $this->getAbsolutePath($path);
1893
		$absolutePath = Filesystem::normalizePath($absolutePath);
1894
		if (!$this->shouldLockFile($absolutePath)) {
1895
			return false;
1896
		}
1897
1898
		$this->lockPath($path, $type, $lockMountPoint);
1899
1900
		$parents = $this->getParents($path);
1901
		foreach ($parents as $parent) {
1902
			$this->lockPath($parent, ILockingProvider::LOCK_SHARED);
1903
		}
1904
1905
		return true;
1906
	}
1907
1908
	/**
1909
	 * Unlock a path and all its parents up to the root of the view
@@ 1917-1932 (lines=16) @@
1914
	 *
1915
	 * @return bool False if the path is excluded from locking, true otherwise
1916
	 */
1917
	public function unlockFile($path, $type, $lockMountPoint = false) {
1918
		$absolutePath = $this->getAbsolutePath($path);
1919
		$absolutePath = Filesystem::normalizePath($absolutePath);
1920
		if (!$this->shouldLockFile($absolutePath)) {
1921
			return false;
1922
		}
1923
1924
		$this->unlockPath($path, $type, $lockMountPoint);
1925
1926
		$parents = $this->getParents($path);
1927
		foreach ($parents as $parent) {
1928
			$this->unlockPath($parent, ILockingProvider::LOCK_SHARED);
1929
		}
1930
1931
		return true;
1932
	}
1933
1934
	/**
1935
	 * Only lock files in data/user/files/