Code Duplication    Length = 16-18 lines in 3 locations

lib/private/files/view.php 3 locations

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