ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilWebDAVDBManager Class Reference

Class ilWebDAVDBManager. More...

+ Collaboration diagram for ilWebDAVDBManager:

Public Member Functions

 __construct ($db)
 
 checkIfLockExistsInDB ($token)
 
 getLockObjectWithTokenFromDB ($token)
 Returns lock Object from given tocken. More...
 
 getLockObjectWithObjIdFromDB ($obj_id)
 
 saveLockToDB (ilWebDAVLockObject $ilias_lock)
 
 removeLockWithTokenFromDB ($token)
 Removes one specific lock. More...
 
 purgeExpiredLocksFromDB ()
 Removes all locks from DB that are expired (expires < time()) More...
 

Protected Attributes

 $db
 

Private Attributes

 $lock_table = 'dav_lock'
 

Detailed Description

Class ilWebDAVDBManager.

According to the repository pattern, this class manages the DB actions from other WebDAV classes. At the moment, the only direct interaction between WebDAV and the DB is for the locking mechanism.

Author
Raphael Heer rapha.nosp@m.el.h.nosp@m.eer@h.nosp@m.slu..nosp@m.ch $Id$

Definition at line 12 of file class.ilWebDAVDBManager.php.

Constructor & Destructor Documentation

◆ __construct()

ilWebDAVDBManager::__construct (   $db)

Definition at line 21 of file class.ilWebDAVDBManager.php.

References $db.

22  {
23  $this->db = $db;
24  }

Member Function Documentation

◆ checkIfLockExistsInDB()

ilWebDAVDBManager::checkIfLockExistsInDB (   $token)

Definition at line 26 of file class.ilWebDAVDBManager.php.

References $row, and PHPMailer\PHPMailer\$token.

27  {
28  $select_query = "SELECT count(*) AS cnt FROM $this->locks_table WHERE token = " . $this->db->quote($token, 'text');
29  $select_result = $this->db->query($select_query);
30  $row = $this->db->fetchAssoc($select_result);
31  if (isset($row)) {
32  return true;
33  }
34  return false;
35  }
$row

◆ getLockObjectWithObjIdFromDB()

ilWebDAVDBManager::getLockObjectWithObjIdFromDB (   $obj_id)

Definition at line 58 of file class.ilWebDAVDBManager.php.

References $query, $row, and ilWebDAVLockObject\createFromAssocArray().

59  {
60  $query = "SELECT * FROM $this->lock_table WHERE obj_id = "
61  . $this->db->quote($obj_id, 'integer')
62  . " AND expires > " . $this->db->quote(time(), 'integer');
63  $select_result = $this->db->query($query);
64  $row = $this->db->fetchAssoc($select_result);
65 
66  if ($row) {
68  }
69 
70  return false;
71  }
static createFromAssocArray($assoc_array)
$query
$row
+ Here is the call graph for this function:

◆ getLockObjectWithTokenFromDB()

ilWebDAVDBManager::getLockObjectWithTokenFromDB (   $token)

Returns lock Object from given tocken.

Parameters
string$token
Returns
ilWebDAVLockObject|boolean

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

References $query, $row, PHPMailer\PHPMailer\$token, and ilWebDAVLockObject\createFromAssocArray().

43  {
44  $query = "SELECT * FROM $this->lock_table"
45  . " WHERE token = " . $this->db->quote($token, 'text')
46  . " AND expires > " . $this->db->quote(time(), 'integer');
47 
48  $select_result = $this->db->query($query);
49  $row = $this->db->fetchAssoc($select_result);
50 
51  if ($row) {
53  }
54 
55  return false;
56  }
static createFromAssocArray($assoc_array)
$query
$row
+ Here is the call graph for this function:

◆ purgeExpiredLocksFromDB()

ilWebDAVDBManager::purgeExpiredLocksFromDB ( )

Removes all locks from DB that are expired (expires < time())

Returns
array with all affected locks

Definition at line 103 of file class.ilWebDAVDBManager.php.

104  {
105  return $this->db->manipulate("DELETE FROM $this->lock_table WHERE expires < " . $this->db->quote(time(), 'integer'));
106  }

◆ removeLockWithTokenFromDB()

ilWebDAVDBManager::removeLockWithTokenFromDB (   $token)

Removes one specific lock.

Parameters
integer$token
Returns
array with affected lock (if there was a lock)

Definition at line 93 of file class.ilWebDAVDBManager.php.

References PHPMailer\PHPMailer\$token.

94  {
95  return $this->db->manipulate("DELETE FROM $this->lock_table WHERE token = " . $this->db->quote($token, "integer"));
96  }

◆ saveLockToDB()

ilWebDAVDBManager::saveLockToDB ( ilWebDAVLockObject  $ilias_lock)

Definition at line 73 of file class.ilWebDAVDBManager.php.

References ilWebDAVLockObject\getDavOwner(), ilWebDAVLockObject\getDepth(), ilWebDAVLockObject\getExpires(), ilWebDAVLockObject\getIliasOwner(), ilWebDAVLockObject\getObjId(), ilWebDAVLockObject\getScope(), ilWebDAVLockObject\getToken(), and ilWebDAVLockObject\getType().

74  {
75  $this->db->insert($this->lock_table, array(
76  'token' => array('text', $ilias_lock->getToken()),
77  'obj_id' => array('integer', $ilias_lock->getObjId()),
78  'ilias_owner' => array('integer', $ilias_lock->getIliasOwner()),
79  'dav_owner' => array('text', $ilias_lock->getDavOwner()),
80  'expires' => array('integer', $ilias_lock->getExpires()),
81  'depth' => array('integer', $ilias_lock->getDepth()),
82  'type' => array('text', $ilias_lock->getType()),
83  'scope' => array('integer', $ilias_lock->getScope())
84  ));
85  }
+ Here is the call graph for this function:

Field Documentation

◆ $db

ilWebDAVDBManager::$db
protected

Definition at line 17 of file class.ilWebDAVDBManager.php.

Referenced by __construct().

◆ $lock_table

ilWebDAVDBManager::$lock_table = 'dav_lock'
private

Definition at line 19 of file class.ilWebDAVDBManager.php.


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