예제 #1
0
 /**
  * Synchronize the provided data in case the selected synchronization
  * strategy requires it.
  *
  * @param Horde_Kolab_Storage_Data $data The data to synchronize.
  */
 public function synchronizeData(Horde_Kolab_Storage_Data $data)
 {
     $data_id = $data->getId();
     if ($this->hasNotBeenSynchronizedYet($data_id) || $this->syncTimeHasElapsed($data_id)) {
         $data->synchronize();
         $_SESSION['kolab_storage']['synchronization']['data'][$data_id] = time() + $this->_interval + rand(0, $this->_random_offset);
     }
 }
예제 #2
0
 /**
  * Synchronize the provided data in case the selected synchronization
  * strategy requires it.
  *
  * @param Horde_Kolab_Storage_Data $data The data to synchronize.
  */
 public function synchronizeData(Horde_Kolab_Storage_Data $data)
 {
     $data_id = $data->getId();
     if (empty($_SESSION['kolab_storage']['synchronization']['data'][$data_id])) {
         $data->synchronize();
         $_SESSION['kolab_storage']['synchronization']['data'][$data_id] = true;
     }
 }
예제 #3
0
파일: Kolab.php 프로젝트: horde/horde
 /**
  * Synchronize kolab storage backend.
  *
  * We delay initial synchronization to the first use so multiple calendars
  * don't add to the total latency. This function must be called before all
  * internal driver functions.
  *
  * @param boolean $force  If true, forces synchronization, even if we have
  *                        already done so.
  */
 public function synchronize($force = false, $token = false)
 {
     // Only sync once unless $force.
     if ($this->_synchronized && !$force) {
         return;
     }
     // If we are synching and have a token, only synch if it is different.
     $last_token = $GLOBALS['session']->get('kronolith', 'kolab/token/' . $this->calendar);
     if (!empty($token) && $last_token == $token) {
         return;
     }
     if (!empty($token)) {
         $GLOBALS['session']->set('kronolith', 'kolab/token/' . $this->calendar, $token);
     }
     // Connect to the Kolab backend
     try {
         $this->_data = $this->_kolab->getData($GLOBALS['calendar_manager']->getEntry(Kronolith::ALL_CALENDARS, $this->calendar)->share()->get('folder'), 'event');
         $this->_data->synchronize();
     } catch (Kolab_Storage_Exception $e) {
         throw new Kronolith_Exception($e);
     }
     // build internal event cache
     $this->_events_cache = $uids = array();
     $events = $this->_data->getObjects();
     foreach ($events as $event) {
         $this->_events_cache[Horde_Url::uriB64Encode($event['uid'])] = new Kronolith_Event_Kolab($this, $event);
         $uids[] = $event['uid'];
     }
     $tags = Kronolith::getTagger()->getTags(array_unique($uids));
     foreach ($this->_events_cache as &$event) {
         if (isset($tags[$event->uid])) {
             $event->synchronizeTags($tags[$event->uid]);
         }
     }
     $this->_synchronized = true;
 }
예제 #4
0
파일: Folder.php 프로젝트: horde/horde
 /**
  * Retrieve a handler for the data in this folder.
  *
  * @param Kolab_List $list  The handler for the list of folders.
  *
  * @return Horde_Kolab_Storage_Data The data handler.
  */
 public function getData($object_type = null, $data_version = 1)
 {
     if (empty($object_type)) {
         $object_type = $this->getType();
         if (is_a($object_type, 'PEAR_Error')) {
             return $object_type;
         }
     }
     if ($this->tainted) {
         foreach ($this->_data as $data) {
             $data->synchronize();
         }
         $this->tainted = false;
     }
     $key = $object_type . '|' . $data_version;
     if (!isset($this->_data[$key])) {
         if ($object_type != 'annotation') {
             $type = $this->getType();
         } else {
             $type = 'annotation';
         }
         $data = new Horde_Kolab_Storage_Data($type, $object_type, $data_version);
         $data->setFolder($this);
         $data->setCache($this->_storage->getDataCache());
         $data->synchronize();
         $this->_data[$key] =& $data;
     }
     return $this->_data[$key];
 }
예제 #5
0
파일: Log.php 프로젝트: horde/horde
 /**
  * Synchronize the list information with the information from the backend.
  *
  * @see  Horde_Kolab_Storage_Query
  *
  * @return NULL
  */
 public function synchronize($params = array())
 {
     $params = array_merge(array('logger' => $this->_logger), $params);
     $this->_data->synchronize($params);
     $this->_logger->debug(sprintf('Synchronized data cache for %s.', $this->_data->getPath()));
 }
예제 #6
0
파일: Token.php 프로젝트: raz0rsdge/horde
 /**
  * Synchronize the provided data in case the selected synchronization
  * strategy requires it. Always calls the synchronize method of $data,
  * assuming $data will know if it needs to be synchronized or not.
  *
  * @param Horde_Kolab_Storage_Data $data The data to synchronize.
  */
 public function synchronizeData(Horde_Kolab_Storage_Data $data)
 {
     $data->synchronize();
 }