/** * Get number of objects in a calendar * * @throws \OCA\Calendar\BusinessLayer\Exception * @return array */ public function listAll() { if ($this->isCachingEnabled) { if ($this->calendar->checkUpdate()) { $this->calendar->propagate(); } return $this->cache->listAll(); } else { return $this->api->listAll(); } }
/** * remove deleted objects from cache */ public function clean() { try { $objectAPI = $this->calendar->getBackend()->getObjectAPI($this->calendar); $list = $objectAPI->listAll(); } catch (BackendUtils\Exception $ex) { return; } $cList = $this->cache->listAll(); $deletedOnRemote = array_diff($cList, $list); $this->cache->deleteList($deletedOnRemote); }
/** * scan calendar for changed objects */ public function scan() { if (!$this->isCalendarsBackendValid()) { return; } $cachedList = $this->cache->listAll(); try { $remoteList = $this->objectAPI->listAll(); } catch (BackendUtils\Exception $ex) { return; } $list = array_merge($cachedList, $remoteList); foreach ($list as $l) { $this->scanObject($l); } }