From de40f3ad56b99b6128e8d9d207f5c5304ae97393 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 24 Mar 2021 19:04:51 +0100 Subject: Fix TT-RSS import (#3553) --- app/Models/EntryDAO.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'app/Models/EntryDAO.php') diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index c641878ad..9ed1d564d 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -989,8 +989,16 @@ SQL; } public function listHashForFeedGuids($id_feed, $guids) { + $result = []; if (count($guids) < 1) { - return array(); + return $result; + } elseif (count($guids) > FreshRSS_DatabaseDAO::MAX_VARIABLE_NUMBER) { + // Split a query with too many variables parameters + $guidsChunks = array_chunk($guids, FreshRSS_DatabaseDAO::MAX_VARIABLE_NUMBER, true); + foreach ($guidsChunks as $guidsChunk) { + $result += $this->listHashForFeedGuids($id_feed, $guidsChunk); + } + return $result; } $guids = array_unique($guids); $sql = 'SELECT guid, ' . $this->sqlHexEncode('hash') . @@ -999,7 +1007,6 @@ SQL; $values = array($id_feed); $values = array_merge($values, $guids); if ($stm && $stm->execute($values)) { - $result = array(); $rows = $stm->fetchAll(PDO::FETCH_ASSOC); foreach ($rows as $row) { $result[$row['guid']] = $row['hex_hash']; -- cgit v1.2.3