From f783b4857d39fe23a6234f25782f822427fee359 Mon Sep 17 00:00:00 2001 From: Matthew Exon Date: Tue, 26 Dec 2023 15:14:35 +0100 Subject: [PATCH] some changes that were long overdue --- retriever/retriever.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/retriever/retriever.php b/retriever/retriever.php index 8e721eaff..bcc0963a7 100644 --- a/retriever/retriever.php +++ b/retriever/retriever.php @@ -125,12 +125,12 @@ function retriever_addon_admin_post () { * @brief Cron jobs for retriever plugin */ function retriever_cron() { - $downloads_per_cron = DI::config()->get('retriever', 'downloads_per_cron'); + $downloads_per_cron = DI::config()->get('retriever', 'downloads_per_cron', '100'); // Do this first, otherwise it can interfere with retriever_retrieve_items - retriever_clean_up_completed_resources($downloads_per_cron); + retriever_clean_up_completed_resources((int)$downloads_per_cron); - retriever_retrieve_items($downloads_per_cron); + retriever_retrieve_items((int)$downloads_per_cron); retriever_tidy(); } @@ -476,7 +476,7 @@ function add_retriever_resource(string $url, string $uid, string $cid, bool $bin return $resource; } - DBA::insert('retriever_resource', ['item-uid' => intval($uid), 'contact-id' => intval($cid), 'type' => $type, 'binary' => ($binary ? 1 : 0), 'url' => $url, 'completed' => DateTimeFormat::utcNow(), 'data' => $data]); + DBA::insert('retriever_resource', ['item-uid' => intval($uid), 'contact-id' => intval($cid), 'type' => $type, 'binary' => ($binary ? 1 : 0), 'url' => $url, 'completed' => DateTimeFormat::utcNow(), 'data' => $data, 'redirect-url' => '']); $resource = DBA::selectFirst('retriever_resource', [], ['url' => $url, 'item-uid' => intval($uid), 'contact-id' => intval($cid)]); if ($resource) { retriever_resource_completed($resource); @@ -495,7 +495,7 @@ function add_retriever_resource(string $url, string $uid, string $cid, bool $bin return $resource; } - DBA::insert('retriever_resource', ['item-uid' => intval($uid), 'contact-id' => intval($cid), 'binary' => ($binary ? 1 : 0), 'url' => $url]); + DBA::insert('retriever_resource', ['item-uid' => intval($uid), 'contact-id' => intval($cid), 'binary' => ($binary ? 1 : 0), 'url' => $url, 'redirect-url' => '']); return DBA::selectFirst('retriever_resource', [], ['url' => $url, 'item-uid' => intval($uid), 'contact-id' => intval($cid)]); }