From b86b4bbe652525a03bec7077f925f4863b39e9f1 Mon Sep 17 00:00:00 2001 From: Benjamin Brahmer Date: Thu, 11 Feb 2021 07:56:31 +0100 Subject: remove unused lastModified from feed fetcher Signed-off-by: Benjamin Brahmer --- composer.lock | 12 ++++++------ lib/Command/ShowFeed.php | 2 +- lib/Fetcher/FeedFetcher.php | 1 - lib/Fetcher/Fetcher.php | 4 ---- lib/Fetcher/IFeedFetcher.php | 3 --- lib/Service/FeedServiceV2.php | 1 - tests/Unit/Command/ShowFeedTest.php | 4 ++-- tests/Unit/Fetcher/FeedFetcherTest.php | 17 ++++++++--------- 8 files changed, 17 insertions(+), 27 deletions(-) diff --git a/composer.lock b/composer.lock index 1163091b3..c2d576d46 100644 --- a/composer.lock +++ b/composer.lock @@ -3487,16 +3487,16 @@ }, { "name": "vimeo/psalm", - "version": "4.4.1", + "version": "4.5.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "9fd7a7d885b3a216cff8dec9d8c21a132f275224" + "reference": "a45b5e2ae01d43175ff02684f592c83cfbd48533" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/9fd7a7d885b3a216cff8dec9d8c21a132f275224", - "reference": "9fd7a7d885b3a216cff8dec9d8c21a132f275224", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/a45b5e2ae01d43175ff02684f592c83cfbd48533", + "reference": "a45b5e2ae01d43175ff02684f592c83cfbd48533", "shasum": "" }, "require": { @@ -3585,9 +3585,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/4.4.1" + "source": "https://github.com/vimeo/psalm/tree/4.5.0" }, - "time": "2021-01-14T21:44:29+00:00" + "time": "2021-02-10T17:20:36+00:00" }, { "name": "webmozart/assert", diff --git a/lib/Command/ShowFeed.php b/lib/Command/ShowFeed.php index 4e3084322..7c4d14446 100644 --- a/lib/Command/ShowFeed.php +++ b/lib/Command/ShowFeed.php @@ -70,7 +70,7 @@ class ShowFeed extends Command $fullTextEnabled = (bool) $input->getOption('full-text'); try { - list($feed, $items) = $this->feedFetcher->fetch($url, true, null, $fullTextEnabled, $user, $password); + list($feed, $items) = $this->feedFetcher->fetch($url, true, $fullTextEnabled, $user, $password); } catch (\Exception $ex) { $output->writeln('Failed to fetch feed info:'); $output->writeln($ex->getMessage()); diff --git a/lib/Fetcher/FeedFetcher.php b/lib/Fetcher/FeedFetcher.php index b9526165d..810f73a31 100755 --- a/lib/Fetcher/FeedFetcher.php +++ b/lib/Fetcher/FeedFetcher.php @@ -100,7 +100,6 @@ class FeedFetcher implements IFeedFetcher public function fetch( string $url, bool $favicon, - ?string $lastModified, bool $fullTextEnabled, ?string $user, ?string $password diff --git a/lib/Fetcher/Fetcher.php b/lib/Fetcher/Fetcher.php index 883fa49e4..f86869729 100644 --- a/lib/Fetcher/Fetcher.php +++ b/lib/Fetcher/Fetcher.php @@ -45,8 +45,6 @@ class Fetcher * * @param string $url remote url of the feed * @param boolean $getFavicon if the favicon should also be fetched, defaults to true - * @param string|null $lastModified a last modified value from an http header defaults to false. - * If lastModified matches the http header from the feed no results are fetched * @param bool $fullTextEnabled If true use a scraper to download the full article * @param string|null $user if given, basic auth is set for this feed * @param string|null $password if given, basic auth is set for this feed. Ignored if user is empty @@ -58,7 +56,6 @@ class Fetcher public function fetch( string $url, bool $getFavicon = true, - ?string $lastModified = null, bool $fullTextEnabled = false, ?string $user = null, ?string $password = null @@ -70,7 +67,6 @@ class Fetcher return $fetcher->fetch( $url, $getFavicon, - $lastModified, $fullTextEnabled, $user, $password diff --git a/lib/Fetcher/IFeedFetcher.php b/lib/Fetcher/IFeedFetcher.php index ff9a89903..a0bb82e45 100644 --- a/lib/Fetcher/IFeedFetcher.php +++ b/lib/Fetcher/IFeedFetcher.php @@ -25,8 +25,6 @@ interface IFeedFetcher * * @param string $url remote url of the feed * @param boolean $favicon if the favicon should also be fetched, defaults to true - * @param string|null $lastModified a last modified value from an http header defaults to false. - * If lastModified matches the http header from the feed no results are fetched * @param bool $fullTextEnabled If true use a scraper to download the full article * @param string|null $user if given, basic auth is set for this feed * @param string|null $password if given, basic auth is set for this feed. Ignored if user is empty @@ -39,7 +37,6 @@ interface IFeedFetcher public function fetch( string $url, bool $favicon, - ?string $lastModified, bool $fullTextEnabled, ?string $user, ?string $password diff --git a/lib/Service/FeedServiceV2.php b/lib/Service/FeedServiceV2.php index 078941752..f94cf6f9e 100644 --- a/lib/Service/FeedServiceV2.php +++ b/lib/Service/FeedServiceV2.php @@ -258,7 +258,6 @@ class FeedServiceV2 extends Service list($fetchedFeed, $items) = $this->feedFetcher->fetch( $location, false, - $feed->getHttpLastModified(), $feed->getFullTextEnabled(), $feed->getBasicAuthUser(), $feed->getBasicAuthPassword() diff --git a/tests/Unit/Command/ShowFeedTest.php b/tests/Unit/Command/ShowFeedTest.php index ecaf4b0a0..46d822870 100644 --- a/tests/Unit/Command/ShowFeedTest.php +++ b/tests/Unit/Command/ShowFeedTest.php @@ -72,7 +72,7 @@ class ShowFeedTest extends TestCase $this->fetcher->expects($this->exactly(1)) ->method('fetch') - ->with('feed', true, null, true, 'user', 'user') + ->with('feed', true, true, 'user', 'user') ->willReturn([['feed'], [['items']]]); $this->consoleOutput->expects($this->exactly(2)) @@ -106,7 +106,7 @@ class ShowFeedTest extends TestCase $this->fetcher->expects($this->exactly(1)) ->method('fetch') - ->with('feed', true, null, true, 'user', 'user') + ->with('feed', true, true, 'user', 'user') ->will($this->throwException(new ServiceNotFoundException('test'))); $this->consoleOutput->expects($this->exactly(2)) diff --git a/tests/Unit/Fetcher/FeedFetcherTest.php b/tests/Unit/Fetcher/FeedFetcherTest.php index acb8e939d..91734217a 100644 --- a/tests/Unit/Fetcher/FeedFetcherTest.php +++ b/tests/Unit/Fetcher/FeedFetcherTest.php @@ -299,7 +299,7 @@ class FeedFetcherTest extends TestCase $item = $this->createItem(); $feed = $this->createFeed(); $this->mockIterator($this->feed_mock, [$this->item_mock]); - $result = $this->fetcher->fetch($this->url, false, '@1553118393', false, null, null); + $result = $this->fetcher->fetch($this->url, false, false, null, null); $this->assertEquals([$feed, [$item]], $result); } @@ -316,7 +316,6 @@ class FeedFetcherTest extends TestCase $result = $this->fetcher->fetch( $this->url, false, - '@1553118393', false, 'account@email.com', 'F9sEU*Rt%:KFK8HMHT&' @@ -334,7 +333,7 @@ class FeedFetcherTest extends TestCase $item = $this->createItem('audio/ogg'); $feed = $this->createFeed(); $this->mockIterator($this->feed_mock, [$this->item_mock]); - $result = $this->fetcher->fetch($this->url, false, '@1553118393', false, null, null); + $result = $this->fetcher->fetch($this->url, false, false, null, null); $this->assertEquals([$feed, [$item]], $result); } @@ -348,7 +347,7 @@ class FeedFetcherTest extends TestCase $item = $this->createItem('video/ogg'); $feed = $this->createFeed(); $this->mockIterator($this->feed_mock, [$this->item_mock]); - $result = $this->fetcher->fetch($this->url, false, '@1553118393', false, null, null); + $result = $this->fetcher->fetch($this->url, false, false, null, null); $this->assertEquals([$feed, [$item]], $result); } @@ -363,7 +362,7 @@ class FeedFetcherTest extends TestCase $feed = $this->createFeed('de-DE', true); $item = $this->createItem(); $this->mockIterator($this->feed_mock, [$this->item_mock]); - $result = $this->fetcher->fetch($this->url, true, '@1553118393', false, null, null); + $result = $this->fetcher->fetch($this->url, true, false, null, null); $this->assertEquals([$feed, [$item]], $result); } @@ -382,7 +381,7 @@ class FeedFetcherTest extends TestCase $item = $this->createItem(); $this->mockIterator($this->feed_mock, [$this->item_mock]); - $result = $this->fetcher->fetch($this->url, false, '@1553118393', false, null, null); + $result = $this->fetcher->fetch($this->url, false, false, null, null); $this->assertEquals([$feed, [$item]], $result); } @@ -396,7 +395,7 @@ class FeedFetcherTest extends TestCase $this->createFeed('he-IL'); $this->createItem(); $this->mockIterator($this->feed_mock, [$this->item_mock]); - list($_, $items) = $this->fetcher->fetch($this->url, false, '@1553118393', false, null, null); + list($_, $items) = $this->fetcher->fetch($this->url, false, false, null, null); $this->assertTrue($items[0]->getRtl()); } @@ -422,7 +421,7 @@ class FeedFetcherTest extends TestCase $this->mockIterator($this->feed_mock, [$this->item_mock]); - list($feed, $items) = $this->fetcher->fetch($this->url, false, '@1553118393', false, null, null); + list($feed, $items) = $this->fetcher->fetch($this->url, false, false, null, null); $this->assertSame($items[0]->getPubDate(), 1522180229); } @@ -448,7 +447,7 @@ class FeedFetcherTest extends TestCase $this->mockIterator($this->feed_mock, [$this->item_mock]); - list($feed, $items) = $this->fetcher->fetch($this->url, false, '@1553118393', false, null, null); + list($feed, $items) = $this->fetcher->fetch($this->url, false, false, null, null); $this->assertSame($items[0]->getPubDate(), 1519761029); } -- cgit v1.2.3