From 9507e6a3ee7303a74f9c36b8d87cd0101c26d313 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Fri, 2 Aug 2013 15:31:55 +0200 Subject: make cron updater optional, created updater class for better updating handling, created a route for the api to clean up old stuff --- utility/updater.php | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 utility/updater.php (limited to 'utility') diff --git a/utility/updater.php b/utility/updater.php new file mode 100644 index 000000000..96296bd06 --- /dev/null +++ b/utility/updater.php @@ -0,0 +1,62 @@ +. +* +*/ + + +namespace OCA\News\Utility; + +use \OCA\News\BusinessLayer\FolderBusinessLayer; +use \OCA\News\BusinessLayer\FeedBusinessLayer; +use \OCA\News\BusinessLayer\ItemBusinessLayer; + + +class Updater { + + + private $folderBusinessLayer; + private $feedBusinessLayer; + private $itemBusinessLayer; + + public function __construct(FolderBusinessLayer $folderBusinessLayer, + FeedBusinessLayer $feedBusinessLayer, + ItemBusinessLayer $itemBusinessLayer) { + $this->folderBusinessLayer = $folderBusinessLayer; + $this->feedBusinessLayer = $feedBusinessLayer; + $this->itemBusinessLayer = $itemBusinessLayer; + } + + + public function cleanUp() { + $this->folderBusinessLayer->purgeDeleted(); + $this->feedBusinessLayer->purgeDeleted(); + $this->itemBusinessLayer->autoPurgeOld(); + } + + + public function update() { + $this->feedBusinessLayer->updateAll(); + } + + +} \ No newline at end of file -- cgit v1.2.3