Code Duplication    Length = 10-14 lines in 3 locations

apps/files_sharing/lib/helper.php 1 location

@@ 207-216 (lines=10) @@
204
		return $result;
205
	}
206
207
	public static function getUidAndFilename($filename) {
208
		$uid = \OC\Files\Filesystem::getOwner($filename);
209
		\OC\Files\Filesystem::initMountPoints($uid);
210
		if ( $uid != \OCP\User::getUser() ) {
211
			$info = \OC\Files\Filesystem::getFileInfo($filename);
212
			$ownerView = new \OC\Files\View('/'.$uid.'/files');
213
			$filename = $ownerView->getPath($info['fileid']);
214
		}
215
		return array($uid, $filename);
216
	}
217
218
	/**
219
	 * Format a path to be relative to the /user/files/ directory

apps/files_trashbin/lib/trashbin.php 1 location

@@ 73-86 (lines=14) @@
70
	 * @return array
71
	 * @throws \OC\User\NoUserException
72
	 */
73
	public static function getUidAndFilename($filename) {
74
		$uid = \OC\Files\Filesystem::getOwner($filename);
75
		\OC\Files\Filesystem::initMountPoints($uid);
76
		if ($uid != \OCP\User::getUser()) {
77
			$info = \OC\Files\Filesystem::getFileInfo($filename);
78
			$ownerView = new \OC\Files\View('/' . $uid . '/files');
79
			try {
80
				$filename = $ownerView->getPath($info['fileid']);
81
			} catch (NotFoundException $e) {
82
				$filename = null;
83
			}
84
		}
85
		return [$uid, $filename];
86
	}
87
88
	/**
89
	 * get original location of files for user

apps/files_versions/lib/storage.php 1 location

@@ 83-96 (lines=14) @@
80
	 * @return array
81
	 * @throws \OC\User\NoUserException
82
	 */
83
	public static function getUidAndFilename($filename) {
84
		$uid = \OC\Files\Filesystem::getOwner($filename);
85
		\OC\Files\Filesystem::initMountPoints($uid);
86
		if ( $uid != \OCP\User::getUser() ) {
87
			$info = \OC\Files\Filesystem::getFileInfo($filename);
88
			$ownerView = new \OC\Files\View('/'.$uid.'/files');
89
			try {
90
				$filename = $ownerView->getPath($info['fileid']);
91
			} catch (NotFoundException $e) {
92
				$filename = null;
93
			}
94
		}
95
		return [$uid, $filename];
96
	}
97
98
	/**
99
	 * Remember the owner and the owner path of the source file