A free, self-hostable news aggregator…
Fix limit in import Json files
Marien Fressinaudd20b5a127fe9
diff --git a/app/Controllers/importExportController.php b/app/Controllers/importExportController.phpindex 514077bbd..8028af8ed 100644--- a/app/Controllers/importExportController.php+++ b/app/Controllers/importExportController.php@@ -327,12 +327,34 @@ class FreshRSS_importExport_Controller extends Minz_ActionController {$error = false;$article_to_feed = array();+ $nb_feeds = count($this->feedDAO->listFeeds());+ $limits = Minz_Configuration::limits();+// First, we check feeds of articles are in DB (and add them if needed).foreach ($article_object['items'] as $item) {- $feed = $this->addFeedJson($item['origin'], $google_compliant);+ $key = $google_compliant ? 'htmlUrl' : 'feedUrl';+ $feed = new FreshRSS_Feed($item['origin'][$key]);+ $feed = $this->feedDAO->searchByUrl($feed->url());+if (is_null($feed)) {- $error = true;- } else {+ // Feed does not exist in DB,we should to try to add it.+ if ($nb_feeds >= $limits['max_feeds']) {+ // Oops, no more place!+ Minz_Log::warning(_t('sub.feeds.over_max', $limits['max_feeds']));+ } else {+ $feed = $this->addFeedJson($item['origin'], $google_compliant);+ }++ if (is_null($feed)) {+ // Still null? It means something went wrong.+ $error = true;+ } else {+ // Nice! Increase the counter.+ $nb_feeds += 1;+ }+ }++ if (!is_null($feed)) {$article_to_feed[$item['id']] = $feed->id();}}diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.phpindex 852de6e36..74597c730 100644--- a/app/Models/FeedDAO.php+++ b/app/Models/FeedDAO.php@@ -191,7 +191,7 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo {$res = $stm->fetchAll(PDO::FETCH_ASSOC);$feed = current(self::daoToFeed($res));- if (isset($feed)) {+ if (isset($feed) && $feed !== false) {return $feed;} else {return null;