-
Notifications
You must be signed in to change notification settings - Fork 1
/
CcWebDavLockResponse.php
80 lines (72 loc) · 2.33 KB
/
CcWebDavLockResponse.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
/**
* @copyright Andreas Dirmeier (C) 2018
*
* This file is part of CcGitServer.
*
* CcGitServer is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CcGitServer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CcGitServer. If not, see <http://www.gnu.org/licenses/>.
**/
/**
* @file CcWebDavLockResponse.php
* @author Andreas Dirmeier
* @par Language: PHP
*
* Description for class CcWebDavLockResponse
*/
namespace NGitServer;
require_once 'CcXmlObject.php';
/**
* Webdav response xml object for lock messages
* @author tsep
*
*/
class CcWebDavLockResponse extends CcXmlObject
{
/**
* Setup default xml structure for response
*/
public function __construct ()
{
parent::__construct("D:prop");
$this->addAttribute("xmlns:D", "DAV:");
$oActiveLock = $this->createIfNotExists("D:lockdiscovery/D:activelock");
$oLockType = new CcXmlObject("D:locktype");
$oActiveLock->addNode($oLockType);
$oLockTypeWrite = new CcXmlObject("D:write");
$oLockType->addNode($oLockTypeWrite);
$oLockScope = new CcXmlObject("D:lockscope");
$oActiveLock->addNode($oLockScope);
$oLockScopeSub = new CcXmlObject("D:exclusive");
$oLockScope->addNode($oLockScopeSub);
$oDepth = new CcXmlObject("D:depth");
$oActiveLock->addNode($oDepth);
$oDepth->setContent("infinity");
$oTimeout = new CcXmlObject("D:timeout");
$oActiveLock->addNode($oTimeout);
$oTimeout->setContent("Second-600");
}
/**
* Insert unique id to response message
* @param string $sUuid
*/
public function setUuid ($sUuid)
{
$oActiveLock = $this->createIfNotExists("D:lockdiscovery/D:activelock");
$oLockToken = new CcXmlObject("D:locktoken");
$oActiveLock->addNode($oLockToken);
$oHref = new CcXmlObject("D:href");
$oLockToken->addNode($oHref);
$oHref->setContent($sUuid);
}
}