/** * WebDAV HTTP MOVE method * * This method moves one uri to a different uri. A lot of the actual request processing is done in getCopyMoveInfo * * @param string $uri * @return void */ protected function httpMove($uri) { $moveInfo = $this->getCopyAndMoveInfo(); // If the destination is part of the source tree, we must fail if ($moveInfo['destination'] == $uri) { throw new Sabre_DAV_Exception_Forbidden('Source and destination uri are identical.'); } if ($moveInfo['destinationExists']) { if (!$this->broadcastEvent('beforeUnbind', array($moveInfo['destination']))) { return false; } $this->tree->delete($moveInfo['destination']); $this->broadcastEvent('afterUnbind', array($moveInfo['destination'])); } if (!$this->broadcastEvent('beforeUnbind', array($uri))) { return false; } if (!$this->broadcastEvent('beforeBind', array($moveInfo['destination']))) { return false; } $this->tree->move($uri, $moveInfo['destination']); $this->broadcastEvent('afterUnbind', array($uri)); $this->broadcastEvent('afterBind', array($moveInfo['destination'])); // If a resource was overwritten we should send a 204, otherwise a 201 $this->httpResponse->setHeader('Content-Length', '0'); $this->httpResponse->sendStatus($moveInfo['destinationExists'] ? 204 : 201); }
/** * WebDAV HTTP MOVE method * * This method moves one uri to a different uri. A lot of the actual request processing is done in getCopyMoveInfo * * @param string $uri * @return void */ protected function httpMove($uri) { $moveInfo = $this->getCopyAndMoveInfo(); if ($moveInfo['destinationExists']) { if (!$this->broadcastEvent('beforeUnbind', array($moveInfo['destination']))) { return false; } $this->tree->delete($moveInfo['destination']); } if (!$this->broadcastEvent('beforeUnbind', array($uri))) { return false; } if (!$this->broadcastEvent('beforeBind', array($moveInfo['destination']))) { return false; } $this->tree->move($uri, $moveInfo['destination']); $this->broadcastEvent('afterBind', array($moveInfo['destination'])); // If a resource was overwritten we should send a 204, otherwise a 201 $this->httpResponse->setHeader('Content-Length', '0'); $this->httpResponse->sendStatus($moveInfo['destinationExists'] ? 204 : 201); }