mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-05-01 16:11:20 +00:00
Fix regression in lock handling.
This commit is contained in:
parent
0db1fed1de
commit
f7edceeaa8
@ -105,6 +105,9 @@ $lock_opener = $request->FailIfLocked();
|
|||||||
|
|
||||||
if ( $request->method == "LOCK" ) {
|
if ( $request->method == "LOCK" ) {
|
||||||
dbg_error_log( "LOCK", "Attempting to lock resource '%s'", $request->path);
|
dbg_error_log( "LOCK", "Attempting to lock resource '%s'", $request->path);
|
||||||
|
$lock_timeout = (empty($request->timeout) ? 30 : intval($request->timeout) );
|
||||||
|
if ( $lock_timeout < 1 ) $lock_timeout = 30;
|
||||||
|
else if ( $lock_timeout > 300 ) $lock_timeout = 300;
|
||||||
if ( ($lock_token = $request->IsLocked()) ) { // NOTE Assignment in if() is expected here.
|
if ( ($lock_token = $request->IsLocked()) ) { // NOTE Assignment in if() is expected here.
|
||||||
$sql = 'UPDATE locks SET start = current_timestamp WHERE opaquelocktoken = :lock_token';
|
$sql = 'UPDATE locks SET start = current_timestamp WHERE opaquelocktoken = :lock_token';
|
||||||
$params = array( ':lock_token' => $lock_token);
|
$params = array( ':lock_token' => $lock_token);
|
||||||
@ -114,9 +117,6 @@ if ( $request->method == "LOCK" ) {
|
|||||||
* A fresh lock
|
* A fresh lock
|
||||||
*/
|
*/
|
||||||
$lock_token = uuid();
|
$lock_token = uuid();
|
||||||
$lock_timeout = (empty($request->timeout) ? 30 : intval($request->timeout) );
|
|
||||||
if ( $lock_timeout < 1 ) $lock_timeout = 30;
|
|
||||||
else if ( $lock_timeout > 300 ) $lock_timeout = 300;
|
|
||||||
$sql = 'INSERT INTO locks ( dav_name, opaquelocktoken, type, scope, depth, owner, timeout, start )
|
$sql = 'INSERT INTO locks ( dav_name, opaquelocktoken, type, scope, depth, owner, timeout, start )
|
||||||
VALUES( :dav_name, :lock_token, :type, :scope, :request_depth, :owner, :timeout::interval, current_timestamp )';
|
VALUES( :dav_name, :lock_token, :type, :scope, :request_depth, :owner, :timeout::interval, current_timestamp )';
|
||||||
$params = array(
|
$params = array(
|
||||||
@ -139,7 +139,7 @@ if ( $request->method == "LOCK" ) {
|
|||||||
new XMLElement( 'lockscope', new XMLElement( $lock_row->scope )),
|
new XMLElement( 'lockscope', new XMLElement( $lock_row->scope )),
|
||||||
new XMLElement( 'depth', $request->GetDepthName() ),
|
new XMLElement( 'depth', $request->GetDepthName() ),
|
||||||
new XMLElement( 'owner', new XMLElement( 'href', $lock_row->owner )),
|
new XMLElement( 'owner', new XMLElement( 'href', $lock_row->owner )),
|
||||||
new XMLElement( 'timeout', 'Second-'.$request->timeout),
|
new XMLElement( 'timeout', 'Second-'.$lock_timeout),
|
||||||
new XMLElement( 'locktoken', new XMLElement( 'href', 'opaquelocktoken:'.$lock_token ))
|
new XMLElement( 'locktoken', new XMLElement( 'href', 'opaquelocktoken:'.$lock_token ))
|
||||||
);
|
);
|
||||||
$response = new XMLElement("lockdiscovery", new XMLElement( "activelock", $activelock), array("xmlns" => "DAV:") );
|
$response = new XMLElement("lockdiscovery", new XMLElement( "activelock", $activelock), array("xmlns" => "DAV:") );
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user