diff options
author | Robin Appelman <icewind@owncloud.com> | 2015-12-10 14:14:54 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-01-11 11:40:58 +0100 |
commit | 300eb54c871cfe48165ee32ecdc5067226aa0b7b (patch) | |
tree | 4ed24210cce449f439ec1c30e5dced7f9e71b1e3 /apps | |
parent | fd2e1086c69e2c4c237e8ceab06f8948983bbb17 (diff) | |
download | nextcloud-server-300eb54c871cfe48165ee32ecdc5067226aa0b7b.tar.gz nextcloud-server-300eb54c871cfe48165ee32ecdc5067226aa0b7b.zip |
de-deplicate getUidAndFilename
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/lib/helper.php | 10 | ||||
-rw-r--r-- | apps/files_trashbin/lib/trashbin.php | 13 | ||||
-rw-r--r-- | apps/files_versions/lib/storage.php | 14 |
3 files changed, 5 insertions, 32 deletions
diff --git a/apps/files_sharing/lib/helper.php b/apps/files_sharing/lib/helper.php index 391b491e1ff..cfc9033f3be 100644 --- a/apps/files_sharing/lib/helper.php +++ b/apps/files_sharing/lib/helper.php @@ -28,6 +28,7 @@ */ namespace OCA\Files_Sharing; +use OC\Files\Filesystem; use OCP\Files\NotFoundException; class Helper { @@ -205,14 +206,7 @@ class Helper { } public static function getUidAndFilename($filename) { - $uid = \OC\Files\Filesystem::getOwner($filename); - \OC\Files\Filesystem::initMountPoints($uid); - if ( $uid != \OCP\User::getUser() ) { - $info = \OC\Files\Filesystem::getFileInfo($filename); - $ownerView = new \OC\Files\View('/'.$uid.'/files'); - $filename = $ownerView->getPath($info['fileid']); - } - return array($uid, $filename); + return Filesystem::getView()->getUidAndFilename($filename); } /** diff --git a/apps/files_trashbin/lib/trashbin.php b/apps/files_trashbin/lib/trashbin.php index bd6798f0eff..874aceaad10 100644 --- a/apps/files_trashbin/lib/trashbin.php +++ b/apps/files_trashbin/lib/trashbin.php @@ -71,18 +71,7 @@ class Trashbin { * @throws \OC\User\NoUserException */ public static function getUidAndFilename($filename) { - $uid = \OC\Files\Filesystem::getOwner($filename); - \OC\Files\Filesystem::initMountPoints($uid); - if ($uid != \OCP\User::getUser()) { - $info = \OC\Files\Filesystem::getFileInfo($filename); - $ownerView = new \OC\Files\View('/' . $uid . '/files'); - try { - $filename = $ownerView->getPath($info['fileid']); - } catch (NotFoundException $e) { - $filename = null; - } - } - return [$uid, $filename]; + return Filesystem::getView()->getUidAndFilename($filename); } /** diff --git a/apps/files_versions/lib/storage.php b/apps/files_versions/lib/storage.php index 21b5e9e0e7b..e1312841653 100644 --- a/apps/files_versions/lib/storage.php +++ b/apps/files_versions/lib/storage.php @@ -41,6 +41,7 @@ namespace OCA\Files_Versions; +use OC\Files\Filesystem; use OCA\Files_Versions\AppInfo\Application; use OCA\Files_Versions\Command\Expire; use OCP\Lock\ILockingProvider; @@ -81,18 +82,7 @@ class Storage { * @throws \OC\User\NoUserException */ public static function getUidAndFilename($filename) { - $uid = \OC\Files\Filesystem::getOwner($filename); - \OC\Files\Filesystem::initMountPoints($uid); - if ( $uid != \OCP\User::getUser() ) { - $info = \OC\Files\Filesystem::getFileInfo($filename); - $ownerView = new \OC\Files\View('/'.$uid.'/files'); - try { - $filename = $ownerView->getPath($info['fileid']); - } catch (NotFoundException $e) { - $filename = null; - } - } - return [$uid, $filename]; + return Filesystem::getView()->getUidAndFilename($filename); } /** |