/** * Refreshes an already existing lock * * @param DAV_Resource $resource * @return void * @throws DAV_Statuss */ private function handleRefreshLock($resource) { $if_header = $this->if_header; if (!isset($if_header[DAV::getPath()]) || !$if_header[DAV::getPath()]['lock']) { throw new DAV_Status(DAV::HTTP_BAD_REQUEST, array(DAV::COND_LOCK_TOKEN_SUBMITTED => new DAV_Element_href(DAV::getPath()))); } // I think this can never evaluate to true, because DAV_Request already checks // whether the 'If' header matches the lock token of the resource. So if the // resource doesn't have a lock, this is already detected before this method // is called! (However, I don't dare to delete this yet and it doesn't hurt to // keep it) if (!($lock = DAV::$LOCKPROVIDER->getlock(DAV::getPath()))) { throw new DAV_Status(DAV::HTTP_PRECONDITION_FAILED, array(DAV::COND_LOCK_TOKEN_MATCHES_REQUEST_URI)); } DAV::$LOCKPROVIDER->refresh($lock->lockroot, $lock->locktoken, $this->timeout); if (!($lockdiscovery = $resource->prop_lockdiscovery())) { throw new DAV_Status(DAV::HTTP_INTERNAL_SERVER_ERROR); } // Generate output: DAV::header('application/xml; charset="utf-8"'); echo DAV::xml_header() . '<D:prop xmlns:D="DAV:"><D:lockdiscovery>' . $lockdiscovery . '</D:lockdiscovery></D:prop>'; }