ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilDAVLocks Class Reference
+ Collaboration diagram for ilDAVLocks:

Public Member Functions

 __construct ()
 
 lockRef ($refId, $iliasUserId, $davUser, $token, $expires, $depth, $scope)
 Creates a lock an object, unless there are locks on the object or its parents, which prevent the creation of the lock. More...
 
 lockWithoutCheckingDAV (&$objDAV, $iliasUserId, $davUser, $token, $expires, $depth, $scope)
 Creates a write lock. More...
 
 lockWithoutCheckingObj ($objId, $nodeId, $iliasUserId, $davUser, $token, $expires, $depth, $scope)
 Creates a write lock. More...
 
 updateLockWithoutCheckingDAV (&$objDAV, $token, $expires)
 Updates a write lock. More...
 
 updateLockWithoutCheckingObj ($objId, $nodeId, $token, $expires)
 Updates a write lock. More...
 
 unlockWithoutCheckingDAV (&$objDAV, $token)
 Discards a write lock. More...
 
 getLockDAV (&$objDAV, $token)
 Returns the lock with the specified token on the specified DAV object. More...
 
 getLocksOnObjectDAV (&$objDAV)
 Returns all locks on the specified object. More...
 
 getLocksOnObjectObj ($objId, $nodeId=0)
 Returns all locks on the specified object id. More...
 
 getLocksOnPathDAV (&$pathDAV)
 Returns all locks on the specified object path. More...
 
 getLocksOnPathRef ($refId)
 Returns all locks on the specified object, specified by a reference id. More...
 
 cleanUp ()
 System maintenance: get rid of locks that have expired over an hour ago. More...
 

Protected Member Functions

 writelog ($message)
 Writes a message to the logfile.,. More...
 

Private Attributes

 $table = 'dav_lock'
 
 $isDebug = false
 Set this to true, to get debug output in the ILIAS log. More...
 

Detailed Description

Definition at line 42 of file class.ilDAVLocks.php.

Constructor & Destructor Documentation

◆ __construct()

ilDAVLocks::__construct ( )

Definition at line 49 of file class.ilDAVLocks.php.

50  {
51  }

Member Function Documentation

◆ cleanUp()

ilDAVLocks::cleanUp ( )

System maintenance: get rid of locks that have expired over an hour ago.

Since we have no index over the 'expires' column, this causes a (very slow) table space scan.

Definition at line 531 of file class.ilDAVLocks.php.

References $DIC, $ilDB, $old, $r, $row, ilObject\_getAllReferences(), ilDBConstants\FETCHMODE_ASSOC, and time.

Referenced by unlockWithoutCheckingDAV().

532  {
533  global $DIC;
534  $ilDB = $DIC['ilDB'];
535  $tree = $DIC['tree'];
536 
537  // 1. Get rid of locks that have expired over an hour ago
538  $old = time() - 3600;
539  $q = 'DELETE'
540  . ' FROM ' . $this->table
541  . ' WHERE expires < ' . $ilDB->quote($old, 'integer')
542  ;
543  $ilDB->manipulate($q);
544 
545  // 2. Get rid of null resources which are not associated to
546  // a lock due to step 1, or due to a database inconsistency
547  // because we are working with non-transactional tables
548  $q = 'SELECT dat.obj_id '
549  . ' FROM object_data AS dat'
550  . ' LEFT JOIN ' . $this->table . ' lck'
551  . ' ON dat.obj_id = lck.obj_id'
552  . ' WHERE dat.type = ' . $ilDB->quote('null', 'text')
553  . ' AND lck.obj_id IS NULL'
554  ;
555  /* TODO: smeyer.' FOR UPDATE' */
556 
557  $r = $ilDB->query($q);
558  while ($row = $r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
559  $references = ilObject::_getAllReferences($row['obj_id']);
560  $obj = new ilObjNull($row['obj_id'], false);
561  if (count($references) == 0) {
562  $obj->delete();
563  } else {
564  foreach ($references as $refId) {
565  $obj->setRefId($refId);
566  $obj->delete();
567  $nodeData = $tree->getNodeData($refId);
568  $tree->deleteTree($nodeData);
569  }
570  }
571  }
572  }
global $DIC
Definition: saml.php:7
static _getAllReferences($a_id)
get all reference ids of object
$r
Definition: example_031.php:79
$old
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLockDAV()

ilDAVLocks::getLockDAV ( $objDAV,
  $token 
)

Returns the lock with the specified token on the specified DAV object.

Parameters
$objDAVDAV object to get the lock for.
stringLock token.
Returns
An array of associative arrays for all the locks that were found. Each associative array has the following keys: 'ilias_owner' => user id, 'dav_owner' => user name, 'token' => locktoken 'expires' => expiration timestamp 'depth' => 0 or 'infinity' 'scope' => 'exclusive' or 'shared'

Definition at line 328 of file class.ilDAVLocks.php.

References $DIC, $ilDB, $r, $result, $row, array, ilDBConstants\FETCHMODE_ASSOC, and writelog().

329  {
330  global $DIC;
331  $ilDB = $DIC['ilDB'];
332  $this->writelog('getLocks(' . $objDAV . ')');
333  $objId = $objDAV->getObjectId();
334  $nodeId = $objDAV->getNodeId();
335 
336  $q = 'SELECT ilias_owner, dav_owner, expires, depth, scope'
337  . ' FROM ' . $this->table
338  . ' WHERE obj_id = ' . $ilDB->quote($objId, 'integer')
339  . ' AND node_id = ' . $ilDB->quote($nodeId, 'integer')
340  . ' AND token = ' . $ilDB->quote($token, 'text')
341  ;
342  $this->writelog('getLocks(' . $objDAV . ') query=' . $q);
343  $r = $ilDB->query($q);
344 
345  $result = array();
346  while ($row = $r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
347  if ($row['depth'] == -1) {
348  $row['depth'] = 'infinity';
349  }
350  $row['scope'] = ($row['scope'] == 'x') ? 'exclusive' : 'shared';
351  $row['token'] = $token;
352  $result = $row;
353  }
354  return $result;
355  }
$result
global $DIC
Definition: saml.php:7
writelog($message)
Writes a message to the logfile.,.
$r
Definition: example_031.php:79
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ getLocksOnObjectDAV()

ilDAVLocks::getLocksOnObjectDAV ( $objDAV)

Returns all locks on the specified object.

This method does not take into account inherited locks from parent objects.

Parameters
$objDAVDAV object to get the locks for.
Returns
An array of associative arrays for all the locks that were found. Each associative array has the following keys: 'ilias_owner' => user id, 'dav_owner' => user name, 'token' => locktoken 'expires' => expiration timestamp 'depth' => 0 or 'infinity' 'scope' => 'exclusive' or 'shared'

Definition at line 370 of file class.ilDAVLocks.php.

References getLocksOnObjectObj().

371  {
372  $objId = $objDAV->getObjectId();
373  $nodeId = $objDAV->getNodeId();
374 
375  return $this->getLocksOnObjectObj($objId, $nodeId);
376  }
getLocksOnObjectObj($objId, $nodeId=0)
Returns all locks on the specified object id.
+ Here is the call graph for this function:

◆ getLocksOnObjectObj()

ilDAVLocks::getLocksOnObjectObj (   $objId,
  $nodeId = 0 
)

Returns all locks on the specified object id.

This method does not take into account inherited locks from parent objects.

Parameters
$objIdobject ID to get the locks for.
intnode a node of the object. For example the id of a page of a learning module. Specify 0 if the object does not have multiple nodes.
Returns
An array of associative arrays for all the locks that were found. Each associative array has the following keys: 'ilias_owner' => user id, 'dav_owner' => user name, 'token' => locktoken 'expires' => expiration timestamp 'depth' => 0 or 'infinity' 'scope' => 'exclusive' or 'shared'

Definition at line 393 of file class.ilDAVLocks.php.

References $DIC, $ilDB, $r, $result, $row, array, ilDBConstants\FETCHMODE_ASSOC, time, and writelog().

Referenced by getLocksOnObjectDAV().

394  {
395  global $DIC;
396  $ilDB = $DIC['ilDB'];
397  $this->writelog('getLocks(' . $objDAV . ')');
398  $nodeId = 0;
399  $q = 'SELECT ilias_owner, dav_owner, token, expires, depth, scope'
400  . ' FROM ' . $this->table
401  . ' WHERE obj_id = ' . $ilDB->quote($objId, 'integer')
402  . ' AND node_id = ' . $ilDB->quote($nodeId, 'integer')
403  . ' AND expires > ' . $ilDB->quote(time(), 'integer')
404  ;
405  $this->writelog('getLocks(' . $objDAV . ') query=' . $q);
406  $r = $ilDB->query($q);
407 
408  $result = array();
409  while ($row = $r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
410  if ($row['depth'] == -1) {
411  $row['depth'] = 'infinity';
412  }
413  $row['scope'] = ($row['scope'] == 'x') ? 'exclusive' : 'shared';
414  $result[] = $row;
415  }
416  return $result;
417  }
$result
global $DIC
Definition: saml.php:7
writelog($message)
Writes a message to the logfile.,.
$r
Definition: example_031.php:79
Create styles array
The data for the language used.
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLocksOnPathDAV()

ilDAVLocks::getLocksOnPathDAV ( $pathDAV)

Returns all locks on the specified object path.

Parameters
$pathDAVArray with DAV objects to get the locks for.
Returns
An array of associative arrays for all the locks that were found. Each associative array has the following keys: 'obj_id' => object id 'node_id' => node id 'ilias_owner' => user id, 'dav_owner' => user name, 'token' => locktoken 'expires' => expiration timestamp 'depth' => 0 or 'infinity' 'scope' => 'exclusive' or 'shared'

Definition at line 433 of file class.ilDAVLocks.php.

References $DIC, $ilDB, $r, $result, $row, array, ilDBConstants\FETCHMODE_ASSOC, time, and writelog().

434  {
435  global $DIC;
436  $ilDB = $DIC['ilDB'];
437  $this->writelog('getLocksOnPathDAV');
438 
439  $q = 'SELECT obj_id, node_id, ilias_owner, dav_owner, token, expires, depth, scope'
440  . ' FROM ' . $this->table
441  . ' WHERE expires > ' . $ilDB->quote(time(), 'integer')
442  . ' AND ('
443  ;
444  $isFirst = true;
445  foreach ($pathDAV as $objDAV) {
446  $objId = $objDAV->getObjectId();
447  $nodeId = $objDAV->getNodeId();
448  if ($isFirst) {
449  $isFirst = false;
450  } else {
451  $q .= ' OR ';
452  }
453  $q .= '(obj_id = ' . $ilDB->quote($objId, 'integer') . ' AND node_id = ' . $ilDB->quote($nodeId, 'integer') . ')';
454  }
455  $q .= ')';
456 
457  $this->writelog('getLocksOnPathDAV(' . $objDAV . ') query=' . $q);
458  $r = $ilDB->query($q);
459 
460  $result = array();
461  while ($row = $r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
462  if ($row['depth'] == -1) {
463  $row['depth'] = 'infinity';
464  }
465  $row['scope'] = ($row['scope'] == 'x') ? 'exclusive' : 'shared';
466  $result[] = $row;
467  }
468  $this->writelog('getLocksOnPathDAV:' . var_export($result, true));
469  return $result;
470  }
$result
global $DIC
Definition: saml.php:7
writelog($message)
Writes a message to the logfile.,.
$r
Definition: example_031.php:79
Create styles array
The data for the language used.
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function:

◆ getLocksOnPathRef()

ilDAVLocks::getLocksOnPathRef (   $refId)

Returns all locks on the specified object, specified by a reference id.

Parameters
$refIdThe reference id of the object
Returns
An array of associative arrays for all the locks that were found. Each associative array has the following keys: 'obj_id' => object id 'node_id' => node id 'ilias_owner' => user id, 'dav_owner' => user name, 'token' => locktoken 'expires' => expiration timestamp 'depth' => 0 or 'infinity' 'scope' => 'exclusive' or 'shared'

Definition at line 486 of file class.ilDAVLocks.php.

References $DIC, $ilDB, $r, $result, $row, array, ilDBConstants\FETCHMODE_ASSOC, time, and writelog().

Referenced by lockRef().

487  {
488  global $DIC;
489  $ilDB = $DIC['ilDB'];
490  $tree = $DIC['tree'];
491  $this->writelog('getLocksOnPathRef(' . $refId . ')');
492 
493  $pathFull = $tree->getPathFull($refId);
494 
495  $q = 'SELECT obj_id, node_id, ilias_owner, dav_owner, token, expires, depth, scope'
496  . ' FROM ' . $this->table
497  . ' WHERE expires > ' . $ilDB->quote(time(), 'integer')
498  . ' AND ('
499  ;
500  $isFirst = true;
501  foreach ($pathFull as $pathItem) {
502  $objId = $pathItem['obj_id'];
503  $nodeId = 0;
504  if ($isFirst) {
505  $isFirst = false;
506  } else {
507  $q .= ' OR ';
508  }
509  $q .= '(obj_id = ' . $ilDB->quote($objId, 'integer') . ' AND node_id = ' . $ilDB->quote($nodeId, 'integer') . ')';
510  }
511  $q .= ')';
512 
513  $this->writelog('getLocksOnPathRef(' . $refId . ') query=' . $q);
514  $r = $ilDB->query($q);
515 
516  $result = array();
517  while ($row = $r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
518  if ($row['depth'] == -1) {
519  $row['depth'] = 'infinity';
520  }
521  $row['scope'] = ($row['scope'] == 'x') ? 'exclusive' : 'shared';
522  $result[] = $row;
523  }
524  return $result;
525  }
$result
global $DIC
Definition: saml.php:7
writelog($message)
Writes a message to the logfile.,.
$r
Definition: example_031.php:79
Create styles array
The data for the language used.
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lockRef()

ilDAVLocks::lockRef (   $refId,
  $iliasUserId,
  $davUser,
  $token,
  $expires,
  $depth,
  $scope 
)

Creates a lock an object, unless there are locks on the object or its parents, which prevent the creation of the lock.

As described in RFC2518, chapter 7.1, a write lock prevents all principals whithout the lock from successfully executing a PUT, POST, PROPPATCH, LOCK, UNLOCK, MOVE, DELETE, or MKCOL on the locked resource. All other current methods, GET in particular, function independently of the lock. For a collection, the lock also affects the ability to add and remove members.

Parameters
intReference id of the object to be locked.
intThe id of a node of the object. For example the id of a page of a learning module. Specify 0 if the object does not have multiple nodes.
intILIAS user id of the lock owner.
stringDAV user of the lock owner.
stringLock token.
intexpiration timestamp for the lock.
boolDepth of the lock. Must be 0 or 'infinity'.
boolScope of the lock. Must be 'exclusive' or 'shared'.
Returns
true, if creation of lock succeeded, returns a string if the creation failed.

Definition at line 76 of file class.ilDAVLocks.php.

References $data, $DIC, $result, $txt, getLocksOnPathRef(), lockWithoutCheckingObj(), updateLockWithoutCheckingObj(), and writelog().

77  {
78  $this->writelog('lockRef(' . $refId . ',' . $iliasUserId . ',' . $davUser . ',' . $token . ',' . $expires . ',' . $depth . ',' . $scope . ')');
79  global $DIC;
80  $tree = $DIC['tree'];
81  $txt = $DIC['txt'];
82 
83  $result = true;
84  $data = $tree->getNodeData($refId);
85 
86  // Check whether a lock on the path to the object prevents the creation
87  // of a new lock
88  $locksOnPath = $this->getLocksOnPathRef($refId);
89 
90  if ($scope == 'exclusive' && count($locksOnPath) > 0) {
91  $result = 'couldnt create exclusive lock due to existing lock on path ' . var_export($locksOnPath, true);
92  }
93 
94  foreach ($locksOnPath as $lock) {
95  if ($lock['token'] == $token &&
96  $lock['obj_id'] == $data['obj_id'] &&
97  $lock['ilias_owner'] == $iliasUserId) {
98  if ($this->updateLockWithoutCheckingObj($data['obj_id'], 0, $token, $expires)) {
99  return true;
100  } else {
101  return 'couldnt update lock';
102  }
103  }
104  }
105 
106  if ($result === true) {
107  foreach ($locksOnPath as $lock) {
108  if ($lock['scope'] == 'exclusive' &&
109  ($lock['depth'] == 'infinity' || $lock['obj_id'] == $data['obj_id']) &&
110  $lock['ilias_owner'] != $iliasUserId) {
111  $result = 'couldnt create lock due to exclusive lock on path ' . var_export($lock, true);
112  break;
113  }
114  }
115  }
116 
117  // Check whether a lock on the children (subtree) of the object prevents
118  // the creation of a new lock
119  if ($result === true && $depth == 'infinity') {
120  // XXX - if lock has depth infinity, we must check for locks in the subtree
121  }
122 
123  if ($result === true) {
125  $data['obj_id'],
126  0,
127  $iliasUserId,
128  $davUser,
129  $token,
130  $expires,
131  $depth,
132  $scope
133  );
134  }
135  return $result;
136  }
updateLockWithoutCheckingObj($objId, $nodeId, $token, $expires)
Updates a write lock.
$result
lockWithoutCheckingObj($objId, $nodeId, $iliasUserId, $davUser, $token, $expires, $depth, $scope)
Creates a write lock.
global $DIC
Definition: saml.php:7
getLocksOnPathRef($refId)
Returns all locks on the specified object, specified by a reference id.
writelog($message)
Writes a message to the logfile.,.
$txt
Definition: error.php:11
+ Here is the call graph for this function:

◆ lockWithoutCheckingDAV()

ilDAVLocks::lockWithoutCheckingDAV ( $objDAV,
  $iliasUserId,
  $davUser,
  $token,
  $expires,
  $depth,
  $scope 
)

Creates a write lock.

Important: This is a low-level function, which does not check on existing locks, before creating the lock data.

As described in RFC2518, chapter 7.1, a write lock prevents all principals whithout the lock from successfully executing a PUT, POST, PROPPATCH, LOCK, UNLOCK, MOVE, DELETE, or MKCOL on the locked resource. All other current methods, GET in particular, function independently of the lock. For a collection, the lock also affects the ability to add and remove members.

Parameters
$objDAVDAV object to be locked.
intILIAS user id of the lock owner.
stringDAV user of the lock owner.
stringLock token.
intexpiration timestamp for the lock.
boolDepth of the lock. Must be 0 or 'infinity'.
boolScope of the lock. Must be 'exclusive' or 'shared'.
Returns
true, if creation of lock succeeded.

Definition at line 160 of file class.ilDAVLocks.php.

References lockWithoutCheckingObj().

161  {
162  $objId = $objDAV->getObjectId();
163  $nodeId = $objDAV->getNodeId();
164 
165  return $this->lockWithoutCheckingObj($objId, $nodeId, $iliasUserId, $davUser, $token, $expires, $depth, $scope);
166  }
lockWithoutCheckingObj($objId, $nodeId, $iliasUserId, $davUser, $token, $expires, $depth, $scope)
Creates a write lock.
+ Here is the call graph for this function:

◆ lockWithoutCheckingObj()

ilDAVLocks::lockWithoutCheckingObj (   $objId,
  $nodeId,
  $iliasUserId,
  $davUser,
  $token,
  $expires,
  $depth,
  $scope 
)

Creates a write lock.

Important: This is a low-level function, which does not check on existing locks, before creating the lock data.

As described in RFC2518, chapter 7.1, a write lock prevents all principals whithout the lock from successfully executing a PUT, POST, PROPPATCH, LOCK, UNLOCK, MOVE, DELETE, or MKCOL on the locked resource. All other current methods, GET in particular, function independently of the lock. For a collection, the lock also affects the ability to add and remove members.

Parameters
intid of the object to be locked.
intnode The id of a node of the object. For example the id of a page of a learning module. Specify 0 if the object does not have multiple nodes. . *
intILIAS user id of the lock owner.
stringDAV user of the lock owner.
stringLock token.
intexpiration timestamp for the lock.
boolDepth of the lock. Must be 0 or 'infinity'.
boolScope of the lock. Must be 'exclusive' or 'shared'.
Returns
true, if creation of lock succeeded.

Definition at line 191 of file class.ilDAVLocks.php.

References $DIC, $ilDB, $result, PEAR\isError(), and writelog().

Referenced by lockRef(), and lockWithoutCheckingDAV().

192  {
193  global $DIC;
194  $ilDB = $DIC['ilDB'];
195 
196  switch ($depth) {
197  case 'infinity': $depth = -1;
198  break;
199  case 0:
200  $depth = 0;
201  break;
202  default:
203  trigger_error('invalid depth ' . $depth, E_ERROR);
204  return;
205  }
206 
207  switch ($scope) {
208  case 'exclusive': $scope = 'x'; break;
209  case 'shared': $scope = 's'; break;
210  default: trigger_error('invalid scope ' . $scope, E_ERROR); return;
211  }
212 
213  $q = 'INSERT INTO ' . $this->table
214  . ' SET obj_id = ' . $ilDB->quote($objId, 'integer')
215  . ', node_id = ' . $ilDB->quote($nodeId, 'integer')
216  . ', ilias_owner = ' . $ilDB->quote($iliasUserId, 'text')
217  . ', dav_owner = ' . $ilDB->quote($davUser, 'text')
218  . ', token = ' . $ilDB->quote($token, 'text')
219  . ', expires = ' . $ilDB->quote($expires, 'integer')
220  . ', depth = ' . $ilDB->quote($depth, 'integer')
221  . ', type = \'w\''
222  . ', scope = ' . $ilDB->quote($scope, 'text')
223  ;
224  $this->writelog('lock query=' . $q);
225  $result = $ilDB->manipulate($q);
226  return !PEAR::isError($result);
227  }
$result
global $DIC
Definition: saml.php:7
writelog($message)
Writes a message to the logfile.,.
global $ilDB
isError($data, $code=null)
Tell whether a value is a PEAR error.
Definition: PEAR.php:280
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unlockWithoutCheckingDAV()

ilDAVLocks::unlockWithoutCheckingDAV ( $objDAV,
  $token 
)

Discards a write lock.

Important: This is a low-level function, which does not check on existing locks, before deleting the lock data.

Parameters
$objDAVDAV object to be locked.
stringLock token.
Returns
true on success.

Definition at line 284 of file class.ilDAVLocks.php.

References $DIC, $ilDB, $success, cleanUp(), and writelog().

285  {
286  global $DIC;
287  $ilDB = $DIC['ilDB'];
288  $this->writelog('unlock(' . $objDAV . ',' . $token . ')');
289 
290  $objId = $objDAV->getObjectId();
291  $nodeId = $objDAV->getNodeId();
292 
293  // Unlock object
294  // FIXME - Maybe we should delete all rows with the same token, not
295  // just the ones with the same token, obj_id and node_id.
296  $q = 'DELETE FROM ' . $this->table
297  . ' WHERE token = ' . $ilDB->quote($token, 'text')
298  . ' AND obj_id = ' . $ilDB->quote($objId, 'integer')
299  . ' AND node_id = ' . $ilDB->quote($nodeId, 'integer')
300  ;
301  $this->writelog('unlock query=' . $q);
302  $aff = $ilDB->manipulate($q);
303  $success = $aff > 0;
304 
305  // clean up expired locks in 1 out of 100 unlock requests
306  $random = new \ilRandom();
307  if ($random->int(1, 100) == 1) {
308  $this->cleanUp();
309  }
310 
311  return $success;
312  }
global $DIC
Definition: saml.php:7
writelog($message)
Writes a message to the logfile.,.
cleanUp()
System maintenance: get rid of locks that have expired over an hour ago.
$success
Definition: Utf8Test.php:86
global $ilDB
+ Here is the call graph for this function:

◆ updateLockWithoutCheckingDAV()

ilDAVLocks::updateLockWithoutCheckingDAV ( $objDAV,
  $token,
  $expires 
)

Updates a write lock.

Important: This is a low-level function, which does not check on existing locks, before updating the lock data.

Parameters
stringLock token.
intexpiration timestamp for the lock.
Returns
true on success.

Definition at line 239 of file class.ilDAVLocks.php.

References $DIC, $ilDB, and updateLockWithoutCheckingObj().

240  {
241  global $DIC;
242  $ilDB = $DIC['ilDB'];
243  $objId = $objDAV->getObjectId();
244  $nodeId = $objDAV->getNodeId();
245 
246  return $this->updateLockWithoutCheckingObj($objId, $nodeId, $token, $expires);
247  }
updateLockWithoutCheckingObj($objId, $nodeId, $token, $expires)
Updates a write lock.
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the call graph for this function:

◆ updateLockWithoutCheckingObj()

ilDAVLocks::updateLockWithoutCheckingObj (   $objId,
  $nodeId,
  $token,
  $expires 
)

Updates a write lock.

Important: This is a low-level function, which does not check on existing locks, before updating the lock data.

Parameters
stringLock token.
intexpiration timestamp for the lock.
Returns
true on success.

Definition at line 259 of file class.ilDAVLocks.php.

References $DIC, and $ilDB.

Referenced by lockRef(), and updateLockWithoutCheckingDAV().

260  {
261  global $DIC;
262  $ilDB = $DIC['ilDB'];
263 
264  $q = 'UPDATE ' . $this->table
265  . ' SET expires = ' . $ilDB->quote($expires, 'integer')
266  . ' WHERE token = ' . $ilDB->quote($token, 'text')
267  . ' AND obj_id = ' . $ilDB->quote($objId, 'integer')
268  . ' AND node_id = ' . $ilDB->quote($nodeId, 'integer')
269  ;
270  $aff = $ilDB->manipulate($q);
271  return $aff > 0;
272  }
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the caller graph for this function:

◆ writelog()

ilDAVLocks::writelog (   $message)
protected

Writes a message to the logfile.,.

Parameters
messageString.
Returns
void.

Definition at line 579 of file class.ilDAVLocks.php.

References $DIC, $log, and $message.

Referenced by getLockDAV(), getLocksOnObjectObj(), getLocksOnPathDAV(), getLocksOnPathRef(), lockRef(), lockWithoutCheckingObj(), and unlockWithoutCheckingDAV().

580  {
581  global $DIC;
582  $log = $DIC['log'];
583  $ilias = $DIC['ilias'];
584  if ($this->isDebug) {
585  $log->write(
586  $ilias->account->getLogin()
587  . ' DAV ilDAVLocks.' . str_replace("\n", ";", $message)
588  );
589  }
590  /*
591  if ($this->logFile)
592  {
593  $fh = fopen($this->logFile, 'a');
594  fwrite($fh, date('Y-m-d h:i:s '));
595  fwrite($fh, str_replace("\n",";",$message));
596  fwrite($fh, "\n\n");
597  fclose($fh);
598  }*/
599  }
global $DIC
Definition: saml.php:7
catch(Exception $e) $message
+ Here is the caller graph for this function:

Field Documentation

◆ $isDebug

ilDAVLocks::$isDebug = false
private

Set this to true, to get debug output in the ILIAS log.

Definition at line 47 of file class.ilDAVLocks.php.

◆ $table

ilDAVLocks::$table = 'dav_lock'
private

Definition at line 44 of file class.ilDAVLocks.php.


The documentation for this class was generated from the following file: