From b58ed5cd505a44ca26fc654065228dd2e4980ced Mon Sep 17 00:00:00 2001 From: Matthew Exon Date: Wed, 2 Mar 2022 16:54:23 +0100 Subject: [PATCH] add anotehr check --- retriever/retriever.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/retriever/retriever.php b/retriever/retriever.php index fc864129..8083dcf7 100644 --- a/retriever/retriever.php +++ b/retriever/retriever.php @@ -210,6 +210,9 @@ function retriever_tidy() { DBA::delete('retriever_resource', ['completed IS NULL AND created < DATE_SUB(now(), INTERVAL 3 MONTH)']); $r = DBA::p("SELECT retriever_item.id FROM retriever_item LEFT OUTER JOIN retriever_resource ON (retriever_item.resource = retriever_resource.id) WHERE retriever_resource.id is null"); + if (!DBA::isResult($r)) { + return; + } Logger::info('retriever_tidy: found ' . count($r) . ' retriever_items with no retriever_resource'); foreach ($r as $rr) { DBA::e('DELETE FROM retriever_item WHERE id = %d', intval($rr['id']));