diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-04-19 13:01:44 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-04-19 13:01:44 +0200 |
commit | 76cc72393a2be7a54a849225accce6bbd1918129 (patch) | |
tree | c5c1f3ec45aae96b1c30f4a0382d3b53168ce530 /businesslayer | |
parent | 67e00e798d85d897e4793077aa14bcb4fb3d1765 (diff) |
added a way to prevent feed from being updated
Diffstat (limited to 'businesslayer')
-rw-r--r-- | businesslayer/feedbusinesslayer.php | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/businesslayer/feedbusinesslayer.php b/businesslayer/feedbusinesslayer.php index 983a4768a..9f3635e8a 100644 --- a/businesslayer/feedbusinesslayer.php +++ b/businesslayer/feedbusinesslayer.php @@ -118,18 +118,21 @@ class FeedBusinessLayer extends BusinessLayer { public function update($feedId, $userId){ try { $existingFeed = $this->mapper->find($feedId, $userId); + + if($existingFeed->getPreventUpdate() === true) { + return; + } + try { - list($feed, $items) = $this->feedFetcher->fetch($existingFeed->getUrl()); + list($feed, $items) = $this->feedFetcher->fetch( + $existingFeed->getUrl()); - // insert items in reverse order because the first one is usually the - // newest item + // insert items in reverse order because the first one is usually + // the newest item for($i=count($items)-1; $i>=0; $i--){ $item = $items[$i]; $item->setFeedId($existingFeed->getId()); - // if a doesnotexist exception is being thrown the entry does not - // exist and the item needs to be created, otherwise - // update it try { $existing = $this->itemMapper->findByGuidHash( $item->getGuidHash(), $feedId, $userId); |