| @@ 51-63 (lines=13) @@ | ||
| 48 | * @return SharesToken |
|
| 49 | * @throws TokenDoesNotExistException |
|
| 50 | */ |
|
| 51 | public function getByToken(string $token) { |
|
| 52 | $qb = $this->getTokensSelectSql(); |
|
| 53 | $this->limitToToken($qb, $token); |
|
| 54 | ||
| 55 | $cursor = $qb->execute(); |
|
| 56 | $data = $cursor->fetch(); |
|
| 57 | $cursor->closeCursor(); |
|
| 58 | if ($data === false) { |
|
| 59 | throw new TokenDoesNotExistException('Unknown share token'); |
|
| 60 | } |
|
| 61 | ||
| 62 | return $this->parseTokensSelectSql($data); |
|
| 63 | } |
|
| 64 | ||
| 65 | ||
| 66 | /** |
|
| @@ 434-448 (lines=15) @@ | ||
| 431 | * @return Share |
|
| 432 | * @throws ShareNotFound |
|
| 433 | */ |
|
| 434 | public function getShareById($shareId, $recipientId = null) { |
|
| 435 | $qb = $this->getBaseSelectSql(); |
|
| 436 | ||
| 437 | $this->limitToShare($qb, $shareId); |
|
| 438 | ||
| 439 | $cursor = $qb->execute(); |
|
| 440 | $data = $cursor->fetch(); |
|
| 441 | $cursor->closeCursor(); |
|
| 442 | ||
| 443 | if ($data === false) { |
|
| 444 | throw new ShareNotFound(); |
|
| 445 | } |
|
| 446 | ||
| 447 | return $this->createShareObject($data); |
|
| 448 | } |
|
| 449 | ||
| 450 | ||
| 451 | /** |
|
| @@ 113-130 (lines=18) @@ | ||
| 110 | * @return null|Circle |
|
| 111 | * @throws CircleDoesNotExistException |
|
| 112 | */ |
|
| 113 | public function forceGetCircleByName($name) { |
|
| 114 | ||
| 115 | $qb = $this->getCirclesSelectSql(); |
|
| 116 | ||
| 117 | $this->limitToName($qb, $name); |
|
| 118 | ||
| 119 | $cursor = $qb->execute(); |
|
| 120 | $data = $cursor->fetch(); |
|
| 121 | $cursor->closeCursor(); |
|
| 122 | ||
| 123 | if ($data === false) { |
|
| 124 | throw new CircleDoesNotExistException($this->l10n->t('Circle not found')); |
|
| 125 | } |
|
| 126 | ||
| 127 | $entry = $this->parseCirclesSelectSql($data); |
|
| 128 | ||
| 129 | return $entry; |
|
| 130 | } |
|
| 131 | ||
| 132 | ||
| 133 | /** |
|
| @@ 55-70 (lines=16) @@ | ||
| 52 | * @return Circle |
|
| 53 | * @throws CircleDoesNotExistException |
|
| 54 | */ |
|
| 55 | public function forceGetCircle($circleUniqueId) { |
|
| 56 | $qb = $this->getCirclesSelectSql(); |
|
| 57 | ||
| 58 | $this->leftJoinOwner($qb, ''); |
|
| 59 | $this->limitToShortenUniqueId($qb, $circleUniqueId, Circle::SHORT_UNIQUE_ID_LENGTH); |
|
| 60 | ||
| 61 | $cursor = $qb->execute(); |
|
| 62 | $data = $cursor->fetch(); |
|
| 63 | $cursor->closeCursor(); |
|
| 64 | ||
| 65 | if ($data === false) { |
|
| 66 | throw new CircleDoesNotExistException($this->l10n->t('Circle not found')); |
|
| 67 | } |
|
| 68 | ||
| 69 | return $this->parseCirclesSelectSql($data); |
|
| 70 | } |
|
| 71 | ||
| 72 | ||
| 73 | /** |
|
| @@ 341-356 (lines=16) @@ | ||
| 338 | * @return Circle |
|
| 339 | * @throws CircleDoesNotExistException |
|
| 340 | */ |
|
| 341 | public function getCircleFromUniqueId($uniqueId) { |
|
| 342 | $qb = $this->getCirclesSelectSql(); |
|
| 343 | $this->limitToUniqueId($qb, (string)$uniqueId); |
|
| 344 | ||
| 345 | $cursor = $qb->execute(); |
|
| 346 | $data = $cursor->fetch(); |
|
| 347 | $cursor->closeCursor(); |
|
| 348 | ||
| 349 | if ($data === false) { |
|
| 350 | throw new CircleDoesNotExistException($this->l10n->t('Circle not found')); |
|
| 351 | } |
|
| 352 | ||
| 353 | $entry = $this->parseCirclesSelectSql($data); |
|
| 354 | ||
| 355 | return $entry; |
|
| 356 | } |
|
| 357 | ||
| 358 | ||
| 359 | /** |
|
| @@ 169-183 (lines=15) @@ | ||
| 166 | * @return GSShareMountpoint |
|
| 167 | * @throws ShareNotFound |
|
| 168 | */ |
|
| 169 | public function getShareMountPointById(int $gsShareId, string $userId): GSShareMountpoint { |
|
| 170 | $qb = $this->getGSSharesMountpointSelectSql(); |
|
| 171 | ||
| 172 | $this->limitToShareId($qb, $gsShareId); |
|
| 173 | $this->limitToUserId($qb, $userId); |
|
| 174 | ||
| 175 | $shares = []; |
|
| 176 | $cursor = $qb->execute(); |
|
| 177 | $data = $cursor->fetch(); |
|
| 178 | if ($data === false) { |
|
| 179 | throw new ShareNotFound(); |
|
| 180 | } |
|
| 181 | ||
| 182 | return $this->parseGSSharesMountpointSelectSql($data); |
|
| 183 | } |
|
| 184 | ||
| 185 | ||
| 186 | /** |
|