当前位置: 首页>>代码示例>>PHP>>正文


PHP Server::getCopyAndMoveInfo方法代码示例

本文整理汇总了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;


    }
开发者ID:nikosv,项目名称:openeclass,代码行数:35,代码来源:CorePlugin.php

示例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']);
 }
开发者ID:sebbie42,项目名称:casebox,代码行数:14,代码来源:Issue33Test.php


注:本文中的Sabre\DAV\Server::getCopyAndMoveInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。