ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilWebDAVLocksRepository Class Reference
+ Collaboration diagram for ilWebDAVLocksRepository:

Public Member Functions

 __construct (protected ilDBInterface $db)
 
 checkIfLockExistsInDB (string $token)
 
 getLockObjectWithTokenFromDB (string $token)
 
 getLockObjectWithObjIdFromDB (int $obj_id)
 
 saveLockToDB (ilWebDAVLockObject $ilias_lock)
 
 removeLockWithTokenFromDB (string $token)
 
 purgeExpiredLocksFromDB ()
 
 updateLocks (int $old_obj_id, int $new_obj_id)
 

Private Attributes

string $lock_table = 'dav_lock'
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilWebDAVLocksRepository::__construct ( protected ilDBInterface  $db)

Definition at line 29 of file class.ilWebDAVLocksRepository.php.

30 {
31 }

Member Function Documentation

◆ checkIfLockExistsInDB()

ilWebDAVLocksRepository::checkIfLockExistsInDB ( string  $token)

Definition at line 33 of file class.ilWebDAVLocksRepository.php.

33 : bool
34 {
35 $select_query = "SELECT SELECT EXISTS(SELECT 1 FROM $this->lock_table WHERE token = " .
36 $this->db->quote($token, 'text') . ") AS count";
37 $select_result = $this->db->query($select_query);
38 $select_result->numRows();
39 $row = $this->db->fetchAssoc($select_result);
40 return isset($row);
41 }
$token
Definition: xapitoken.php:70

References $token.

◆ getLockObjectWithObjIdFromDB()

ilWebDAVLocksRepository::getLockObjectWithObjIdFromDB ( int  $obj_id)

Definition at line 68 of file class.ilWebDAVLocksRepository.php.

69 {
70 $query = "SELECT token, ilias_owner, dav_owner, expires, depth, type, scope FROM $this->lock_table WHERE obj_id = "
71 . $this->db->quote($obj_id, 'integer')
72 . " AND expires > " . $this->db->quote(time(), 'integer');
73 $select_result = $this->db->query($query);
74 $row = $this->db->fetchAssoc($select_result);
75
76 if ($row) {
77 return new ilWebDAVLockObject(
78 $row['token'],
79 $obj_id,
80 (int) $row['ilias_owner'],
81 $row['dav_owner'],
82 (int) $row['expires'],
83 (int) $row['depth'],
84 $row['type'],
85 (int) $row['scope']
86 );
87 }
88
89 return null;
90 }

◆ getLockObjectWithTokenFromDB()

ilWebDAVLocksRepository::getLockObjectWithTokenFromDB ( string  $token)

Definition at line 43 of file class.ilWebDAVLocksRepository.php.

44 {
45 $query = "SELECT obj_id, ilias_owner, dav_owner, expires, depth, type, scope FROM $this->lock_table"
46 . " WHERE token = " . $this->db->quote($token, 'text')
47 . " AND expires > " . $this->db->quote(time(), 'integer');
48
49 $select_result = $this->db->query($query);
50 $row = $this->db->fetchAssoc($select_result);
51
52 if ($row) {
53 return new ilWebDAVLockObject(
54 $token,
55 (int) $row['obj_id'],
56 (int) $row['ilias_owner'],
57 $row['dav_owner'],
58 (int) $row['expires'],
59 (int) $row['depth'],
60 $row['type'],
61 (int) $row['scope']
62 );
63 }
64
65 return null;
66 }

References $token.

◆ purgeExpiredLocksFromDB()

ilWebDAVLocksRepository::purgeExpiredLocksFromDB ( )

Definition at line 113 of file class.ilWebDAVLocksRepository.php.

113 : int
114 {
115 return $this->db->manipulate(
116 "DELETE FROM $this->lock_table WHERE expires < " . $this->db->quote(time(), 'integer')
117 );
118 }

◆ removeLockWithTokenFromDB()

ilWebDAVLocksRepository::removeLockWithTokenFromDB ( string  $token)

Definition at line 106 of file class.ilWebDAVLocksRepository.php.

106 : int
107 {
108 return $this->db->manipulate(
109 "DELETE FROM $this->lock_table WHERE token = " . $this->db->quote($token, "integer")
110 );
111 }

References $token.

◆ saveLockToDB()

ilWebDAVLocksRepository::saveLockToDB ( ilWebDAVLockObject  $ilias_lock)

Definition at line 92 of file class.ilWebDAVLocksRepository.php.

92 : void
93 {
94 $this->db->insert($this->lock_table, [
95 'token' => ['text', $ilias_lock->getToken()],
96 'obj_id' => ['integer', $ilias_lock->getObjId()],
97 'ilias_owner' => ['integer', $ilias_lock->getIliasOwner()],
98 'dav_owner' => ['text', $ilias_lock->getDavOwner()],
99 'expires' => ['integer', $ilias_lock->getExpires()],
100 'depth' => ['integer', $ilias_lock->getDepth()],
101 'type' => ['text', $ilias_lock->getType()],
102 'scope' => ['integer', $ilias_lock->getScope()]
103 ]);
104 }

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

+ Here is the call graph for this function:

◆ updateLocks()

ilWebDAVLocksRepository::updateLocks ( int  $old_obj_id,
int  $new_obj_id 
)

Definition at line 120 of file class.ilWebDAVLocksRepository.php.

120 : int
121 {
122 return $this->db->update(
123 $this->lock_table,
124 ["obj_id" => ["integer", $new_obj_id]],
125 ["obj_id" => ["integer", $old_obj_id]]
126 );
127 }

Field Documentation

◆ $lock_table

string ilWebDAVLocksRepository::$lock_table = 'dav_lock'
private

Definition at line 27 of file class.ilWebDAVLocksRepository.php.


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