Exemplo n.º 1
0
 /**
  * Reads state from the Importer
  *
  * @access public
  * @return string
  * @throws StatusException
  */
 public function GetState()
 {
     $error = false;
     if (!isset($this->statestream) || $this->importer === false) {
         $error = true;
     }
     if ($error === false && $this->folderid !== false && function_exists("mapi_importcontentschanges_updatestate")) {
         if (mapi_importcontentschanges_updatestate($this->importer, $this->statestream) != true) {
             $error = true;
         }
     }
     if ($error == true) {
         throw new StatusException(sprintf("ImportChangesICS->GetState(): Error, state not available or unable to update: 0x%X", mapi_last_hresult()), $this->folderid ? SYNC_STATUS_FOLDERHIERARCHYCHANGED : SYNC_FSSTATUS_CODEUNKNOWN, null, LOGLEVEL_WARN);
     }
     mapi_stream_seek($this->statestream, 0, STREAM_SEEK_SET);
     $state = "";
     while (true) {
         $data = mapi_stream_read($this->statestream, 4096);
         if (strlen($data)) {
             $state .= $data;
         } else {
             break;
         }
     }
     return $state;
 }
Exemplo n.º 2
0
 function GetState()
 {
     if (!isset($this->statestream)) {
         return false;
     }
     if (function_exists("mapi_importcontentschanges_updatestate")) {
         debugLog("using mapi_importcontentschanges_updatestate");
         if (mapi_importcontentschanges_updatestate($this->importer, $this->statestream) != true) {
             debugLog("Unable to update state: " . sprintf("%X", mapi_last_hresult()));
             return false;
         }
     }
     mapi_stream_seek($this->statestream, 0, STREAM_SEEK_SET);
     $state = "";
     while (true) {
         $data = mapi_stream_read($this->statestream, 4096);
         if (strlen($data)) {
             $state .= $data;
         } else {
             break;
         }
     }
     return $state;
 }