/** * Generates the response for successful LOCK requests * * @param LockInfo $lockInfo * @return string */ protected function generateLockResponse(LockInfo $lockInfo) { $dom = new \DOMDocument('1.0', 'utf-8'); $dom->formatOutput = true; $prop = $dom->createElementNS('DAV:', 'd:prop'); $dom->appendChild($prop); $lockDiscovery = $dom->createElementNS('DAV:', 'd:lockdiscovery'); $prop->appendChild($lockDiscovery); $lockObj = new DAV\Property\LockDiscovery(array($lockInfo), true); $lockObj->serialize($this->server, $lockDiscovery); return $dom->saveXML(); }
/** * Fakes a successful LOCK * * @param RequestInterface $request * @param ResponseInterface $response * @return bool */ public function fakeLockProvider(RequestInterface $request, ResponseInterface $response) { $dom = new \DOMDocument('1.0', 'utf-8'); $prop = $dom->createElementNS('DAV:', 'd:prop'); $dom->appendChild($prop); $lockDiscovery = $dom->createElementNS('DAV:', 'd:lockdiscovery'); $prop->appendChild($lockDiscovery); $lockInfo = new LockInfo(); $lockInfo->token = md5($request->getPath()); $lockInfo->uri = $request->getPath(); $lockInfo->depth = \Sabre\DAV\Server::DEPTH_INFINITY; $lockInfo->timeout = 1800; $lockObj = new LockDiscovery([$lockInfo]); $lockObj->serialize($this->server, $lockDiscovery); $response->setBody($dom->saveXML()); return false; }