|
|
@@ -222,6 +222,9 @@ class FreshRSS_Category extends Minz_Model {
|
|
|
$importService->importOpml($opml, $dryRunCategory, true);
|
|
|
if ($importService->lastStatus()) {
|
|
|
$feedDAO = FreshRSS_Factory::createFeedDao();
|
|
|
+ $limits = FreshRSS_Context::systemConf()->limits;
|
|
|
+ $maxFeeds = (int)($limits['max_feeds'] ?? 0);
|
|
|
+ $nbFeeds = $maxFeeds > 0 ? $feedDAO->count() : 0;
|
|
|
|
|
|
/** @var array<string,FreshRSS_Feed> */
|
|
|
$dryRunFeeds = [];
|
|
|
@@ -245,8 +248,19 @@ class FreshRSS_Category extends Minz_Model {
|
|
|
foreach ($dryRunCategory->feeds() as $dryRunFeed) {
|
|
|
if (empty($existingFeeds[$dryRunFeed->url()])) {
|
|
|
// The feed does not exist in the current category, so add that feed
|
|
|
+ if ($maxFeeds > 0 && $nbFeeds >= $maxFeeds) {
|
|
|
+ // Respect the per-user maximum number of feeds
|
|
|
+ Minz_Log::warning(_t('feedback.sub.feed.over_max', $maxFeeds) .
|
|
|
+ ' (dynamic OPML category ' . $this->id() . ')');
|
|
|
+ $ok = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
$dryRunFeed->_category($this);
|
|
|
- $ok &= ($feedDAO->addFeedObject($dryRunFeed) !== false);
|
|
|
+ if ($feedDAO->addFeedObject($dryRunFeed) === false) {
|
|
|
+ $ok = false;
|
|
|
+ } else {
|
|
|
+ $nbFeeds++;
|
|
|
+ }
|
|
|
$existingFeeds[$dryRunFeed->url()] = $dryRunFeed;
|
|
|
} else {
|
|
|
$existingFeed = $existingFeeds[$dryRunFeed->url()];
|