/** * Restores the original server settings. * * Restores the original server auth (if it was set) and removes the lock * plugin again, if it was not set before. Unlocks the backend. */ private function restoreEnvironment() { $this->backend->unlock(); if ($this->serverAuth !== null) { $this->server->auth = $this->serverAuth; } if (!$this->serverHadLockPlugin) { $this->server->pluginRegistry->unregisterPlugin(new ezcWebdavLockPluginConfiguration()); } $this->serverAuth = null; $this->serverHadLockPlugin = null; }
/** * Performs actual purging of locks. * * Iterates over {@link $lockProperties} and purges all locks of which the * tokens have been collected in {$locksToPurge}. * * @return void * * @throws ezcWebdavLockAdministrationException * in case purging of a lock failed. */ protected function performPurge() { foreach ($this->lockProperties as $path => $lockDiscoveryProp) { $removeIds = array(); foreach ($lockDiscoveryProp->activeLock as $id => $activeLock) { if (isset($this->locksToPurge[(string) $activeLock->token])) { $removeIds[] = $id; } } if ($removeIds !== array()) { foreach ($removeIds as $id) { $lockDiscoveryProp->activeLock->offsetUnset($id); } $propPatchReq = new ezcWebdavPropPatchRequest($path); $propPatchReq->updates = new ezcWebdavFlaggedPropertyStorage(); $propPatchReq->updates->attach($lockDiscoveryProp, ezcWebdavPropPatchRequest::SET); $propPatchReq->validateHeaders(); $propPatchRes = $this->backend->propPatch($propPatchReq); if (!$propPatchRes instanceof ezcWebdavPropPatchResponse) { throw new ezcWebdavLockAdministrationException("PROPPATCH to remove timedout lock failed for '{$path}'.", $propPatchRes); } } } }
/** * Handles the OPTIONS request. * * Applies authorization checking to the OPTIONS request and returns the * parent response. * * @param ezcWebdavOptionsRequest $request * @return ezcWebdavOptionsResponse */ public function options(ezcWebdavOptionsRequest $request) { // Check authorization if (!ezcWebdavServer::getInstance()->isAuthorized($request->requestUri, $request->getHeader('Authorization'))) { return $this->createUnauthorizedResponse($request->requestUri, $request->getHeader('Authorization')); } return parent::options($request); }