mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2025-04-15 12:05:50 +00:00
Console command to refresh all feeds once; fixes #147
This commit is contained in:
parent
44366f48bf
commit
5efef2c2d0
3 changed files with 23 additions and 4 deletions
|
@ -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)
|
||||
==========================
|
||||
|
|
11
lib/CLI.php
11
lib/CLI.php
|
@ -12,6 +12,7 @@ class CLI {
|
|||
const USAGE = <<<USAGE_TEXT
|
||||
Usage:
|
||||
arsse.php daemon
|
||||
arsse.php feed refresh-all
|
||||
arsse.php feed refresh <n>
|
||||
arsse.php conf save-defaults [<file>]
|
||||
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['<n>'], true);
|
||||
case "feed refresh-all":
|
||||
$this->loadConf();
|
||||
$this->getService()->watch(false);
|
||||
return 0;
|
||||
case "conf save-defaults":
|
||||
$file = $args['<file>'];
|
||||
$file = ($file === "-" ? null : $file) ?? "php://output";
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue