當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。