diff options
Diffstat (limited to 'lib/Service/ItemServiceV2.php')
-rw-r--r-- | lib/Service/ItemServiceV2.php | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/Service/ItemServiceV2.php b/lib/Service/ItemServiceV2.php index 54cefa197..f13b249b8 100644 --- a/lib/Service/ItemServiceV2.php +++ b/lib/Service/ItemServiceV2.php @@ -113,22 +113,25 @@ class ItemServiceV2 extends Service return $this->mapper->findAllForFeed($feedId); } - - - public function purgeOverThreshold(int $threshold = null) + /** + * @param int|null $threshold + * @param bool $removeUnread + * + * @return int|null Amount of deleted items or null if not applicable + */ + public function purgeOverThreshold(int $threshold = null, bool $removeUnread = false): ?int { - - $threshold = (int) $threshold ?? $this->config->getAppValue( + $threshold = (int) ($threshold ?? $this->config->getAppValue( Application::NAME, 'autoPurgeCount', Application::DEFAULT_SETTINGS['autoPurgeCount'] - ); + )); - if ($threshold === 0) { - return ''; + if ($threshold <= 0) { + return null; } - return $this->mapper->deleteOverThreshold($threshold); + return $this->mapper->deleteOverThreshold($threshold, $removeUnread); } /** |