diff --git a/CHANGELOG b/CHANGELOG index af5159f..0bd9c39 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,8 +1,12 @@ -Version 0.7.0 (2019-??-??) +Version 0.7.0 (2019-03-02) ========================== New features: - Support for basic freeform searching in Tiny Tiny RSS +- Console command to refresh all stale feeds once then exit + +Bug fixes: +- Ensure updating does not fail with newsfeeds larger than 250 entries Version 0.6.1 (2019-01-23) ========================== diff --git a/lib/CLI.php b/lib/CLI.php index 8ff1e1d..efb1f99 100644 --- a/lib/CLI.php +++ b/lib/CLI.php @@ -12,6 +12,7 @@ class CLI { const USAGE = << arsse.php conf save-defaults [] arsse.php user [list] @@ -23,8 +24,8 @@ Usage: arsse.php --help | -h The Arsse command-line interface currently allows you to start the refresh -daemon, refresh a specific feed by numeric ID, manage users, or save default -configuration to a sample file. +daemon, refresh all feeds or a specific feed by numeric ID, manage users, +or save default configuration to a sample file. USAGE_TEXT; protected function usage($prog): string { @@ -58,7 +59,7 @@ USAGE_TEXT; 'help' => false, ]); try { - switch ($this->command(["--help", "--version", "daemon", "feed refresh", "conf save-defaults", "user"], $args)) { + switch ($this->command(["--help", "--version", "daemon", "feed refresh", "feed refresh-all", "conf save-defaults", "user"], $args)) { case "--help": echo $this->usage($argv0).\PHP_EOL; return 0; @@ -72,6 +73,10 @@ USAGE_TEXT; case "feed refresh": $this->loadConf(); return (int) !Arsse::$db->feedUpdate((int) $args[''], true); + case "feed refresh-all": + $this->loadConf(); + $this->getService()->watch(false); + return 0; case "conf save-defaults": $file = $args['']; $file = ($file === "-" ? null : $file) ?? "php://output"; diff --git a/tests/cases/CLI/TestCLI.php b/tests/cases/CLI/TestCLI.php index c2a6b52..608eebc 100644 --- a/tests/cases/CLI/TestCLI.php +++ b/tests/cases/CLI/TestCLI.php @@ -74,6 +74,16 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { Phake::verify($this->cli)->getService; } + public function testRefreshAllFeeds() { + $srv = Phake::mock(Service::class); + Phake::when($srv)->watch->thenReturn(new \DateTimeImmutable); + Phake::when($this->cli)->getService->thenReturn($srv); + $this->assertConsole($this->cli, "arsse.php feed refresh-all", 0); + $this->assertLoaded(true); + Phake::verify($srv)->watch(false); + Phake::verify($this->cli)->getService; + } + /** @dataProvider provideFeedUpdates */ public function testRefreshAFeed(string $cmd, int $exitStatus, string $output) { Arsse::$db = Phake::mock(Database::class);