Exemplo n.º 1
0
 public function handle($path, Uri $baseUri, HttpRequest $request, StorageInterface $storage)
 {
     if (!$request->isDelete()) {
         return;
     }
     $resource = $storage->findResource($path);
     if ($resource->isCollection() && $request->hasHeader('Depth')) {
         $depth = $request->getHeader('Depth', 'infinity');
         if ($depth != 'infinity') {
             throw new BadRequestException();
         }
     }
     $storage->beginTransaction();
     try {
         $storage->deleteResource($resource);
     } catch (\Exception $e) {
         $storage->rollBack();
         throw $e;
     }
     $storage->commit();
     return new HttpResponse(WebDav::CODE_NO_CONTENT);
 }