diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2013-07-05 17:39:41 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2013-07-05 17:39:41 +0200 |
commit | e159cbf527822edc28522df48b0526419835ca29 (patch) | |
tree | e1e64ac3cb2727a8157b2f893016e01e7422195c /lib/public | |
parent | 0202d47f7ad4a65d4e539421c4f5899404b22bf4 (diff) | |
download | nextcloud-server-e159cbf527822edc28522df48b0526419835ca29.tar.gz nextcloud-server-e159cbf527822edc28522df48b0526419835ca29.zip |
on reshares we now recursively move to the root of all reshares - therefore some code has been refactured and added as a new public function
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/share.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/public/share.php b/lib/public/share.php index de7025d7b15..69e6f35b473 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -292,6 +292,29 @@ class Share { } /** + * @brief resolves reshares down to the last real share + * @param $linkItem + * @return $fileOwner + */ + public static function resolveReShare($linkItem) + { + if (isset($linkItem['parent'])) { + $parent = $linkItem['parent']; + while (isset($parent)) { + $query = \OC_DB::prepare('SELECT * FROM `*PREFIX*share` WHERE `id` = ?', 1); + $item = $query->execute(array($parent))->fetchRow(); + if (isset($item['parent'])) { + $parent = $item['parent']; + } else { + return $item; + } + } + } + return $linkItem; + } + + + /** * @brief Get the shared items of item type owned by the current user * @param string Item type * @param int Format (optional) Format type must be defined by the backend |