aboutsummaryrefslogtreecommitdiff
path: root/app/Models/EntryDAO.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2021-03-24 19:04:51 +0100
committerGravatar GitHub <noreply@github.com> 2021-03-24 19:04:51 +0100
commitde40f3ad56b99b6128e8d9d207f5c5304ae97393 (patch)
tree7755eac081f32ba87445ec82a2a740ea4a1865eb /app/Models/EntryDAO.php
parent06fa51448336d8ad95d70e7cd96e4c3f4e30907a (diff)
Fix TT-RSS import (#3553)
Diffstat (limited to 'app/Models/EntryDAO.php')
-rw-r--r--app/Models/EntryDAO.php11
1 files changed, 9 insertions, 2 deletions
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'];