Example #1
0
 public static function getByShareToken($token)
 {
     $linkItem = \OCP\Share::getShareByToken($token, false);
     if (is_array($linkItem) && isset($linkItem['uid_owner'])) {
         // seems to be a valid share
         $rootLinkItem = \OCP\Share::resolveReShare($linkItem);
     } else {
         throw new \Exception('This file was probably unshared');
     }
     $file = new File($rootLinkItem['file_source'], array($rootLinkItem));
     $file->setToken($token);
     if (isset($linkItem['share_with']) && !empty($linkItem['share_with'])) {
         $file->setPasswordProtected(true);
     }
     return $file;
 }