Skip to content

Commit

Permalink
Download::collectChildren(): skip resources without binaries to simpl…
Browse files Browse the repository at this point in the history
…ify auth checks
  • Loading branch information
zozlak committed Dec 10, 2024
1 parent 4edfa94 commit da363e8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/acdhOeaw/arche/core/Download.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,16 @@ private function fetchParentsMeta(int $id, object $meta): void {
*/
private function collectChildren(array $ids): array {
$baseUrl = RC::$config->rest->urlBase . RC::$config->rest->pathBase;
$query = RC::$pdo->prepare("SELECT (get_relatives(id, ?, 999999, 0, false, false)).id FROM identifiers WHERE ids = ?");
$param = [RC::$schema->parent, null];
$query = RC::$pdo->prepare("
SELECT gr.id
FROM
identifiers i,
LATERAL get_relatives(i.id, ?, 999999, 0, false, false) gr
WHERE
i.ids = ?
AND EXISTS (SELECT 1 FROM metadata WHERE id = gr.id AND property = ?)
");
$param = [RC::$schema->parent, null, RC::$schema->binarySize];
$allIds = [];
foreach ($ids as $id) {
$param[1] = is_numeric($id) ? $baseUrl . $id : $id;
Expand Down

0 comments on commit da363e8

Please sign in to comment.