From 15723e2365035263f6f11eb7719dddd6d6d0cca2 Mon Sep 17 00:00:00 2001 From: mormegil Date: Fri, 20 Aug 2021 12:07:22 +0200 Subject: [PATCH] Revert 64bit requirement There is no reason for it, the timestamps can be float with no precision loss until October 12, year 287396. --- CHANGELOG.md | 2 +- appinfo/info.xml | 2 +- lib/Controller/ItemApiController.php | 4 ++-- lib/Db/ItemMapperV2.php | 12 ++++++------ lib/Service/ItemServiceV2.php | 12 ++++++------ 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95db0a46a3..a1fb9a06bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -422,7 +422,7 @@ Note: Nextcloud 20 support will be dropped in Oct 2021, this is very likely the There are no additional changes compared to the latest beta. ### Changed -- News now requires a 64bit OS +- ~~News now requires a 64bit OS~~ – reverted in this fork - v2 API implementation (folder part) - Implemented sharing news items between nextcloud users (#1191) - Updated the news items table in DB to include sharer data (#1191) diff --git a/appinfo/info.xml b/appinfo/info.xml index 4d27565747..aa06f032dc 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -43,7 +43,7 @@ Report a [feed issue](https://github.com/nextcloud/news/discussions/new) https://raw.githubusercontent.com/nextcloud/news/master/screenshots/2.png https://raw.githubusercontent.com/nextcloud/news/master/screenshots/3.png - + pgsql sqlite mysql diff --git a/lib/Controller/ItemApiController.php b/lib/Controller/ItemApiController.php index d56df9532c..44d398b817 100644 --- a/lib/Controller/ItemApiController.php +++ b/lib/Controller/ItemApiController.php @@ -113,7 +113,7 @@ public function index( /** * @param int $type * @param int $id - * @param int $lastModified + * @param float $lastModified * @return array|JSONResponse * * @throws ServiceValidationException @@ -121,7 +121,7 @@ public function index( #[CORS] #[NoCSRFRequired] #[NoAdminRequired] - public function updated(int $type = 3, int $id = 0, int $lastModified = 0): array + public function updated(int $type = 3, int $id = 0, float $lastModified = 0): array { // needs to be turned into a millisecond timestamp to work properly if (strlen((string) $lastModified) <= 10) { diff --git a/lib/Db/ItemMapperV2.php b/lib/Db/ItemMapperV2.php index 7c70c68798..0c5f506a22 100644 --- a/lib/Db/ItemMapperV2.php +++ b/lib/Db/ItemMapperV2.php @@ -328,7 +328,7 @@ public function newest(string $userId): Entity /** * @param string $userId * @param int $feedId - * @param int $updatedSince + * @param float $updatedSince * @param bool $hideRead * * @return Item[] @@ -336,7 +336,7 @@ public function newest(string $userId): Entity public function findAllInFeedAfter( string $userId, int $feedId, - int $updatedSince, + float $updatedSince, bool $hideRead ): array { $builder = $this->db->getQueryBuilder(); @@ -366,7 +366,7 @@ public function findAllInFeedAfter( /** * @param string $userId * @param int|null $folderId - * @param int $updatedSince + * @param float $updatedSince * @param bool $hideRead * * @return Item[] @@ -374,7 +374,7 @@ public function findAllInFeedAfter( public function findAllInFolderAfter( string $userId, ?int $folderId, - int $updatedSince, + float $updatedSince, bool $hideRead ): array { $builder = $this->db->getQueryBuilder(); @@ -400,13 +400,13 @@ public function findAllInFolderAfter( /** * @param string $userId - * @param int $updatedSince + * @param float $updatedSince * @param int $feedType * * @return Item[]|Entity[] * @throws ServiceValidationException */ - public function findAllAfter(string $userId, int $feedType, int $updatedSince): array + public function findAllAfter(string $userId, int $feedType, float $updatedSince): array { $builder = $this->db->getQueryBuilder(); diff --git a/lib/Service/ItemServiceV2.php b/lib/Service/ItemServiceV2.php index 4f1401c9db..31917aff96 100644 --- a/lib/Service/ItemServiceV2.php +++ b/lib/Service/ItemServiceV2.php @@ -271,12 +271,12 @@ public function findAllInFeed(string $userId, int $feedId): array * Returns all new items in a feed * @param string $userId the name of the user * @param int $feedId the id of the feed - * @param int $updatedSince a timestamp with the minimal modification date + * @param float $updatedSince a timestamp with the minimal modification date * @param boolean $hideRead if unread items should also be returned * * @return array of items */ - public function findAllInFeedAfter(string $userId, int $feedId, int $updatedSince, bool $hideRead): array + public function findAllInFeedAfter(string $userId, int $feedId, float $updatedSince, bool $hideRead): array { return $this->mapper->findAllInFeedAfter($userId, $feedId, $updatedSince, $hideRead); } @@ -285,12 +285,12 @@ public function findAllInFeedAfter(string $userId, int $feedId, int $updatedSinc * Returns all new items in a folder * @param string $userId the name of the user * @param int|null $folderId the id of the folder - * @param int $updatedSince a timestamp with the minimal modification date + * @param float $updatedSince a timestamp with the minimal modification date * @param boolean $hideRead if unread items should also be returned * * @return array of items */ - public function findAllInFolderAfter(string $userId, ?int $folderId, int $updatedSince, bool $hideRead): array + public function findAllInFolderAfter(string $userId, ?int $folderId, float $updatedSince, bool $hideRead): array { return $this->mapper->findAllInFolderAfter($userId, $folderId, $updatedSince, $hideRead); } @@ -300,13 +300,13 @@ public function findAllInFolderAfter(string $userId, ?int $folderId, int $update * * @param string $userId the name of the user * @param int $feedType the type of feed items to fetch. (starred || unread) - * @param int $updatedSince a timestamp with the minimal modification date + * @param float $updatedSince a timestamp with the minimal modification date * * @return array of items * * @throws ServiceValidationException */ - public function findAllAfter(string $userId, int $feedType, int $updatedSince): array + public function findAllAfter(string $userId, int $feedType, float $updatedSince): array { if (!in_array($feedType, [ListType::STARRED, ListType::UNREAD, ListType::ALL_ITEMS], true)) { throw new ServiceValidationException('Trying to find in unknown type');