Exemple #1
0
 /**
  * Potential conflicts are only loaded when really necessary,
  * e.g. on ADD or MODIFY
  *
  * @access private
  * @return
  */
 private function lazyLoadConflicts()
 {
     if (!isset($this->session) || !isset($this->store) || !isset($this->folderid) || !isset($this->conflictsContentParameters) || $this->conflictsState === false) {
         ZLog::Write(LOGLEVEL_WARN, "ImportChangesICS->lazyLoadConflicts(): can not load potential conflicting changes in lazymode for conflict detection. Missing information");
         return false;
     }
     if (!$this->conflictsLoaded) {
         ZLog::Write(LOGLEVEL_DEBUG, "ImportChangesICS->lazyLoadConflicts(): loading..");
         // configure an exporter so we can detect conflicts
         $exporter = new ExportChangesICS($this->session, $this->store, $this->folderid);
         $exporter->Config($this->conflictsState);
         $exporter->ConfigContentParameters($this->conflictsContentParameters);
         $exporter->InitializeExporter($this->memChanges);
         while (is_array($exporter->Synchronize())) {
         }
         $this->conflictsLoaded = true;
     }
 }
 /**
  * Potential conflicts are only loaded when really necessary,
  * e.g. on ADD or MODIFY
  *
  * @access private
  * @return
  */
 private function lazyLoadConflicts()
 {
     if (!isset($this->session) || !isset($this->store) || !isset($this->folderid) || !isset($this->conflictsContentParameters) || $this->conflictsState === false) {
         ZLog::Write(LOGLEVEL_WARN, "ImportChangesICS->lazyLoadConflicts(): can not load potential conflicting changes in lazymode for conflict detection. Missing information");
         return false;
     }
     if (!$this->conflictsLoaded) {
         ZLog::Write(LOGLEVEL_DEBUG, "ImportChangesICS->lazyLoadConflicts(): loading..");
         // configure an exporter so we can detect conflicts
         $exporter = new ExportChangesICS($this->session, $this->store, $this->folderid);
         $exporter->Config($this->conflictsState);
         $exporter->ConfigContentParameters($this->conflictsContentParameters);
         $exporter->InitializeExporter($this->memChanges);
         // monitor how long it takes to export potential conflicts
         // if this takes "too long" we cancel this operation!
         $potConflicts = $exporter->GetChangeCount();
         $started = time();
         $exported = 0;
         while (is_array($exporter->Synchronize())) {
             $exported++;
             // stop if this takes more than 15 seconds and there are more than 5 changes still to be exported
             // within 20 seconds this should be finished or it will not be performed
             if (time() - $started > 15 && $potConflicts - $exported > 5) {
                 ZLog::Write(LOGLEVEL_WARN, sprintf("ImportChangesICS->lazyLoadConflicts(): conflict detection cancelled as operation is too slow. In %d seconds only %d from %d changes were processed.", time() - $started, $exported, $potConflicts));
                 $this->conflictsLoaded = true;
                 return;
             }
         }
         $this->conflictsLoaded = true;
     }
 }
Exemple #3
0
 function _lazyLoadConflicts()
 {
     if (!isset($this->_session) || !isset($this->_store) || !isset($this->_folderid) || $this->_conflictsMclass === false || $this->_conflictsState === false) {
         debugLog("Warning: can not load changes in lazymode for conflict detection. Missing information");
         return false;
     }
     if (!$this->_conflictsLoaded) {
         debugLog("LoadConflicts: loading..");
         // configure an exporter so we can detect conflicts
         $this->_memChanges = new ImportContentsChangesMem();
         $exporter = new ExportChangesICS($this->_session, $this->_store, $this->_folderid);
         $exporter->Config($this->_memChanges, $this->_conflictsMclass, $this->_conflictsFiltertype, $this->_conflictsState, 0, 0);
         while (is_array($exporter->Synchronize())) {
         }
         $this->_conflictsLoaded = true;
     }
 }
Exemple #4
0
 function Config($state, $flags = 0, $mclass = false, $restrict = false, $bodypreference = false, $optionbodypreference = false)
 {
     $stream = mapi_stream_create();
     if (strlen($state) == 0) {
         $state = hex2bin("0000000000000000");
     }
     mapi_stream_write($stream, $state);
     $this->statestream = $stream;
     mapi_importcontentschanges_config($this->importer, $stream, $flags);
     $this->_flags = $flags;
     //	debugLog("ImportContentsChangesICS->Config: ".($this->_folderid ? "Have Folder" : "No Folder"). " mclass: ". $mclass. " state: ". bin2hex($state) . " restriction " . $restrict);
     // configure an exporter so we can detect conflicts
     $exporter = new ExportChangesICS($this->_session, $this->_store, $this->_folderid);
     $memImporter = new ImportContentsChangesMem();
     $exporter->Config($memImporter, $mclass, $restrict, $state, 0, 0, $bodypreference, $optionbodypreference);
     while (is_array($exporter->Synchronize())) {
     }
     $this->_memChanges = $memImporter;
 }