diff options
Diffstat (limited to 'lib/Db')
-rw-r--r-- | lib/Db/Feed.php | 8 | ||||
-rw-r--r-- | lib/Db/ItemMapperV2.php | 7 |
2 files changed, 12 insertions, 3 deletions
diff --git a/lib/Db/Feed.php b/lib/Db/Feed.php index 3c371087b..d949ea5f5 100644 --- a/lib/Db/Feed.php +++ b/lib/Db/Feed.php @@ -326,13 +326,16 @@ class Feed extends Entity implements IAPI, \JsonSerializable 'basicAuthPassword' ]); + if (is_null($this->link)) { + return $serialized; + } + $url = parse_url($this->link, PHP_URL_HOST); // strip leading www. to avoid css class confusion if (strpos($url, 'www.') === 0) { $url = substr($url, 4); } - $serialized['cssClass'] = 'custom-' . str_replace('.', '-', $url); return $serialized; @@ -488,6 +491,9 @@ class Feed extends Entity implements IAPI, \JsonSerializable */ public function setLink(?string $link = null): Feed { + if (is_null($link)) { + return $this; + } $link = trim($link); if (strpos($link, 'http') === 0 && $this->link !== $link) { $this->link = $link; diff --git a/lib/Db/ItemMapperV2.php b/lib/Db/ItemMapperV2.php index 704a8214d..972295ee3 100644 --- a/lib/Db/ItemMapperV2.php +++ b/lib/Db/ItemMapperV2.php @@ -285,12 +285,15 @@ class ItemMapperV2 extends NewsMapperV2 return intval($value['id']); }, $this->db->executeQuery($idBuilder->getSQL(), $idBuilder->getParameters())->fetchAll()); + $time = new Time(); $builder = $this->db->getQueryBuilder(); $builder->update(self::TABLE_NAME) ->set('unread', $builder->createParameter('unread')) + ->set('last_modified', $builder->createParameter('last_modified')) ->andWhere('id IN (:idList)') ->setParameter('idList', $idList, IQueryBuilder::PARAM_INT_ARRAY) - ->setParameter('unread', false, IQueryBuilder::PARAM_BOOL); + ->setParameter('unread', false, IQueryBuilder::PARAM_BOOL) + ->setParameter('last_modified', $time->getMicroTime(), IQueryBuilder::PARAM_STR); return $this->db->executeStatement( $builder->getSQL(), @@ -311,7 +314,7 @@ class ItemMapperV2 extends NewsMapperV2 { $builder = $this->db->getQueryBuilder(); - $builder->select('items.*') + $builder->select('items.id') ->from($this->tableName, 'items') ->innerJoin('items', FeedMapperV2::TABLE_NAME, 'feeds', 'items.feed_id = feeds.id') ->where('feeds.user_id = :userId') |