summaryrefslogtreecommitdiffstats
path: root/service
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-10-27 10:39:51 +0100
committerBernhard Posselt <dev@bernhard-posselt.com>2014-10-27 10:40:01 +0100
commit7375daf213b09b6cfb8ee7e3ec6ce7b53db1b100 (patch)
treea3064855148dceedaba463de4251065da645924c /service
parent1e6f862048f09a5efe8ca77f9f6c89698fc7eae3 (diff)
allow to turn of autopurge
Diffstat (limited to 'service')
-rw-r--r--service/itemservice.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/service/itemservice.php b/service/itemservice.php
index 628f89206..329283a92 100644
--- a/service/itemservice.php
+++ b/service/itemservice.php
@@ -24,7 +24,7 @@ use \OCA\News\Config\Config;
class ItemService extends Service {
private $statusFlag;
- private $autoPurgeCount;
+ private $config;
private $timeFactory;
private $itemMapper;
@@ -34,7 +34,7 @@ class ItemService extends Service {
Config $config){
parent::__construct($itemMapper);
$this->statusFlag = $statusFlag;
- $this->autoPurgeCount = $config->getAutoPurgeCount();
+ $this->config = $config;
$this->timeFactory = $timeFactory;
$this->itemMapper = $itemMapper;
}
@@ -197,7 +197,10 @@ class ItemService extends Service {
* old, the id is taken
*/
public function autoPurgeOld(){
- $this->itemMapper->deleteReadOlderThanThreshold($this->autoPurgeCount);
+ $count = $this->config->getAutoPurgeCount();
+ if ($count >= 0) {
+ $this->itemMapper->deleteReadOlderThanThreshold($count);
+ }
}