summaryrefslogtreecommitdiffstats
path: root/bl
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-04-04 13:23:03 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-04-04 13:23:03 +0200
commit1f2391b0cdf8e7a9f8d922c7c2f71acfc4bc6388 (patch)
tree6d4976b4bc1e0d3b5ecf6c4764ecf5a98bf7559c /bl
parent3ec631a5c799e35ff5dbe519a3151ad62ad186b8 (diff)
move autopurge to itembl
Diffstat (limited to 'bl')
-rw-r--r--bl/feedbl.php24
-rw-r--r--bl/itembl.php24
2 files changed, 24 insertions, 24 deletions
diff --git a/bl/feedbl.php b/bl/feedbl.php
index 07cf5df8f..53c430336 100644
--- a/bl/feedbl.php
+++ b/bl/feedbl.php
@@ -39,16 +39,13 @@ class FeedBl extends Bl {
private $feedFetcher;
private $itemMapper;
private $api;
- private $autoPurgeCount;
public function __construct(FeedMapper $feedMapper, Fetcher $feedFetcher,
- ItemMapper $itemMapper, API $api,
- $autoPurgeCount=0){
+ ItemMapper $itemMapper, API $api){
parent::__construct($feedMapper);
$this->feedFetcher = $feedFetcher;
$this->itemMapper = $itemMapper;
$this->api = $api;
- $this->autoPurgeCount = $autoPurgeCount;
}
@@ -158,23 +155,4 @@ class FeedBl extends Bl {
}
- /**
- * This method deletes all unread feeds that are not starred and over the
- * count of $this->autoPurgeCount starting by the oldest. This is to clean
- * up the database so that old entries dont spam your db. As criteria for
- * old, the id is taken
- */
- public function autoPurgeOld(){
- $readAndNotStarred =
- $this->mapper->getReadOlderThanThreshold($this->autoPurgeCount);
-
- // delete entries with a lower id than last item
- if($this->autoPurgeCount > 0
- && isset($readAndNotStarred[$this->autoPurgeCount-1])){
- $this->mapper->deleteReadOlderThanId(
- $readAndNotStarred[$this->autoPurgeCount-1]->getId());
- }
- }
-
-
}
diff --git a/bl/itembl.php b/bl/itembl.php
index ee87d373a..eaf69c3ca 100644
--- a/bl/itembl.php
+++ b/bl/itembl.php
@@ -34,10 +34,13 @@ use \OCA\News\Db\FeedType;
class ItemBl extends Bl {
private $statusFlag;
+ private $autoPurgeCount;
- public function __construct(ItemMapper $itemMapper, StatusFlag $statusFlag){
+ public function __construct(ItemMapper $itemMapper, StatusFlag $statusFlag,
+ $autoPurgeCount=0){
parent::__construct($itemMapper);
$this->statusFlag = $statusFlag;
+ $this->autoPurgeCount = $autoPurgeCount;
}
@@ -118,4 +121,23 @@ class ItemBl extends Bl {
}
+ /**
+ * This method deletes all unread feeds that are not starred and over the
+ * count of $this->autoPurgeCount starting by the oldest. This is to clean
+ * up the database so that old entries dont spam your db. As criteria for
+ * old, the id is taken
+ */
+ public function autoPurgeOld(){
+ $readAndNotStarred =
+ $this->mapper->getReadOlderThanThreshold($this->autoPurgeCount);
+
+ // delete entries with a lower id than last item
+ if($this->autoPurgeCount > 0
+ && isset($readAndNotStarred[$this->autoPurgeCount-1])){
+ $this->mapper->deleteReadOlderThanId(
+ $readAndNotStarred[$this->autoPurgeCount-1]->getId());
+ }
+ }
+
+
}