示例#1
0
 /**
  * @return string
  * @throws HTTPException
  */
 public function generateReplicationId()
 {
     $filterCode = '';
     $filter = $this->task->getFilter();
     if ($filter != null) {
         if ($filter[0] !== '_') {
             list($designDoc, $functionName) = explode('/', $filter);
             $designDocName = '_design/' . $designDoc;
             $response = $this->source->findDocument($designDocName);
             if ($response->status != 200) {
                 throw HTTPException::fromResponse('/' . $this->source->getDatabase() . '/' . $designDocName, $response);
             }
             $filterCode = $response->body['filters'][$functionName];
         }
     }
     return \md5($this->source->getDatabase() . $this->target->getDatabase() . \var_export($this->task->getDocIds(), true) . ($this->task->getCreateTarget() ? '1' : '0') . ($this->task->getContinuous() ? '1' : '0') . $filter . $filterCode . $this->task->getStyle() . \var_export($this->task->getHeartbeat(), true));
 }