コード例 #1
0
 /**
  * was an object updated?
  * @param string $objectUri
  * @return boolean
  */
 public function checkUpdate($objectUri)
 {
     if ($this->watchPolicy === self::CHECK_ALWAYS || $this->watchPolicy === self::CHECK_ONCE && $this->wasObjectChecked($objectUri)) {
         $cachedObject = $this->cache->find($objectUri);
         $this->setCheckedObject($objectUri);
         try {
             $objectAPI = $this->calendar->getBackend()->getObjectAPI($this->calendar);
             if ($objectAPI->hasUpdated($cachedObject)) {
                 $this->scanner->scanObject($objectUri);
                 return true;
             }
         } catch (BackendUtils\Exception $ex) {
             return false;
         }
         return false;
     } else {
         return false;
     }
 }
コード例 #2
0
 /**
  * @param $objectUri
  * @return null|IObject
  */
 protected function getCached($objectUri)
 {
     try {
         return $this->cache->find($objectUri);
     } catch (DoesNotExistMapperException $ex) {
         return null;
     } catch (MultipleObjectsReturnedMapperException $ex) {
         //$this->logger->warn($msg);
         return null;
     }
 }
コード例 #3
0
 /**
  * Find a certain object
  *
  * @param string $uri UID of the object
  * @param integer $type
  * @throws \OCA\Calendar\BusinessLayer\Exception
  * @return \OCA\Calendar\IObject
  */
 public function find($uri, $type = ObjectType::ALL)
 {
     try {
         if ($this->isCachingEnabled) {
             if ($this->watcher->checkUpdate($uri)) {
                 $this->updater->propagate($uri);
             }
             return $this->cache->find($uri, $type);
         } else {
             return $this->api->find($uri, $type);
         }
     } catch (BackendUtils\Exception $ex) {
         throw Exception::fromException($ex);
     }
 }