ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 537 of file class.ilDAVLocks.php.

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

Referenced by unlockWithoutCheckingDAV().

538  {
539  global $DIC;
540  $ilDB = $DIC['ilDB'];
541  $tree = $DIC['tree'];
542 
543  // 1. Get rid of locks that have expired over an hour ago
544  $old = time() - 3600;
545  $q = 'DELETE'
546  .' FROM '.$this->table
547  .' WHERE expires < '.$ilDB->quote($old,'integer')
548  ;
549  $ilDB->manipulate($q);
550 
551  // 2. Get rid of null resources which are not associated to
552  // a lock due to step 1, or due to a database inconsistency
553  // because we are working with non-transactional tables
554  $q = 'SELECT dat.obj_id '
555  .' FROM object_data AS dat'
556  .' LEFT JOIN '.$this->table.' lck'
557  .' ON dat.obj_id = lck.obj_id'
558  .' WHERE dat.type = '.$ilDB->quote('null','text')
559  .' AND lck.obj_id IS NULL'
560  ;
561 /* TODO: smeyer.' FOR UPDATE' */
562 
563  $r = $ilDB->query($q);
564  while ($row = $r->fetchRow(ilDBConstants::FETCHMODE_ASSOC))
565  {
566  $references = ilObject::_getAllReferences($row['obj_id']);
567  $obj = new ilObjNull($row['obj_id'], false);
568  if (count($references) == 0)
569  {
570  $obj->delete();
571  } else {
572  foreach ($references as $refId)
573  {
574  $obj->setRefId($refId);
575  $obj->delete();
576  $nodeData = $tree->getNodeData($refId);
577  $tree->deleteTree($nodeData);
578  }
579  }
580  }
581  }
static _getAllReferences($a_id)
get all reference ids of object
$r
Definition: example_031.php:79
$old
global $ilDB
global $DIC
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 334 of file class.ilDAVLocks.php.

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

335  {
336  global $DIC;
337  $ilDB = $DIC['ilDB'];
338  $this->writelog('getLocks('.$objDAV.')');
339  $objId = $objDAV->getObjectId();
340  $nodeId = $objDAV->getNodeId();
341 
342  $q = 'SELECT ilias_owner, dav_owner, expires, depth, scope'
343  .' FROM '.$this->table
344  .' WHERE obj_id = '.$ilDB->quote($objId,'integer')
345  .' AND node_id = '.$ilDB->quote($nodeId,'integer')
346  .' AND token = '.$ilDB->quote($token,'text')
347  ;
348  $this->writelog('getLocks('.$objDAV.') query='.$q);
349  $r = $ilDB->query($q);
350 
351  $result = array();
352  while ($row = $r->fetchRow(ilDBConstants::FETCHMODE_ASSOC))
353  {
354  if ($row['depth'] == -1) $row['depth'] = 'infinity';
355  $row['scope'] = ($row['scope'] == 'x') ? 'exclusive' : 'shared';
356  $row['token'] = $token;
357  $result = $row;
358  }
359  return $result;
360  }
$result
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
global $DIC
+ 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 375 of file class.ilDAVLocks.php.

References getLocksOnObjectObj().

376  {
377  $objId = $objDAV->getObjectId();
378  $nodeId = $objDAV->getNodeId();
379 
380  return $this->getLocksOnObjectObj($objId, $nodeId);
381  }
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 398 of file class.ilDAVLocks.php.

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

Referenced by getLocksOnObjectDAV().

399  {
400  global $DIC;
401  $ilDB = $DIC['ilDB'];
402  $this->writelog('getLocks('.$objDAV.')');
403  $nodeId = 0;
404  $q = 'SELECT ilias_owner, dav_owner, token, expires, depth, scope'
405  .' FROM '.$this->table
406  .' WHERE obj_id = '.$ilDB->quote($objId,'integer')
407  .' AND node_id = '.$ilDB->quote($nodeId,'integer')
408  .' AND expires > '.$ilDB->quote(time(),'integer')
409  ;
410  $this->writelog('getLocks('.$objDAV.') query='.$q);
411  $r = $ilDB->query($q);
412 
413  $result = array();
414  while ($row = $r->fetchRow(ilDBConstants::FETCHMODE_ASSOC))
415  {
416  if ($row['depth'] == -1) $row['depth'] = 'infinity';
417  $row['scope'] = ($row['scope'] == 'x') ? 'exclusive' : 'shared';
418  $result[] = $row;
419  }
420  return $result;
421  }
$result
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
global $DIC
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 437 of file class.ilDAVLocks.php.

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

438  {
439  global $DIC;
440  $ilDB = $DIC['ilDB'];
441  $this->writelog('getLocksOnPathDAV');
442 
443  $q = 'SELECT obj_id, node_id, ilias_owner, dav_owner, token, expires, depth, scope'
444  .' FROM '.$this->table
445  .' WHERE expires > '.$ilDB->quote(time(),'integer')
446  .' AND ('
447  ;
448  $isFirst = true;
449  foreach ($pathDAV as $objDAV)
450  {
451  $objId = $objDAV->getObjectId();
452  $nodeId = $objDAV->getNodeId();
453  if ($isFirst)
454  {
455  $isFirst = false;
456  } else {
457  $q .= ' OR ';
458  }
459  $q .= '(obj_id = '.$ilDB->quote($objId,'integer').' AND node_id = '.$ilDB->quote($nodeId,'integer').')';
460  }
461  $q .= ')';
462 
463  $this->writelog('getLocksOnPathDAV('.$objDAV.') query='.$q);
464  $r = $ilDB->query($q);
465 
466  $result = array();
467  while ($row = $r->fetchRow(ilDBConstants::FETCHMODE_ASSOC))
468  {
469  if ($row['depth'] == -1) $row['depth'] = 'infinity';
470  $row['scope'] = ($row['scope'] == 'x') ? 'exclusive' : 'shared';
471  $result[] = $row;
472  }
473  $this->writelog('getLocksOnPathDAV:'.var_export($result,true));
474  return $result;
475  }
$result
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
global $DIC
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 491 of file class.ilDAVLocks.php.

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

Referenced by lockRef().

492  {
493  global $DIC;
494  $ilDB = $DIC['ilDB'];
495  $tree = $DIC['tree'];
496  $this->writelog('getLocksOnPathRef('.$refId.')');
497 
498  $pathFull = $tree->getPathFull($refId);
499 
500  $q = 'SELECT obj_id, node_id, ilias_owner, dav_owner, token, expires, depth, scope'
501  .' FROM '.$this->table
502  .' WHERE expires > '.$ilDB->quote(time(),'integer')
503  .' AND ('
504  ;
505  $isFirst = true;
506  foreach ($pathFull as $pathItem)
507  {
508  $objId = $pathItem['obj_id'];
509  $nodeId = 0;
510  if ($isFirst)
511  {
512  $isFirst = false;
513  } else {
514  $q .= ' OR ';
515  }
516  $q .= '(obj_id = '.$ilDB->quote($objId,'integer').' AND node_id = '.$ilDB->quote($nodeId,'integer').')';
517  }
518  $q .= ')';
519 
520  $this->writelog('getLocksOnPathRef('.$refId.') query='.$q);
521  $r = $ilDB->query($q);
522 
523  $result = array();
524  while ($row = $r->fetchRow(ilDBConstants::FETCHMODE_ASSOC))
525  {
526  if ($row['depth'] == -1) $row['depth'] = 'infinity';
527  $row['scope'] = ($row['scope'] == 'x') ? 'exclusive' : 'shared';
528  $result[] = $row;
529  }
530  return $result;
531  }
$result
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
global $DIC
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  {
96  if ($lock['token'] == $token &&
97  $lock['obj_id'] == $data['obj_id'] &&
98  $lock['ilias_owner'] == $iliasUserId)
99  {
100  if ($this->updateLockWithoutCheckingObj($data['obj_id'], 0, $token, $expires))
101  {
102  return true;
103  }
104  else
105  {
106  return 'couldnt update lock';
107  }
108  }
109  }
110 
111  if ($result === true)
112  {
113  foreach ($locksOnPath as $lock)
114  {
115  if ($lock['scope'] == 'exclusive' &&
116  ($lock['depth'] == 'infinity' || $lock['obj_id'] == $data['obj_id']) &&
117  $lock['ilias_owner'] != $iliasUserId)
118  {
119  $result = 'couldnt create lock due to exclusive lock on path '.var_export($lock,true);
120  break;
121  }
122  }
123  }
124 
125  // Check whether a lock on the children (subtree) of the object prevents
126  // the creation of a new lock
127  if ($result === true && $depth == 'infinity')
128  {
129  // XXX - if lock has depth infinity, we must check for locks in the subtree
130  }
131 
132  if ($result === true)
133  {
135  $data['obj_id'], 0,
136  $iliasUserId, $davUser, $token, $expires, $depth, $scope
137  );
138  }
139  return $result;
140  }
updateLockWithoutCheckingObj($objId, $nodeId, $token, $expires)
Updates a write lock.
$result
lockWithoutCheckingObj($objId, $nodeId, $iliasUserId, $davUser, $token, $expires, $depth, $scope)
Creates a write lock.
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:12
global $DIC
+ 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 164 of file class.ilDAVLocks.php.

References lockWithoutCheckingObj().

165  {
166  $objId = $objDAV->getObjectId();
167  $nodeId = $objDAV->getNodeId();
168 
169  return $this->lockWithoutCheckingObj($objId, $nodeId, $iliasUserId, $davUser, $token, $expires, $depth, $scope);
170  }
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 195 of file class.ilDAVLocks.php.

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

Referenced by lockRef(), and lockWithoutCheckingDAV().

196  {
197  global $DIC;
198  $ilDB = $DIC['ilDB'];
199 
200  switch ($depth)
201  {
202  case 'infinity' : $depth = -1;
203  break;
204  case 0 :
205  $depth = 0;
206  break;
207  default :
208  trigger_error('invalid depth '.$depth,E_ERROR);
209  return;
210  }
211 
212  switch ($scope)
213  {
214  case 'exclusive' : $scope = 'x'; break;
215  case 'shared' : $scope = 's'; break;
216  default : trigger_error('invalid scope '.$scope,E_ERROR); return;
217  }
218 
219  $q = 'INSERT INTO '.$this->table
220  .' SET obj_id = '.$ilDB->quote($objId,'integer')
221  .', node_id = '.$ilDB->quote($nodeId,'integer')
222  .', ilias_owner = '.$ilDB->quote($iliasUserId,'text')
223  .', dav_owner = '.$ilDB->quote($davUser,'text')
224  .', token = '.$ilDB->quote($token,'text')
225  .', expires = '.$ilDB->quote($expires,'integer')
226  .', depth = '.$ilDB->quote($depth,'integer')
227  .', type = \'w\''
228  .', scope = '.$ilDB->quote($scope,'text')
229  ;
230  $this->writelog('lock query='.$q);
231  $result = $ilDB->manipulate($q);
232  return ! PEAR::isError($result);
233  }
$result
writelog($message)
Writes a message to the logfile.,.
global $ilDB
global $DIC
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 290 of file class.ilDAVLocks.php.

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

291  {
292  global $DIC;
293  $ilDB = $DIC['ilDB'];
294  $this->writelog('unlock('.$objDAV.','.$token.')');
295 
296  $objId = $objDAV->getObjectId();
297  $nodeId = $objDAV->getNodeId();
298 
299  // Unlock object
300  // FIXME - Maybe we should delete all rows with the same token, not
301  // just the ones with the same token, obj_id and node_id.
302  $q = 'DELETE FROM '.$this->table
303  .' WHERE token = '.$ilDB->quote($token,'text')
304  .' AND obj_id = '.$ilDB->quote($objId,'integer')
305  .' AND node_id = '.$ilDB->quote($nodeId,'integer')
306  ;
307  $this->writelog('unlock query='.$q);
308  $aff = $ilDB->manipulate($q);
309  $success = $aff > 0;
310 
311  // clean up expired locks in 1 out of 100 unlock requests
312  if (rand(1,100) == 1)
313  {
314  $this->cleanUp();
315  }
316 
317  return $success;
318  }
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
global $DIC
+ 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 245 of file class.ilDAVLocks.php.

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

246  {
247  global $DIC;
248  $ilDB = $DIC['ilDB'];
249  $objId = $objDAV->getObjectId();
250  $nodeId = $objDAV->getNodeId();
251 
252  return $this->updateLockWithoutCheckingObj($objId, $nodeId, $token, $expires);
253  }
updateLockWithoutCheckingObj($objId, $nodeId, $token, $expires)
Updates a write lock.
global $ilDB
global $DIC
+ 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 265 of file class.ilDAVLocks.php.

References $DIC, and $ilDB.

Referenced by lockRef(), and updateLockWithoutCheckingDAV().

266  {
267  global $DIC;
268  $ilDB = $DIC['ilDB'];
269 
270  $q = 'UPDATE '.$this->table
271  .' SET expires = '.$ilDB->quote($expires,'integer')
272  .' WHERE token = '.$ilDB->quote($token,'text')
273  .' AND obj_id = '.$ilDB->quote($objId,'integer')
274  .' AND node_id = '.$ilDB->quote($nodeId,'integer')
275  ;
276  $aff = $ilDB->manipulate($q);
277  return $aff > 0;
278  }
global $ilDB
global $DIC
+ 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 588 of file class.ilDAVLocks.php.

References $DIC, and $log.

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

589  {
590  global $DIC;
591  $log = $DIC['log'];
592  $ilias = $DIC['ilias'];
593  if ($this->isDebug)
594  {
595  $log->write(
596  $ilias->account->getLogin()
597  .' DAV ilDAVLocks.'.str_replace("\n",";",$message)
598  );
599  }
600  /*
601  if ($this->logFile)
602  {
603  $fh = fopen($this->logFile, 'a');
604  fwrite($fh, date('Y-m-d h:i:s '));
605  fwrite($fh, str_replace("\n",";",$message));
606  fwrite($fh, "\n\n");
607  fclose($fh);
608  }*/
609  }
global $DIC
+ 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: