From 7375daf213b09b6cfb8ee7e3ec6ce7b53db1b100 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Mon, 27 Oct 2014 10:39:51 +0100 Subject: allow to turn of autopurge --- service/itemservice.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'service') 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); + } } -- cgit v1.2.3