diff options
Diffstat (limited to 'service')
-rw-r--r-- | service/itemservice.php | 9 |
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); + } } |