本文整理汇总了PHP中Sabre\DAV\Server::getCopyAndMoveInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP Server::getCopyAndMoveInfo方法的具体用法?PHP Server::getCopyAndMoveInfo怎么用?PHP Server::getCopyAndMoveInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sabre\DAV\Server
的用法示例。
在下文中一共展示了Server::getCopyAndMoveInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: httpCopy
/**
* WebDAV HTTP COPY method
*
* This method copies one uri to a different uri, and works much like the MOVE request
* A lot of the actual request processing is done in getCopyMoveInfo
*
* @param RequestInterface $request
* @param ResponseInterface $response
* @return bool
*/
function httpCopy(RequestInterface $request, ResponseInterface $response) {
$path = $request->getPath();
$copyInfo = $this->server->getCopyAndMoveInfo($request);
if ($copyInfo['destinationExists']) {
if (!$this->server->emit('beforeUnbind', [$copyInfo['destination']])) return false;
$this->server->tree->delete($copyInfo['destination']);
}
if (!$this->server->emit('beforeBind', [$copyInfo['destination']])) return false;
$this->server->tree->copy($path, $copyInfo['destination']);
$this->server->emit('afterBind', [$copyInfo['destination']]);
// If a resource was overwritten we should send a 204, otherwise a 201
$response->setHeader('Content-Length', '0');
$response->setStatus($copyInfo['destinationExists'] ? 204 : 201);
// Sending back false will interupt the event chain and tell the server
// we've handled this method.
return false;
}
示例2: testCopyMoveInfo
function testCopyMoveInfo()
{
$bar = new SimpleCollection('bar');
$root = new SimpleCollection('webdav', array($bar));
$server = new Server($root);
$server->setBaseUri('/webdav/');
$serverVars = array('REQUEST_URI' => '/webdav/bar', 'HTTP_DESTINATION' => 'http://dev2.tribalos.com/webdav/%C3%A0fo%C3%B3', 'HTTP_OVERWRITE' => 'F');
$request = HTTP\Sapi::createFromServerArray($serverVars);
$server->httpRequest = $request;
$info = $server->getCopyAndMoveInfo($request);
$this->assertEquals('%C3%A0fo%C3%B3', urlencode($info['destination']));
$this->assertFalse($info['destinationExists']);
$this->assertFalse($info['destinationNode']);
}