Add optional feed argument to actualize-user.php (#9319)

* Add optional feed argument to actualize-user.php

Ports the change in #9182 from actualize_script.php to actualize-user.php, as suggested.

Adds an optional argument to the script to allow updating a particular feed, instead of all of them. This makes it easier to update specific feeds via cron and other local utilities. (My personal motivation is to add a bit of privacy to updates so they aren't as obviously linked, but this is also useful for other reasons, e.g. if you have too many feeds to feasibly update at once.)

* Doc + minor type check preference

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
This commit is contained in:
Justin TraceyandAlexandre Alapetite authored and GitHub committed 2026-09-19 10:01:32 +02:00
1 parent 74092a7fda
commit 3f12dcf2f6
2 files changed
+14 -2

No files matched your search

+1 -1
View File
@@ -101,7 +101,7 @@ cd /usr/share/FreshRSS
```
```sh
./cli/actualize-user.php --user username
./cli/actualize-user.php --user username [ --feed-id 123 ]
# Fetch feeds for the specified user.
./cli/delete-user.php --user username
+13 -1
View File
@@ -7,9 +7,11 @@ performRequirementCheck(FreshRSS_Context::systemConf()->db['type'] ?? '');
$cliOptions = new class extends CliOptionsParser {
public string $user;
public string $feedId = '';
public function __construct() {
$this->addRequiredOption('user', (new CliOption('user')));
$this->addOption('feedId', (new CliOption('feed-id')));
parent::__construct();
}
};
@@ -20,6 +22,16 @@ if (!empty($cliOptions->errors)) {
$username = cliInitUser($cliOptions->user);
$feedId = null;
if ($cliOptions->feedId !== '') {
$feedId = filter_var($cliOptions->feedId, FILTER_VALIDATE_INT, [
'options' => ['min_range' => 1],
]);
if (!is_int($feedId)) {
fail('FreshRSS error: Invalid feed ID: ' . $cliOptions->feedId . "\n");
}
}
Minz_ExtensionManager::callHookVoid(Minz_HookType::FreshrssUserMaintenance);
fwrite(STDERR, 'FreshRSS actualizing user “' . $username . "”…\n");
@@ -42,7 +54,7 @@ if (!empty($result['successes'])) {
echo "FreshRSS refreshed $successes dynamic OPMLs for $username\n";
}
[$nbUpdatedFeeds, , $nbNewArticles] = FreshRSS_feed_Controller::actualizeFeedsAndCommit();
[$nbUpdatedFeeds, , $nbNewArticles] = FreshRSS_feed_Controller::actualizeFeedsAndCommit($feedId);
echo "FreshRSS actualized $nbUpdatedFeeds feeds for $username ($nbNewArticles new articles)\n";