diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-22 13:47:45 +0100 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-22 13:47:45 +0100 |
commit | 585667bdf4a06a7bcde1b7d2b9b42059135343dc (patch) | |
tree | f7b9b053e70a088280c83073d2fe72c9387bcefc /bl/feedbl.php | |
parent | 196177a0ca3fc0103d359eec44f46173be685413 (diff) |
dont add feed twice
Diffstat (limited to 'bl/feedbl.php')
-rw-r--r-- | bl/feedbl.php | 6 |
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); |