summaryrefslogtreecommitdiffstats
path: root/bl/feedbl.php
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-03-22 13:47:45 +0100
committerBernhard Posselt <nukeawhale@gmail.com>2013-03-22 13:47:45 +0100
commit585667bdf4a06a7bcde1b7d2b9b42059135343dc (patch)
treef7b9b053e70a088280c83073d2fe72c9387bcefc /bl/feedbl.php
parent196177a0ca3fc0103d359eec44f46173be685413 (diff)
dont add feed twice
Diffstat (limited to 'bl/feedbl.php')
-rw-r--r--bl/feedbl.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/bl/feedbl.php b/bl/feedbl.php
index 53a2e6061..8df399788 100644
--- a/bl/feedbl.php
+++ b/bl/feedbl.php
@@ -25,6 +25,8 @@
namespace OCA\News\Bl;
+use \OCA\AppFramework\Db\DoesNotExistException;
+
use \OCA\News\Db\Feed;
use \OCA\News\Db\FeedMapper;
use \OCA\News\Utility\FeedFetcher;
@@ -56,6 +58,10 @@ class FeedBl extends Bl {
public function create($feedUrl, $folderId, $userId){
// first try if the feed exists already
+ try {
+ $this->mapper->findByUrlHash(md5($feedUrl), $userId);
+ throw new BLException('Can not add feed: Exists already');
+ } catch(DoesNotExistException $ex){}
try {
list($feed, $items) = $this->feedFetcher->fetch($feedUrl);